View Full Version : NPOT with GL_ARB_texture_npot

02-01-2007, 09:23 AM
Hi there, :)

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?

02-01-2007, 09:52 AM
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.

02-01-2007, 10:28 AM
I read that.. didn't understand anything. :( sorry

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

02-01-2007, 01:33 PM
Try this one; (I added little notes on the heading of main.cpp)
textureNPOT.zip (http://songho.ca/opengl/files/textureNPOT.zip)

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.

02-01-2007, 05:35 PM
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.

02-02-2007, 02:23 AM
I got it know. I was thinking that GL_ARB_texture_non_power_of_two was a texture target. :p Silly me.

Thank you all for helping. ;)