another cg question
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement