glGenTextures problem

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

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.

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.

I might be silly… BUT

GLuint tex_id;
glGenTextures (1, &tex_id);

Well… it does sound silly, since I clearly stated i programmed my OpenGL prog in Delphi.
In delphi it goes as following:
var
tex_id: GLuint;
begin
glGenTextures (1,@tex_id);
end;

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

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.