I am doing a very elementary OpenGL application under Windows, and am using MFC. I know, it’s a performance pig, but I’m just trying to get my head around the big picture of OpenGL.
However, whenever I call glGenTextures in the application, no texture number is generated. glGetError returns GL_INVALID_OPERATION. According to the documentation, this only can happen if glGenTextures is called between glBegin and glEnd.
I have checked exhaustively, including adding code at the earliest possible place in my code, and am certain that I am not calling glBegin before the glGenTextures call.
I’ve built some GLUT demos on my machine that use texture objects and traced through them, and they all perform as expected. Has anyone seen anything like this, or can anyone help a flustered newbie with this?
When you call glGenTextures have you created a resource context and set it up as the current context? I am fairly sure that no GL functions will work till you have done that
Well, I feel sheepish. Yes, I was trying to call the function outside of a valid render context. Things are working much better now the performance gain is pretty staggering too.