   Cg, CgFX, and way too many redundant OGL calls
  I'm using Cg 1.5 Beta 2, and I've noticed some VERY strange behavior: It's making WAY too many pointless OGL API calls!  For example, this code:::cgGLSetStateMatrixParameter(param, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY);Gets translated to the following API calls:glGetDoublev(GL_MODELVIEW_MATRIX, 0x12F9F8)glGetDoublev(GL_PROJECTION_MATRIX, 0x12FAF8)glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, 0x12F894)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB, 1, -0.01, -0.75, 0.00, -130.46)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, 0x12F894)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB, 2, -0.02, 0.00, 1.00, 4.09)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, 0x12F894)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB, 3, 1.00, -0.01, 0.02, 309.10)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_BINDING_ARB, 0x12F894)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)glProgramLocalParameter4dARB(GL_VERTEX_PROGRAM_ARB, 4, 1.00, -0.01, 0.02, 311.04)glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0) (That output was created with gDEBugger)Now, why on earth is it behaving this way?  This kind of pointless redundancy is done for pretty much every cg API call, and is leading to my engine having over EIGHT THOUSAND API calls per frame, making me completly CPU bound.Anyone know what's up?EDIT: This would probably be more appropriate in the OpenGL forum, if a mod could move it I'd be greatful.   
  Moved upon request.love and huggles,   ;  I'm bumping this, hoping someone else has used Beta 2 and run into this problem... Anyone? :)   ;  The glGetDoublev(...) calls are used to get the current matrices. Once it's got them, it gets the program binding using the glGetProgramivARB(...) call, binds the program using glBindProgramARB(...), and sets the local parameters (1 to 4) with the values it gets from the matrices, which it then uses in the program. It does seem a little weird how it continually binds the program when setting the parameters, but it's the only way to ensure that that program is bound when it's trying to set something, rather than another one (which would be bad). If you think it's a little excessive, you could always use the Cg compiler to generate code for the ARB programs, but if you plan on using the shaders in Open GL and D3D, then you're going to have to play with the code a fair bit.   ;  No, I'm not going to accept that.Sure, I could see it doing it ONCE before setting the values, but why would it expect that the program become unbound BETWEEN calls?  That makes no sense at all.  Anyone else have any ideas?   ;  my suggestion would be to throw NV an email about this   