PDA

View Full Version : ARB program parameters



iykxcy
10-20-2009, 08:53 PM
I have a set of HLSL shaders that I'm attempting to use in my OpenGL renderer and through Cg, I'm able to convert them to ARB programs and load them directly into OpenGL. That seems to be working quite well except when it comes to the program parameters. The output of the Cg compilations show all of my uniform parameters as program.local's, though for the vertex programs, calls to glProgramLocalParameter4*() do nothing, but if I change them to glProgramEnvParameter4*(), the data is set correctly. However, in the fragment programs, neither call works. This is my first attempt with ARB programs, so I feel like I'm missing something. Could anyone shed some light on this?

Here's the basic flow of my code:


// - Enable the V.P.
glEnable(GL_VERTEX_PROGRAM_ARB);
glBindProgram(GL_VERTEX_PROGRAM_ARB, uID_VP);

// - Set parameters for the V.P.
//glProgramLocalParamter4fv(GL_VERTEX_PROGRAM_ARB, uIndex_VP0, (const GLfloat*) pData_VP0);
glProgramEnvParameter4fv(GL_VERTEX_PROGRAM_ARB, uIndex_VP0, (const GLfloat*) pData_VP0);

// - Enable the F.P.
glEnable(GL_FRAGMENT_PROGRAM_ARB);
glBindProgram(GL_FRAGMENT_PROGRAM_ARB, uID_FP);

// - Set parameters for the F.P.
//glProgramLocalParameter4fv(GL_FRAGMENT_PROGRAM_ARB , uIndex_FP0, (const GLfloat*) pData_FP0);
//glProgramEnvParameter4fv(GL_FRAGMENT_PROGRAM_ARB, uIndex_FP0, (const GLfloat*) pData_FP0);

// ---------------
// - Draw Geometry
// ---------------

// - Disable the V.P. & F.P.
glDisable(GL_VERTEX_PROGRAM_ARB);
glDisable(GL_FRAGMENT_PROGRAM_ARB);