Skip to main content
gamedev.net
🔒 Locked

another cg question

Started by hello_there 3 replies 300+ views
Original Post
hello_there
hello_there
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?
____________How could hell be worse?
Cifko
Cifko
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.


hello_there
hello_there
Ahh thanks. that was confusing me.
____________How could hell be worse?
hello_there
hello_there
one more question say in the entry function i put

out float4 outposition : POSITION

does that mean that outposition is the output POSITION semantic.
____________How could hell be worse?
Cifko
Cifko
Yes


Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.