Texture name generation.

Hello all, I am programming some texture stuffs, in which a problem occurs:

GLuint text;

why the above lines can not generate the correct texture name? It always returned without changing the value of text. By the way, the lines are not within glBegin and glEnd. Thank you so much.

Do you have a valid rendering context. Only thing I can think of that might be the problem. If you do have a valid rendering context, put the following lines after glGenTextures

GLenum err = glGetError();
if (err)
GLubyte errstr = gluErrorString(err);
printf((const char

For printf you will need a console window, otherwise if using Windows use MessageBox or use your debugger. If it does not error then I dunno… what value are you getting that does not change?

Yes, you are right, only when I have a valid rendering context and use wglMakeCurrent to make it the current rendering context can the glGenTextures() take effect.