In my program, I enable TexGen in texture 0, if I disable texture 1, then everything is ok, but if I enable texture 1, then the generated texture coords of 0 are wrong, why does this happen?
Are you sure you’re enabling TexGen in the correct place, where Texture unit 0 is active. Post up the order of things you do, to determine if something is up there.
What hardware and driver versions are you using? Could you create a demo program, for other people to test, to see if it is your system at fault.
Need more info!!
well, here is the code. I am trying to implement a projective texture.
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, ep0);
glTexGenfv(GL_T, GL_EYE_PLANE, ep1);
glTexGenfv(GL_R, GL_EYE_PLANE, ep2);
glTexGenfv(GL_Q, GL_EYE_PLANE, ep3);
//set the texture matrix
glTranslatef(.5f, .5f, 0.f);
glScalef(.5f, .5f, 1.f);
glRotated(camera->GetAngleX(), 1.0, 0.0, 0.0);
glRotated(camera->GetAngleY(), 0.0, 1.0, 0.0);
glRotated(camera->GetAngleZ(), 0.0, 0.0, 1.0);
//draw a quad
at the 3rd line, if I change the function into glDisable(GL_TEXTURE2D), everything is ok.
but whenever I enabled texture 1, then texture0 fails to work. The generated texture coords are correct, but the perspective correction of the texture is wrong.
My card is TNT2 Pro
why the enabling/disabling of texture1 affects the perspective correction of texture0?
forgot to tell, if no rotation is applied to the texture matrix, then enable/disable texture1 produce the same result.
I’m not entirely certain, but I believe that I read in one of nvidia’s papers that TNT class hardware is incapable of doing the perspective divide for texgen on both texture units.
Yes, nvidia mentioned this somewhere on their developer site, but I couldnt find the document. However I did find the following in an article on gamasutra:
One potential pitfall with using projective textures on current consumer hardware is that multiple texture units might actually share the divider gates needed for the hyperbolic interpolator (i.e. the TNT can not do dual projective texturing, while the GeForce can).
Figures…as soon as I post, I find the actual reference from nvidia:
from page/slide 30:
NVIDIA’s Projective Texturing Story
Different generations differ
• TNT generation has a single shared hyperbolic interpolator
– independently projected dual textures do not work
– not enough gates for dual- projective in TNT timeframe
• GeForce generation has distinct q/ w hyperbolic interpolators
for both texture units (bigger gate budget buys correctness)
– dual projective textures works
• Not sure what other vendors do