Here’s the code from liquad example in NV OpenGL SDK.
Is C[12]…c[15] arrays of 4 elements each?
and why does it contain the inverse modelview
matrix? It’s automatically generated or what?
Why a VSP file and a VP file? How about straight opengl code (an example code that doesn’t use nvparse would be nice to see)?
Right now, I know what each instruction does but that’s all.
V-man
!!VSP1.0
Transforms the directional L vector from camera to object space.
Computes an H vector in object space.
Pre:
c[12]…c[15] contains the inverse modelview matrix.
v[0] contains the eye space light vector
c[8] contains the eye space view vector
Post:
c[12]…c[15] contains the inverse modelview matrix.
VSP stands for vertex state programs and they differ from ordinary vertex programs
because they work outside glBegin/glEnd commands and you execute then by calling
glExecuteProgramNV. As name says they modify vertex state.
Those c[0]…c[95] are 96 constant registers and you can write values in those like this,
and GL_MODELVIEW matrix will be stored in VP like this
c[0].x c[0].y c[0].z c[0].w
c[1].x c[1].y c[1].z c[1].w
c[2].x c[2].y c[2].z c[2].w
c[3].x c[3].y c[3].z c[3].w .
Second parameters in those function calls are indexes of constant registers.
You specify vertices and texture coordinates in your code as you like and information about vertex is stored in 15 vertex attribute registers,
register v[0] or v[OPOS] stores info about vertex position.
glVertex3f(1,1,1) gives you v[OPOS].x=1, v[OPOS].y=1, v[OPOS].z=1.
Look in specs for other attribute registers mnemonics.
Maybe someone with more experience in this subject can give more details.
Sorry, there are 16 vertex attribute registers 0…15, and 16 output or result registers o[COL0],o[OPOS],o[HPOS]… so on. There are temporary registers (R0,R1…) but I cant remember how many. You specify vertex programs just like textures