NPOT with GL_ARB_texture_npot

Hi there, :slight_smile:

I’m trying to load a “npot” bitmap into a GL_ARB_texture_non_power_of_two texture, but it’s not working. I’m confused about normalizing “glTexCoord2i” coordinates and some other stuff as you can see in the file below.

*MSV 2003 project

Do i have to “enable” this kind of texture and then bind it? Like:

glGenTextures(1, &g_texture1);
glBindTexture(GL_ARB_texture_non_power_of_two, g_texture1);

? Can somebody help me?

From the spec:
There is no additional procedural or enumerant api introduced by this
extension except that an implementation which exports the extension
string will allow an application to pass in texture dimensions for
the 1D, 2D, cube map, and 3D targets that may or may not be a power
of two.

I read that… didn’t understand anything. :frowning: sorry

Instead, could you show me some source-code or something on how should it be done?

Try this one; (I added little notes on the heading of main.cpp)

I think you don’t need any special coding for NPOT texture if your video card support NPOT textures. The driver will automatically work on the NPOT textures, so the code is exactly same as POT textures. You do not need any special token required, such as GL_TEXTURE_RECTANGLE_ARB for GL_ARB_texture_rectangle. Use GL_TEXTURE_2D as usual.

By the way, my Radeon card does not show GL_ARB_texture_non_power_of_two extension, but it still works with NPOT textures. I think if the version is 2.0 greater, then it would work.

I read that… didn’t understand anything.
What didn’t you understand?

It says that there are no changes to the API; only a change to the part of the spec that says that textures must be a power of two.

So if your card exposes this extension, it means that it will accept a texture whose dimensions are not a power of two.

There is nothing to turn on (“no additional procedural or enumerant api”). It just works as if OpenGL always supported NPOTs.

Your problem seems to be in using integer formats for your texture coordinates. You don’t need to; you can use the same texture coordinates you’ve always used.

I got it know. I was thinking that GL_ARB_texture_non_power_of_two was a texture target. :stuck_out_tongue: Silly me.

Thank you all for helping. :wink: