Archived

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

hello_there

cg question

Recommended Posts

hello_there    122
I''m learn how to make shaders and stuff in cg but i can''t figure out how it executes it. i have a vertex programe like this struct C2E1v_Output { float4 position : POSITION; float4 color : COLOR; }; C2E1v_Output C2E1v_green(float2 position : POSITION) { C2E1v_Output OUT; OUT.position = float4(position, 0, 1); OUT.color = float4(1, 0, 0, 1); // RGBA green return OUT; } and a fragment on like this struct C2E2f_Output { float4 color : COLOR; }; C2E2f_Output C2E2f_passthrough(float4 color : COLOR) { C2E2f_Output OUT; OUT.color = color; return OUT; } It doesn''t do anthing interesting but i was wondering how the vertex programe and fragment parts gets called and from where?. Does it do all the vertexs first then the fragment part or what? Also how do i specify what the entry function is and what the profile is? Also what compiler do i use because i downloaded the toolkit and it says it has a compiler but i never found one can you just compile them in visual studios? Sorry if any of those questions are stupid.

Share this post


Link to post
Share on other sites
vNistelrooy    140
Buy the book: The CG tutorial.
The vertex program executes for each vertex. Then the fragment program executes for each fragment (pixels, or samples with anti-aliasing) written to the frame buffer.



"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"

Share this post


Link to post
Share on other sites
hello_there    122
I should stop being so lazy and find it in the book myself.
Ahh that was stupid asking what compiler i use. since i have it on compile at runtime.

[edited by - hello_there on May 27, 2004 5:16:36 AM]

Share this post


Link to post
Share on other sites