Texture Problem?

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?

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.

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?

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.

I use gluBuildMipmaps(), it’s work, but some bmp image become gray or damaged.
I don’t know way that happen?