View Full Version : glGenTextures gives back a zero

08-10-2000, 08:20 AM
What would cause glGenTextures to fail besides being inside a glBegin/glEnd block?

I'm using code from the NeHe tutorials but can't get texturing to work. I believe the problem may have something to do with glGenTextures, because it returns zero as the "name" (as the redbook refers to it) of the texture and this apparently signals failure. I've gone so far as to remove all drawing from the program so there aren't even any glBegin/glEnd blocks, but this doesn't change the behavior of the function.

On a frustrating aside, I was going to use glGetError to attempt to plumb the nature of the problem right after the suspicious call. So I put a loop above the call to glGenTextures that loops while the error returned is not GL_NO_ERROR in an attempt to clear flags (as I've read you need to do), but this just loops indefinitely. Don't know what I'm doing wrong there...

Any help is appreciated.

08-10-2000, 11:57 AM
Dunno what the problem is. Just use any old numbers. The gen textures just generates unique id's to stop you clobbering someone elses handles in say a library you've linked to which also makes OpenGL texture calls it isn't compulsory, especially if you've written all the code, you can just pic your own integer handles for the bind calls.

In other words, the ONLY use for the gen textures call is to avoid reusing a handle already in use, it does NOTHING else. glBindTexture will work just fine if you pick your own values.