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):
makeTexture(); // here pixel colors are calculated
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height,
0, GL_RGB, GL_UNSIGNED_BYTE,
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!
By the way, that code works pretty well in a small test application. Texture dimensions are powers of 2, naturally.
try to force textures by calling glEnable(GL_TEXTURE_2D); just before the glBind(). YOu never know, perhaps the app disable it by simply calling glDisable(GL_TEXTURE_2D);
I don’t see anything wrong with your ccode, if that’s reassuring.
you sure your texcoords() are set and at the right place?
also, make sure that you load the texture after performing openGL initialisation. It got me once as I loaded the textures in a static object, initialised before the opengl context was created.
[This message has been edited by oliii (edited 04-03-2003).]
Thanks for your suggestions! Unfortunately, I am likely to do right things (I triple-checked it just to make sure). But OpenGL still refuses to use my texture and displays a black quadrangle Moreover, I inserted glGetError() calls after each texture-related OpenGL call, and it always returns 0 (NO_ERROR).
you could try to email technical support for the visualisation library or something. Or find examples where the library was used and texture mapping worked.
Running out of ideas… TECHNICAL SUPPORT HELP ME!