Difference between revisions of "PO2 Syndrome"

(Created page with 'PO2 Syndrome (power-of-two syndrome) refers to the problem older graphic cards/drivers have: they can't display graphics whose width and height are not a power of two, that i…')
 
m
Line 8: Line 8:
 
Both have a downside: getting the width, height and center of the image does not work right, which can be especially wrong for rotation. The solution is to keep the ''real'' width and height around, and use them rather than [[(Image):getWidth|getWidth()]] and [[(Image):getHeight|getHeight()]].
 
Both have a downside: getting the width, height and center of the image does not work right, which can be especially wrong for rotation. The solution is to keep the ''real'' width and height around, and use them rather than [[(Image):getWidth|getWidth()]] and [[(Image):getHeight|getHeight()]].
  
= Drop-in solution =
+
== Drop-in solution ==
 
Both for users and lovers, there exists a drop-in solution (for Linux only, at the moment), based on method #2. See http://love2d.org/forums/viewtopic.php?f=5&t=1433&p=16922#p16922.
 
Both for users and lovers, there exists a drop-in solution (for Linux only, at the moment), based on method #2. See http://love2d.org/forums/viewtopic.php?f=5&t=1433&p=16922#p16922.
  
 
It does not take the real-size problem, described above, into account.
 
It does not take the real-size problem, described above, into account.

Revision as of 21:27, 15 October 2010

PO2 Syndrome (power-of-two syndrome) refers to the problem older graphic cards/drivers have: they can't display graphics whose width and height are not a power of two, that is: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, ...

There are multiple things lovers can do to support their poor afflicted users.

  1. Only use PO2-sized image files, as proposed at love.graphics.newImage. (One can add transparent edge for that end.)
  2. Use an ImageData object to pad non-PO2-sized image files.

Both have a downside: getting the width, height and center of the image does not work right, which can be especially wrong for rotation. The solution is to keep the real width and height around, and use them rather than getWidth() and getHeight().

Drop-in solution

Both for users and lovers, there exists a drop-in solution (for Linux only, at the moment), based on method #2. See http://love2d.org/forums/viewtopic.php?f=5&t=1433&p=16922#p16922.

It does not take the real-size problem, described above, into account.