CG and texture matrix

Hello,

I’m having a hard time understanding this in CG.
I had this line in GLSL,

 
 projCoord = gl_TextureMatrix[0] * realPos;

and converting it to CG, it should be something like this :

 
output.projCoord = mul( texture_matrix, realPos ) ;

My question is, how do i send my texture matrix from inside the C++ code, into the shader code ??
I was tryng something like this :

  
 float Tex_MAT[16];
 glActiveTextureARB(GL_TEXTURE0_ARB);
 glGetFloatv(GL_TEXTURE_MATRIX, Tex_MAT);
  cgGLSetStateMatrixParameter(shadow.texture_matrix,   CG_GL_TEXTURE_MATRIX,Tex_MAT);

But obvioulst, i can’t do this…,
Can anyone help ?

thanks,
Bruno

You are mixing two approaches.

First approach is to retrieve the matrix as array of floats using the glGetFloat and set the uniform from that array using the glGLSetMatrixParameter* call.

The second approach is use the
cgGLSetStateMatrixParameter(shadow.texture_matrix,CG_GL_TEXTURE_MATRIX,CG_GL_MATRIX_IDENTITY)
which will do the glGetFloat for you.