VP Projective texture problem

Hello guys,

I try implement projective texgen (for spot lighting) with ARB vertex program and i have some problems.
I can’t set perspective to texgen.

There is my prog :

“!!ARBvp1.0”

“OPTION ARB_position_invariant;”

“PARAM matrix[4] = { state.matrix.program[0] };”

“ATTRIB iPos = vertex.position;”
“ATTRIB iCol = vertex.color;”

“OUTPUT oCol = result.color;”
“OUTPUT oTex = result.texcoord[0];”

“MOV oCol, iCol;”

“DP4 oTex.x, matrix[0], iPos;
DP4 oTex.y, matrix[1], iPos;
DP4 oTex.z, matrix[2], iPos;
DP4 oTex.w, matrix[3], iPos;”

“END”;

in code i load matrix:

glMatrixMode(GL_MATRIX0_ARB);
glLoadIdentity();
glTranslatef(0.5f,0.5f,0.5f);
glScalef(0.5f,0.5f,0.5f);
glLoadMatrixd(MyMatrix);

work fine but without FOV , zNear, ZFar and bias. How do i set this?

Thanks
Vasbin

take a look at the nvidia developer website. there are lot of examples, tutorials & presentation about how to do showmapping and how to setup the matrices (or download the sdk). The ATI-Developer website offers also some uesefull demos about shdowmapping.

I saw their all, but i can’t find projective texturing via vertex program.

This code work well for me, but i not have projection transformations (FOV, Znear, ZFar).

Anyone can help me?