0.6.0 Update

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: 0.6.0 Update

Post by Jasoco »

What's a Power of 2 image?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: 0.6.0 Update

Post by bartbes »

Image with it's width and height being a power of 2.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: 0.6.0 Update

Post by Jasoco »

That doesn't explain what a power of 2 is. I failed Algebra, talk to me like I am in preschool.
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: 0.6.0 Update

Post 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
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: 0.6.0 Update

Post 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...)
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: 0.6.0 Update

Post 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?
User avatar
Sardtok
Party member
Posts: 108
Joined: Thu Feb 21, 2008 2:37 pm
Location: Norway/Norge/諾威/挪威 (Yes, I'm teh back!)
Contact:

Re: 0.6.0 Update

Post 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)?
User avatar
Boder
Prole
Posts: 7
Joined: Thu Aug 27, 2009 5:47 pm

Re: 0.6.0 Update

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: 0.6.0 Update

Post by bartbes »

I wonder is there a downside to not making power-of-two sized images? Is there a loss in padding the images?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests