## Any drawing of a image from file results in a whit box?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
theelitenoob
Prole
Posts: 7
Joined: Sun Dec 25, 2011 1:22 am
Location: Athens!
Contact:

### Any drawing of a image from file results in a whit box?

Help! I have no idea why, but no matter whenever i draw a .png image from a sprite-sheet or any other image, even standalone ones my game only ever shows a white box or rectangle, i followed all the docs and tuts but it doesn't help! Anyone know how to fix this?
hi, I'm The Elite Noob

Jasoco
Inner party member
Posts: 3653
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

### Re: Any drawing of a image from file results in a whit box?

Power of 2 Syndrome strikes again!

0.8.0 can't come soon enough to stop these threads from being posted over and over and over.

http://love2d.org/wiki/PO2_Syndrome

Make your image sizes a multiple of 2.

i.e. 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024

Some graphics cards can't handle images with sizes that aren't PO2. Yours can't for instance.

theelitenoob
Prole
Posts: 7
Joined: Sun Dec 25, 2011 1:22 am
Location: Athens!
Contact:

### Re: Any drawing of a image from file results in a whit box?

oh, so each side of the image should be a multiple of 2 then?
hi, I'm The Elite Noob

clickrush
Citizen
Posts: 83
Joined: Tue Dec 13, 2011 12:50 am

### Re: Any drawing of a image from file results in a whit box?

theelitenoob wrote:oh, so each side of the image should be a multiple of 2 then?
each side should be a power of two: 2,4,8,16,32,64...

It does not have to be this problem though. It could also be because of

Code: Select all

love.graphics.setColor(255,255,255)
it also overwrites images.
I use:

Code: Select all

love.graphics.reset
in this case before I draw images. But I don't know if this is the way you should do it. It works though.

thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

### Re: Any drawing of a image from file results in a whit box?

clickrush wrote:

Code: Select all

love.graphics.setColor(255,255,255)
it also overwrites images.
This is incorrect. If the colour is set to white (255, 255, 255) when drawing an image, no colour modulation is performed on that image.
It's only if the colour is set to like, red, or something, that the pictures you draw will appear red.

theelitenoob
Prole
Posts: 7
Joined: Sun Dec 25, 2011 1:22 am
Location: Athens!
Contact:

### Re: Any drawing of a image from file results in a whit box?

clickrush wrote:
theelitenoob wrote:oh, so each side of the image should be a multiple of 2 then?
each side should be a power of two: 2,4,8,16,32,64...
Ok, so for example can i have an image that is 16x32? or does it have to be 32x32?
hi, I'm The Elite Noob

thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

### Re: Any drawing of a image from file results in a whit box?

16x32 works. The sides do not have to be equal.

theelitenoob
Prole
Posts: 7
Joined: Sun Dec 25, 2011 1:22 am
Location: Athens!
Contact:

### Re: Any drawing of a image from file results in a whit box?

OK, thanks for clearing it up for me!
hi, I'm The Elite Noob

clickrush
Citizen
Posts: 83
Joined: Tue Dec 13, 2011 12:50 am

### Re: Any drawing of a image from file results in a whit box?

thelinx wrote:
clickrush wrote:

Code: Select all

love.graphics.setColor(255,255,255)
it also overwrites images.
This is incorrect. If the colour is set to white (255, 255, 255) when drawing an image, no colour modulation is performed on that image.
It's only if the colour is set to like, red, or something, that the pictures you draw will appear red.
yeah I had pure black I think and it took me ages to figure out why the image is black then (duh!)

I find this interesting though. why does white only behave like this? This is cool because i can use setColor white instead of reset now (is it possibly for this exact reason? )

slime
Solid Snayke
Posts: 2904
Joined: Mon Aug 23, 2010 6:45 am