Very strange Vertex Program error

Hi all;
I’m getting a very strange error here. I’m using 2 vertex programs to do bump mapping, one is
const unsigned char one[] =
{
“!!VSP1.0”

“DP4 c[30].x,v[0],c[12];
DP4 c[30].y,v[0],c[13];
DP4 c[30].z,v[0],c[14];
DP4 c[30].w,v[0],c[15];”

“END”
};
and the other is
const unsigned char bump[]=
{
“!!VP1.0”

“DP4 o[HPOS].x,v[0],c[4];
DP4 o[HPOS].y,v[0],c[5];
DP4 o[HPOS].z,v[0],c[6];
DP4 o[HPOS].w,v[0],c[7];”

“ADD R0,c[30],-v[0];”

“DP3 R3.x,R0,v[4];
DP3 R3.y,R0,v[5];
DP3 R3.z,R0,v[6];”

“MOV o[TEX1],R3;”

“MOV o[TEX0],v[1];”

“END”
};

If i use “!!VP1.0” in both, instead of
“!!VSP1.0”, i got an error in position 3 of the first program.If i use “!!VSP1.0” in both, i got an error in line 3 of the second program. I’m doing

glEnable(GL_VERTEX_PROGRAM_NV);
glGenProgramsNV(1, &program_1);
glLoadProgramNV(GL_VERTEX_STATE_PROGRAM_NV,state_p, strlen((char*) one),one);
GLint errorPos;
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV, &errorPos);
if (errorPos !=-1)
{
log_file.Write(“Error in shader”);
}
glGenProgramsNV(1, &bump_p);
glLoadProgramNV(GL_VERTEX_PROGRAM_NV, bump_p, strlen((char * ) bump), bump);
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_NV,&errorPos);
if (errorPos !=-1)
{
log_file.Write("Error in shader ");
}

What is going on?

You are getting those errors because the syntax for vertex state programs (!!VSP1.0) is different than regular vertex programs (!!VP1.0).

The first program is a valid vertex state program, but its not a valid vertex program because you write to constant memory.

The second program is a valid vertex program, but its not a valid vertex state program because you are writing to non constant memory.

You should take a look at the NV_vertex_program extension spec:
http://oss.sgi.com/projects/ogl-sample/registry/NV/vertex_program.txt

for more information.