The problem is : I can’t get it to work at all :\
ok, here it is :
First of all, I do enable 2d textures
glEnable(GL_TEXTURE_2D);
then I start a display list,
and I call
glTexEnvf(GL_TEXTURE_ENV,
GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexImage2D(GL_TEXTURE_2D, 0, 4, 256, 256,
0, GL_RGB, GL_UNSIGNED_CHAR, test);
test is defined as follow :
unsigned char test[2562563];
and does contain correct texture data loaded from a file (I’ve verified and it’s all fine)
the file contains 8-bit RGB data, stored in text-mode hexadecimal, but I convert it to Byte format, and I’ve verified that it works correctly.
then, I do
glBegin(GL_QUADS);
glTexCoord2f(0.0,0.0);
glVertex3f(1,0,0);
glTexCoord2f(1.0,0.0);
glVertex3f(0,0,0);
glTexCoord2f(1.0,1.0);
glVertex3f(0,0,-1);
glTexCoord2f(0.0,1.0);
glVertex3f(1,0,-1);
glEnd();
Results : The square shows fine, but there’s no texture on it.
I’ve tried querying gluGetError before every call to a texture-related function but each time it returned “no error”.
I don’t know what I’m doing wrong.
Texturing everywhere else works fine (in games or apps, but not in my code), so it’s unlikely to be a machine problem.
I don’t use texture binding 'cause I use display lists. I’m working on a 3d geometry file loader that’ll return the display list number. Everything works fine except for texture loading.
(File format : XGL)