PDA

View Full Version : Texture name generation.



lgc_ustc
05-12-2003, 11:36 AM
Hello all, I am programming some texture stuffs, in which a problem occurs:

GLuint text;
glGenTextures(1,&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.

shinpaughp
05-12-2003, 12:58 PM
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*)errstr);
}

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?

lgc_ustc
05-12-2003, 01:19 PM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif