Slick Forums

TextureLoader - non-power-of-two images
Page 1 of 1

Author:  shadow [ Sat Feb 18, 2012 1:19 am ]
Post subject:  TextureLoader - non-power-of-two images


I'm running into the same problem as this guy here: ... -correctly

I try to load a non-power-of-two-size image with the Slick-Util TextureLoader.
I understand that OpenGL wants textures in the right size, but the TextureLoader does exactly put the image to this correct sizes, right?
Then why are these artefacts at the border of the texture rendered?

Maybe I could avoid this problem if I don't render the complete texture on a quad with size let's say 512x512 with texture coordinates (0,0), (0,1) and so on...
I could also render a quad with the exact image size i. e. 180x60 and use texture coordinates like (0,0), (0,0.4) or so... but the first alternative is much more comfortable...

Any ideas?

Thanks in advance and kind regards,

Author:  davedes [ Sat Feb 18, 2012 1:33 am ]
Post subject:  Re: TextureLoader - non-power-of-two images

Slick doesn't "fix" power of two sizes; it only ensures that the actual OpenGL texture will be power-of-two sizes. So the Texture object returned may have different results for getImageWidth (e.g. 500) and getTextureWidth (e.g. 512). You can find out the ratio (i.e. for texcoords, 0.9765) using Texture.getWidth.

More details:

Author:  shadow [ Sat Feb 18, 2012 12:03 pm ]
Post subject:  Re: TextureLoader - non-power-of-two images

It's clear now, thank you!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group