Frax A
11-07-2009, 01:30 PM
Hi Everyone!
I'm having problems resetting the texture state on one of my texture units in
an OpenGL application I'm writing with OpenGL 2.1 on Linux.
I'm rendering my geometry into a shadow map bound to texture unit 0 (out of 4
available texture units on my machine). Later I use the texture (still bound
to texture unit 0) to render shadows to my scene.
At the end of each frame I want to draw some HUD elements to the screen using
the same texture unit. But the HUD quad with the texture applied is drawn like
a single color quad whos color seems to depend on which way the camera is
pointed.
I suspected that the problem was that I had texture coordinate generation
active for the current texture unit. But, even if I disable texture coordinate
generation in the HUD drawing function, the result is still exactly the same
as before.
glActiveTexture( GL_TEXTURE0);
glBindTexture( GL_TEXTURE0, iHudTexture);
glDisable( GL_TEXTURE_GEN_S);
glDisable( GL_TEXTURE_GEN_T);
glDisable( GL_TEXTURE_GEN_R);
glDisable( GL_TEXTURE_GEN_Q);
I'm starting to run out of ideas about this thing, I hope someone can point me
in the right direction.
Thanks in advance
Fredrik
I'm having problems resetting the texture state on one of my texture units in
an OpenGL application I'm writing with OpenGL 2.1 on Linux.
I'm rendering my geometry into a shadow map bound to texture unit 0 (out of 4
available texture units on my machine). Later I use the texture (still bound
to texture unit 0) to render shadows to my scene.
At the end of each frame I want to draw some HUD elements to the screen using
the same texture unit. But the HUD quad with the texture applied is drawn like
a single color quad whos color seems to depend on which way the camera is
pointed.
I suspected that the problem was that I had texture coordinate generation
active for the current texture unit. But, even if I disable texture coordinate
generation in the HUD drawing function, the result is still exactly the same
as before.
glActiveTexture( GL_TEXTURE0);
glBindTexture( GL_TEXTURE0, iHudTexture);
glDisable( GL_TEXTURE_GEN_S);
glDisable( GL_TEXTURE_GEN_T);
glDisable( GL_TEXTURE_GEN_R);
glDisable( GL_TEXTURE_GEN_Q);
I'm starting to run out of ideas about this thing, I hope someone can point me
in the right direction.
Thanks in advance
Fredrik