another cg question

Started by
3 comments, last by hello_there 19 years, 10 months ago
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?
Advertisement
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.


Ahh thanks. that was confusing me.
____________________________________________________________How could hell be worse?
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?
Yes


This topic is closed to new replies.

Advertisement