sansan
04-03-2003, 01:33 AM
I'm trying to draw a textured quadrangle - quite a trivial task itself. But I'm doing it within a large visualization library that behaves quite "texture-unfriendly": I'm constantly getting a black quadrangle instead of a textured one.
I use the code below (really standard one):
...
glGenTextures(1, &texname);
glBindTexture(GL_TEXTURE_2D, texname);
makeTexture(); // here pixel colors are calculated
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height,
0, GL_RGB, GL_UNSIGNED_BYTE,
&image[0][0][0]); //
glEnable(GL_TEXTURE_2D);
...
glBindTexture(GL_TEXTURE_2D, texname);
drawPolygon(); // glTexCoord2 is used here in conjunction with glVertex
It looks like that large library sets some OpenGL parameters that prevent textures from being displayed.
Does anybody have an idea what the problem is and how it can be solved?
Thanks in advance!
I use the code below (really standard one):
...
glGenTextures(1, &texname);
glBindTexture(GL_TEXTURE_2D, texname);
makeTexture(); // here pixel colors are calculated
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
GL_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height,
0, GL_RGB, GL_UNSIGNED_BYTE,
&image[0][0][0]); //
glEnable(GL_TEXTURE_2D);
...
glBindTexture(GL_TEXTURE_2D, texname);
drawPolygon(); // glTexCoord2 is used here in conjunction with glVertex
It looks like that large library sets some OpenGL parameters that prevent textures from being displayed.
Does anybody have an idea what the problem is and how it can be solved?
Thanks in advance!