Vertex Shader

Started by
1 comment, last by filisoft 20 years, 2 months ago
Yesterday I bought a GeForceFX 5200 so the first thing I''ve done (after testing with Quake3, Aquamark 3, etc... for a few hours) was to see how to program the shaders. So I spent all day searching for a complete tutorial, but I was unable to find one. So I started reading a little bit here, a little there until I got the idea. So today I started working on a little program. But, as expected, it didn''t work. What can I do? You''ll find the source here : http://www.filisoft.as.ro/test1.zip I''m using GLUT so that I won''t bother with initialisation. BTW: does annybody know a site where I could find some shader examples with some explaining? Ok, that''s it. P.S. I know that in OpenGL it''s program, not shader, but shader is shorter to write
Have FUN,FeeL E!
Advertisement
I finally got it! I thought that, just like normal ASM, the shaders are case in-sensitive. Nope. Also, they need a column (or semi-column, I don''t know wich is ":" and wich is ";" Anyways, it needed ";" ). Here is the source for it:

#----------------------------------------------
!!ARBvp1.0

ATTRIB oldPos = vertex.position;
ATTRIB oldCol = vertex.color;

OUTPUT newPos = result.position;
OUTPUT newCol = result.color;

PARAM ModelViewProj[4] = { state.matrix.mvp };
TEMP temp;

DP4 temp.x, ModelViewProj[0], oldPos;
DP4 temp.y, ModelViewProj[1], oldPos;
DP4 temp.z, ModelViewProj[2], oldPos;
DP4 temp.w, ModelViewProj[3], oldPos;

MOV newPos, temp;

MOV newCol, oldCol;

END
#-------------------------------------------------

Bleah! I have to do my light computations by hand... Who said shaders are easy? I''ll shoot''em.

Have FUN,
FeeL E!
Have FUN,FeeL E!
quote:Original post by filisoft
!!ARBvp1.0

ATTRIB oldPos = vertex.position;
ATTRIB oldCol = vertex.color;

OUTPUT newPos = result.position;
OUTPUT newCol = result.color;

PARAM ModelViewProj[4] = { state.matrix.mvp };
TEMP temp;

DP4 temp.x, ModelViewProj[0], oldPos;
DP4 temp.y, ModelViewProj[1], oldPos;
DP4 temp.z, ModelViewProj[2], oldPos;
DP4 temp.w, ModelViewProj[3], oldPos;

MOV newPos, temp;

MOV newCol, oldCol;

END


or shorter:

!!ARBvp1.0
OPTION ARB_position_invariant;
MOV result.color, vertex.color;
END

and for lighting i think LIT might be worth a look.
f@dzhttp://festini.device-zero.de

This topic is closed to new replies.

Advertisement