Archived

This topic is now archived and is closed to further replies.

glGenTextures not working

This topic is 5541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing some texture loading code and for some reason glGenTextures is not working. THe code is this ... GLuint m_uiTexID; ... m_uiTexID = 0; ... glGenTextures(1, &m_uiTexID); ... m_uiTexID still has value 0. I checked it through the debugger and just before the call, m_uiTexID is 0 and immediately after it is still 0. I have seen what looks like the same code on NEHE and it works fine. Why won''t it give me the unused texture ID. I''m positive that I''m not using them all. What could be wrong?

Share this post


Link to post
Share on other sites
glGetError returns 1282 which is GL_INVALID_OPERATION, which according to documentation means glGenTextures was called between glBegin and glEnd. This is ludicrous. at this point in the code these two functions have yet to be called. As to is OpenGL "intialized", what do you mean?

Share this post


Link to post
Share on other sites
Well, you have to set up the OpenGL context before you
can call any OpenGL functions. For instance, if you
use GLUT, you''d call glutInit() and glutCreateWindow()...etc.
If you use Win32, you''d call wglCreateContext()...etc.



Kami no Itte ga ore ni zettai naru!

Share this post


Link to post
Share on other sites
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I had the intializeation and loading of textures before the window making code.

The glGenTextures wasn''t the only problem by the way, all my OGL code was screwed up.

Share this post


Link to post
Share on other sites