If you use some fairly recent Cg profile (arbvp1 and later), your Cg shader programs can actually access the OpenGL state (MVP matrices, material and light parameters) directly. This makes recording these programs less painful.
Here are some of the state variables that can be accessed:
MVP matrices of all types:
state.matrix.mvp
state.matrix.inverse.mvp
state.matrix.modelview
state.matrix.inverse.modelview
state.matrix.modelview.invtrans
state.matrix.projection
state.matrix.inverse.projection
:
state.material.ambient
state.material.diffuse
state.material.specular
state.light[0].ambient
. OpenGL, OpenGL ARB Vertex (arbvp1) Cg.
:
- OpenGL Cg.
- . (: 1 state.light [1].ambient)
- Cg. glLight().