Advertisement Jump to content


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


another cg question

This topic is 5344 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

I have this cg programe struct Output { float4 position : POSITION; float4 color : COLOR; }; Output main(float3 position : POSITION) { Output OUT; OUT.position = float4(position, 1); OUT.color = float4(1,1,1,1); return OUT; } Now that does realy do anything interesting but i was wondering in my application that uses that program when i call CGparameter Pos = cgGetNamedParameter(program,"position"); cgGLSetParameter4fv(Pos,?); what should i set it to? Do i set it only once or do i have to set it for each vertex? Also since the position will be in object space do i have to transform it into clip space in the cg programe?

Share this post

Link to post
Share on other sites
position is not uniform so u can not set it by cgGLSetParameter4fv. It is set by glVertex.
With cgGLSetParameter you can set only uniform, and it is constant for whole primitive.
If the position is in object space, yes u have to transform it.

Share this post

Link to post
Share on other sites
one more question say in the entry function i put

out float4 outposition : POSITION

does that mean that outposition is the output POSITION semantic.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!