PDA

View Full Version : Texture Problem?



ncn213
08-22-2009, 10:10 AM
Hi All,

I want to use non power of 2 bmp image as textures,
How can I implementt this with gl commands or glu commands?

Is it possible to implement this only with gl commands?

49er
08-22-2009, 12:28 PM
I don't think you need to do anything in particular to use non-power-of-two textures. If you mean texture rectangle, then you need to supply texture coordinates in the [0,w]x[0,h] range, not [0,1]^2, as would otherwise be the case.

ncn213
08-22-2009, 08:22 PM
Hi 49er,

When I want to use glTexImage2D() it's needed that width and height of Tex be power of to.

Can you give me an example code?

Ilian Dinev
08-22-2009, 11:34 PM
When I want to use glTexImage2D() it's needed that width and height of Tex be power of to.
That requirement is removed when your gpu has the NPOT extension. Only old Intel cards don't have that extension, but those are silly enough to not even support textures over 512x512, besides from randomly crashing.
You don't even need to change/write any extra code to handle NPOT textures via that extensions, it automatically works.
Just beware that gluBuildMipmaps() isn't aware of that improvement in GL, and squashes NPOT textures into POT ones, blurring them in the process.

ncn213
08-23-2009, 09:34 PM
Hi
I use gluBuildMipmaps(), it's work, but some bmp image become gray or damaged.
I don't know way that happen?