vivek vyas
10-10-2009, 06:05 AM
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
http://lh6.ggpht.com/_vCOTaIVJWLs/StCDnoibztI/AAAAAAAAADk/cKNqcWlIEiA/s800/stillworkingonit.jpg
and here is the code i made
sorry for unused bindings
!!ARBvp1.0\n\
ATTRIB vn = vertex.normal;\n\
ATTRIB vc = vertex.color;\n\
ATTRIB vp = vertex.position;\n\
\n\
PARAM mat[4] = {state.matrix.mvp};\n\
PARAM lD = state.light[0].diffuse;\n\
PARAM ld = state.light[0].position;\n\
PARAM ma = state.material.ambient;\n\
PARAM md = state.material.diffuse;\n\
PARAM ms = state.material.shininess;\n\
PARAM mS = state.material.specular;\n\
OUTPUT ov = result.position;\n\
\n\
TEMP s,sum;\n\
ADD sum,ma,md;\n\
ADD sum,sum,ms;\n\
ADD sum,sum,ma;\n\
ADD sum,sum,mS;\n\
DP3 s.x,sum,vn;\n\
DP3 s.y,sum,vn;\n\
DP3 s.z,sum,vn;\n\
DP3 s.w,sum,vn;\n\
LIT s,s;\n\
\
DP4 ov.x,vp,mat[0];\n\
DP4 ov.y,vp,mat[1];\n\
DP4 ov.z,vp,mat[2];\n\
DP4 ov.w,vp,mat[3];\n\
MUL result.color,s,vc;\n\
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
http://lh3.ggpht.com/_vCOTaIVJWLs/StCDnVel70I/AAAAAAAAADc/oz0hfq1pmDA/s800/accidentallight.jpg
http://lh4.ggpht.com/_vCOTaIVJWLs/StCDndYixAI/AAAAAAAAADg/vq41DyDBeQg/s800/here%20its%20right.jpg
and yes making depth buffer on code give undesired result like broke teapot,Cube,Sphere
thanks in advance
sorry for Grammar
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
http://lh6.ggpht.com/_vCOTaIVJWLs/StCDnoibztI/AAAAAAAAADk/cKNqcWlIEiA/s800/stillworkingonit.jpg
and here is the code i made
sorry for unused bindings
!!ARBvp1.0\n\
ATTRIB vn = vertex.normal;\n\
ATTRIB vc = vertex.color;\n\
ATTRIB vp = vertex.position;\n\
\n\
PARAM mat[4] = {state.matrix.mvp};\n\
PARAM lD = state.light[0].diffuse;\n\
PARAM ld = state.light[0].position;\n\
PARAM ma = state.material.ambient;\n\
PARAM md = state.material.diffuse;\n\
PARAM ms = state.material.shininess;\n\
PARAM mS = state.material.specular;\n\
OUTPUT ov = result.position;\n\
\n\
TEMP s,sum;\n\
ADD sum,ma,md;\n\
ADD sum,sum,ms;\n\
ADD sum,sum,ma;\n\
ADD sum,sum,mS;\n\
DP3 s.x,sum,vn;\n\
DP3 s.y,sum,vn;\n\
DP3 s.z,sum,vn;\n\
DP3 s.w,sum,vn;\n\
LIT s,s;\n\
\
DP4 ov.x,vp,mat[0];\n\
DP4 ov.y,vp,mat[1];\n\
DP4 ov.z,vp,mat[2];\n\
DP4 ov.w,vp,mat[3];\n\
MUL result.color,s,vc;\n\
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
http://lh3.ggpht.com/_vCOTaIVJWLs/StCDnVel70I/AAAAAAAAADc/oz0hfq1pmDA/s800/accidentallight.jpg
http://lh4.ggpht.com/_vCOTaIVJWLs/StCDndYixAI/AAAAAAAAADg/vq41DyDBeQg/s800/here%20its%20right.jpg
and yes making depth buffer on code give undesired result like broke teapot,Cube,Sphere
thanks in advance
sorry for Grammar