Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

filisoft

Vertex Shader

This topic is 5421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!