I need to access the OpenGL state variables (such as the MVP matrices) in my Cg shader program. I’m passing these values to my Cg shader program manually using calls such as cgGLSetStateMatrixParameter() in my C/C++ code. Is there an easier way to do this?
I need to access the OpenGL state variables (such as the MVP matrices) in
Share
If you are on any fairly recent Cg profile (arbvp1 and later), your Cg shader programs can in fact access the OpenGL state (MVP matrices, material and light settings) directly. This makes writing those programs less painful.
Here are some of the state variables which can be accessed:
MVP matrices of all types:
Light and material properties:
For the full list of state variables, refer to the section Accessing OpenGL State, OpenGL ARB Vertex Program Profile (arbvp1) in the Cg Users Manual.
Note: