Any drawing of a image from file results in a whit box?
- 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: 3726
- 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.
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
Re: Any drawing of a image from file results in a whit box?
each side should be a power of two: 2,4,8,16,32,64...theelitenoob wrote:oh, so each side of the image should be a multiple of 2 then?
It does not have to be this problem though. It could also be because of
Code: Select all
love.graphics.setColor(255,255,255)
I use:
Code: Select all
love.graphics.reset
Sry about my english.
Re: Any drawing of a image from file results in a whit box?
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.clickrush wrote:it also overwrites images.Code: Select all
love.graphics.setColor(255,255,255)
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?
Ok, so for example can i have an image that is 16x32? or does it have to be 32x32?clickrush wrote:each side should be a power of two: 2,4,8,16,32,64...theelitenoob wrote:oh, so each side of the image should be a multiple of 2 then?
hi, I'm The Elite Noob
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
Re: Any drawing of a image from file results in a whit box?
yeah I had pure black I think and it took me ages to figure out why the image is black then (duh!)thelinx wrote: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.clickrush wrote:it also overwrites images.Code: Select all
love.graphics.setColor(255,255,255)
It's only if the colour is set to like, red, or something, that the pictures you draw will appear red.
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? )
Sry about my english.
- slime
- Solid Snayke
- Posts: 3163
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Any drawing of a image from file results in a whit box?
In OpenGL, the RGBA values of colors are between 0 and 1, with white being 1,1,1,1. When you setColor, it multiplies the 0-1 rgba values of the image's pixels with the 0-1 rgba values of the color you set, so white (255, 255, 255) gets translated to 1,1,1,1, and then it does component-wise multiplication, so if the pixel is already white (1,1,1,1) then it will be (1*1, 1*1, 1*1, 1*1) which is still white. If the pixel is sort of orange or something (1,0.5,0,1) then the final result will still be the same (1*1, 0.5*1, 0*1, 1*1).clickrush wrote: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? )
Who is online
Users browsing this forum: Bing [Bot] and 2 guests