I’ve already written some vertex programs but only with NV_vertex_program and i would try to code with the ARB_vertex_program after reading the nvopenglspec.pdf !
I tried to code a very simple program which was supposed to calculate diffuse lighting with only N dot L in model space and eye space by using the state.matrix.modelview but without success !
I’ve passed in “local param” or “env param” the light in model space and the illumination works well ! So my problem is the state.matrix.modelview.inverse which doesnt seem to do HER job !!!
here the vertex program :
!!ARBvp1.0
ATTRIB iPos = vertex.position;
ATTRIB iNrml = vertex.normal;
PARAM mvp[4] = { state.matrix.mvp };
PARAM inv_mv[4] = { state.matrix.modelview.inverse };
PARAM eLight = program.local[0]; # eye space light
TEMP mLight;
OUTPUT oPos = result.position;
OUTPUT oCol = result.color;
DP4 oPos.x, mvp[0], iPos;
DP4 oPos.y, mvp[1], iPos;
DP4 oPos.z, mvp[2], iPos;
DP4 oPos.w, mvp[3], iPos;
light in model space
DP3 mLight.x, inv_mv[0], eLight;
DP3 mLight.y, inv_mv[1], eLight;
DP3 mLight.z, inv_mv[2], eLight;
vector L = l - vertex
SUB mLight, mLight, iPos;
DP3 mLight.w, mLight, mLight;
RSQ mLight.w, mLight.w;
MUL mLight.xyz, mLight.w, mLight;
DP3 oCol, mLight, iNrml;
END
Please help me, i want to sleep !
[This message has been edited by ze.destroy (edited 02-11-2003).]