View Full Version : Problem with glBindTexture

Caran Elmoth
06-19-2003, 10:58 PM
I'm having a really strange problem with glBindTexture: when I try to bind a texture to load the actual data onto it, glBindTexture(GL_TEXTURE_2D, textureID) gives error 0x0500 (INVALID_ENUM) just like GL_TEXTURE_2D isn't a valid constant. The strangest thing is that if I call glBindTexture() two times (one after another) the second time the function doesn't give any error but the texture isn't displayed anyway. The texture data is loaded correctly because glDrawPixels draws it correctly. Very similar code by NeHe works fine. My system is: Win XP, Visual C++ 6.0 and a GeForceFX 5800.
Please Help!

Caran Elmoth
06-19-2003, 11:10 PM
Just for more info: i'm using MFC and when i call glBindTexture the rendering context is active. Thanks again for help.

06-20-2003, 12:49 AM
do you call glGenTextures ?
if so, test gl error after genrate the texture name:
if ((error=glGetError()) != GL_NO_ERROR)
print the string returned by glu

Caran Elmoth
06-20-2003, 01:06 AM
I call glGenTextures(1, texID), where texID is a GLint pointer. It also gives INVALID_ENUM error which has no sense as in the OpenGL manual it is not a contemplated error for glGenTextures... i'm going crazy with this!

06-20-2003, 01:37 AM
Check the rendering context. It must be valid at the point you start calling OpenGL functions.

Caran Elmoth
06-20-2003, 05:35 AM
Thanks to all. Problem resolved. Just have to set the texture filters for the textures I loaded.