Texturing problems

I have been coding OpenGl for 3 days now
my object renders but without the texture
my code looks like this

Setup routine

FList := glGenLists(1);
glGenTextures(1,@tn);
glNewList(FList, GL_COMPILE);
glEnable(GL_DEPTH_TEST);
glEnable(GL_TEXTURE_2D);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB8,128,128,0,GL_RGB,GL_UNSIGNED_BYTE,@bmp);
glFrontFace(GL_CCW);
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(0,0);
glVertex3f(0, -1, 0);
glTexCoord2f(0,1);
glVertex3f(-1, 0.5, 1);
glTexCoord2f(1,0);
glVertex3f(1, 0.5, 1);
glTexCoord2f(1,1);
glVertex3f(0, 0.5, -1);
glTexCoord2f(0,1);
glVertex3f(-1, 0.5, 1);
glEnd;
glEndList;

Render Routine
gluLookAt(0, 0, 6, 0, 0, -10, 0, 1, 0);
glRotatef(FAngle, rx, ry, rz);
glCallList(FList);

What do i need to add / change to get the texture on the object

Hi !

After glGenTextures() you must call glBindTexture() to select a texture to use.

Mikael

You must also think about the minification filter. The default minification filter in OpenGL is GL_LINEAR_MIPMAP_NEAREST (or maybe it was GL_NEAREST_MIPMAP_LINEAR), and this filtermore requires a full set of mipmaps. Either create this fill set of mipmaps, or set minification filter to GL_NEAREST/GL_LINEAR.

You might have to set wrapmodes aswell, but I dunno if this is required.

I have added ‘glBindTexture(GL_TEXTURE_2D,tn);’ after
glGenTextures(1,@tn);

it still makes no difference
model still comes up white

[b]I have added ‘glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);’ after ‘glBindTexture(GL_TEXTURE_2D,tn);’

it still makes no difference
model still comes up white[/b]