Page 9 of 23
Re: 0.6.0 Update
Posted: Sun Sep 27, 2009 3:52 pm
by Jasoco
What's a Power of 2 image?
Re: 0.6.0 Update
Posted: Sun Sep 27, 2009 4:09 pm
by bartbes
Image with it's width and height being a power of 2.
Re: 0.6.0 Update
Posted: Sun Sep 27, 2009 4:10 pm
by Jasoco
That doesn't explain what a power of 2 is. I failed Algebra, talk to me like I am in preschool.
Re: 0.6.0 Update
Posted: Sun Sep 27, 2009 4:12 pm
by osgeld
2 4 8 16 32 64 128 256 512 1024 2048 ect
http://en.wikipedia.org/wiki/Power_of_two
open gl requires images be a power of 2, love just usually padded it for you if it wasnt
also it doesnt have to be square ie 1024x128 is perfectly valid
Re: 0.6.0 Update
Posted: Sun Sep 27, 2009 5:53 pm
by Jasoco
Ah, good.
Re: 0.6.0 Update
Posted: Wed Sep 30, 2009 12:40 pm
by appleide
rude wrote:Yes. The plan is also to add a function to ImageData:
Code: Select all
imgd = love.image.newImageData("evil.png")
imgd:padPowerTwo()
image = love.graphics.newImage(imdg)
That may change the width/height of the image, so you don't want to divide getWidth/getHeight by 2 to get the center of the image, for instance.
Hmm, people would be using the padPowerTwo() function no matter what just to suit the computers with crappy drivers...
If this is really going to be the situation then I think we should just disable non-power of two images altogether if we don't pad the images for the programmer by default... otherwise we'd see stuff like....
Code: Select all
imgd = love.image.newImageData("evil.png")
imgd:padPowerTwo()
imgd1 = love.image.newImageData("evil1.png")
imgd1:padPowerTwo()
imgd2 = love.image.newImageData("evil2.png")
imgd2:padPowerTwo()
imgd3 = love.image.newImageData("evil3.png")
imgd3:padPowerTwo()
imgd4 = love.image.newImageData("evil4.png")
imgd4:padPowerTwo()
which could've been:
Code: Select all
imgd = love.image.newImageData("evil.png")
imgd1 = love.image.newImageData("evil1.png")
imgd2 = love.image.newImageData("evil2.png")
imgd3 = love.image.newImageData("evil3.png")
imgd4 = love.image.newImageData("evil4.png")
because everyone are too lazy to change their images and still want to accommodate crappy drivers. (Think about it... if we aren't lazy we wouldn't be using LÖVE...)
Re: 0.6.0 Update
Posted: Wed Sep 30, 2009 1:49 pm
by Sparx
I am using io.lines and io.open ..... it still works, but has a different working directory or something like that, I want it to have the working directory of the .love file beeing executed.... how do i get this path?
Re: 0.6.0 Update
Posted: Thu Oct 01, 2009 11:29 pm
by Sardtok
Are there still video cards that don't support non-power-of-two textures?
There are of course four different OpenGL extensions that allow non-power-of-two textures.
It doesn't make sense to let the LÖVE devs decide if the textures need to be power-of-two textures or not, though.
GL_ARB_TEXTURE_NON_POWER_OF_TWO - the standard extension for non-power-of-two-textures
GL_TEXTURE_RECTANGLE_EXT - (old version of?) nvidia extension for non-power-of-two support
GL_TEXTURE_RECTANGLE_NV - nvidia extension for non-power-of-two support
GL_TEXTURE_RECTANGLE_ARB - the same as the two above with some opengl shading language additions
So, you'd actually have to check for all four and if none of them are available, pad the textures. Isn't it easier to just always pad the texture?
Or did you do this to get pixel coordinates for textures instead of floating point coords (0.0-1.0)?
Re: 0.6.0 Update
Posted: Sat Oct 03, 2009 6:39 pm
by Boder
The default should probably be to automatically pad images loaded to power-of-2, with the ability to check the card for non-pow-2 extensions and globally disable the behavior of automatic padding.
Re: 0.6.0 Update
Posted: Sat Oct 03, 2009 6:46 pm
by bartbes
I wonder is there a downside to not making power-of-two sized images? Is there a loss in padding the images?