tags:

views:

367

answers:

4

Well, the title says it all...

glGenTextures(1, &textureid);

Assuming that the texture was created succesfully, could textureid be 0?

+4  A: 

The manual page for glGenTextures says see also glIsTexture; the latter will (according to that) always return GL_FALSE for a texture name of 0. So, 0 can't be a valid texture name.

Chris Boyle
A: 

Absolutely not.

Nikolai Ruhe
+2  A: 

From the OpenGL Spec 3.1: on page 157:

If a texture object is deleted, it as if all texture units which are bound to that texture object are rebound to texture object zero.

It seems to me that the zero named texture is a special one

Christoph
A: 

The correct way to do error checking in OpenGL is generally to call glGetError. You can then check for both of the error conditions listed in the description of glGenTextures. As also mentioned, you can call glIsTexture to check if a given texture is valid.

Eric
I know, but I'm stuck debugging code on an embedded device where it takes around an hour to build and burn the ROM, so anything I can figure out without having to actually change the code and run it is good. :)
Tal Pressman