I notice in the cg arbvp1 profile there is a glstate.texgen[0].eye.s ( srtq ) variable. I’d assume that these TexGen calls fill the glstate variable…
glActiveTexture(GL_TEXTURE4);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, &mtexture_matrix[0]);
glEnable(GL_TEXTURE_GEN_S);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_T, GL_EYE_PLANE, &mtexture_matrix[4]);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_R, GL_EYE_PLANE, &mtexture_matrix[8]);
glEnable(GL_TEXTURE_GEN_R);
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_Q, GL_EYE_PLANE, &mtexture_matrix[12]);
glEnable(GL_TEXTURE_GEN_Q);
glBindTexture(GL_TEXTURE_2D, mShadowTexture);
If I pass in my own texture matrix to a cg program, then I’d assume these texgen calls would be irrelevant? In the previous example these calls would work on texture unit 4?
Also, I create fbo structure in my program. The program attaches a texture made with glTexImage2D. It also attaches a render depth buffer. I assume I cannot set the depth render buffer to a arbitrary texture unit in a cg fragement program? If I made a depth texture instead of a render buffer for depth, then I could use that depth texture in a texture unit in a cg program?
Trying to understand tex2Dproj in cg versus tex2D. So, tex2Dproj is going to divide x,y,z by the w value :
x/w y/w z/w 1 where 1 would be w/w = 1…
I assume that
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
is going to toggle the w result from tex2Dproj?
Thanks for any insights. Just attempting to do shadows again…I posted a few months ago about it…