Original Post
I am currently trying to use the vertex program from the Cg Toolkit it looks something like this: In another file its loaded and enabled: But I don't understand how the struct "vertex_input" to the vertex program is passed. In the main program in the vertex program the parameter IN should be passed from somewhere right?
struct vertex_input
{
float4 position : POSITION;
float4 normal : NORMAL;
};
struct vertex_output
{
// Homogeneous 'clip-space' coordinates.
float4 position : POSITION;
float4 color : COLOR;
};
vertex_output main(
vertex_input IN
, uniform float4x4 ModelViewProj ///< Concatenation of the modelview and projection matrices
, uniform float4x4 ModelViewIT ///< The inverse transpose of the modelview matrix.
, uniform float4 light_vector ///< Specification of light location.
)
{
vertex_output OUT;
OUT.position = mul(ModelViewIT, IN.position);
...
...
m_vertex_program.load_from_file(vertex_program,demo_path + "vp_lighting.cg");
m_vertex_program.set_modelview_matrix();
m_vertex_program.set_modelview_projection_matrix();
m_vertex_program.set_modelview_inverse_transpose();
m_vertex_program.set_float_param("light_vec",light_vec_x,light_vec_y,light_vec_z);