View Full Version : glGenTextures problem

11-03-2001, 02:14 AM
One day, I have sat down near my comp, and started writing some opengl code that uses texture mapping. Everything in the code seemed to work fine, but it didn't display the textures. I played with the debugger a bit, and discovered that glGenTextures doesn't generate texture names. I am using Borland Delphi6. I tried a LOT of different opengl units i have found on the net, and all of them give the same result.

hope you can help me http://www.opengl.org/discussion_boards/ubb/smile.gif

11-04-2001, 01:10 AM
Have you enabled texturing with glEnable(GL_TEXTURE_2D) ? Also if you are just starting out then http://nehe.gamedev.net would be best place to start. As for your texturing problem try looking at Texture mapping tutorial at http://nehe.gamedev.net/opengl2.asp

NeHe has quite a good base framework to start playing with.

11-04-2001, 10:11 AM
I have already read those tutorials before beginning programming something with texture mapping. And YES, i have enabled 2d texturing with glEnable (GL_TEXTURE_2D).

I just don't know what the heck is the problem.

11-05-2001, 02:36 AM
I might be silly... BUT

GLuint tex_id;
glGenTextures (1, &tex_id);

11-05-2001, 10:37 AM
Well... it does sound silly, since I clearly stated i programmed my OpenGL prog in Delphi.
In delphi it goes as following:
tex_id: GLuint;
glGenTextures (1,@tex_id);

and it doesn't generate texture names. i checked it with a debugger.

11-06-2001, 01:19 AM
Do you ask for a texture name before or after you create the rendering context? It should be after.

If you do call it after you have created a rendering context, you can set a texture id yourself. You don't have to call glGenTextures, so you can assign tex_id any number you like, apart from 0 which is a default "no-texture" in OpenGL.