i am working on vertex program
i created a program which atleast work but i can’t understand it
as i make by hard work to just see the light but no concepts in my mind
here is the image
and here is the code i made
sorry for unused bindings
!!ARBvp1.0
\
ATTRIB vn = vertex.normal;
\
ATTRIB vc = vertex.color;
\
ATTRIB vp = vertex.position;
\
\
PARAM mat[4] = {state.matrix.mvp};
\
PARAM lD = state.light[0].diffuse;
\
PARAM ld = state.light[0].position;
\
PARAM ma = state.material.ambient;
\
PARAM md = state.material.diffuse;
\
PARAM ms = state.material.shininess;
\
PARAM mS = state.material.specular;
\
OUTPUT ov = result.position;
\
\
TEMP s,sum;
\
ADD sum,ma,md;
\
ADD sum,sum,ms;
\
ADD sum,sum,ma;
\
ADD sum,sum,mS;
\
DP3 s.x,sum,vn;
\
DP3 s.y,sum,vn;
\
DP3 s.z,sum,vn;
\
DP3 s.w,sum,vn;
\
LIT s,s;
\
\
DP4 ov.x,vp,mat[0];
\
DP4 ov.y,vp,mat[1];
\
DP4 ov.z,vp,mat[2];
\
DP4 ov.w,vp,mat[3];
\
MUL result.color,s,vc;
\
END
i understands few thing like
vertex.color related to glColor3f();
but NO CONCEPTS how this light goes
and even don’t independently can say that it is light or not
as it can be controlled by glColor3f();
and also i want to use fog,texturemapping related things with
ARB_vertex_program
and here is some more pic so u know that i don’t know how light works
as there some problem with normals
don’t know why white spot comes but removed after CULL_FACE
and yes making depth buffer on code give undesired result like broke teapot,Cube,Sphere
thanks in advance
sorry for Grammar