glLoadProgramNV

i get an GL_INVALID_OPERTION after calling glLoadProgramNV. i dont know why, and i read the specs and did not understand the reason. i also couldnt find code that use this function, becuase every one uses nvparse which causes me so much trouble with its “unresolved externals” that i gave up trying to use it, at least for now.
so here is my code -

glGenProgramsNV(1, &vpID);
glBindProgramNV(GL_VERTEX_PROGRAM_NV, pID );
GetError();
//nvparse(Prog);<-uncomenting it cause many errors.
glLoadProgramNV(GL_VERTEX_PROGRAM_NV,vpID, strlen(Prog),(unsigned char*)"!!vp1.0
"
"DP4 o[HPOS].x, c[0], v[OPOS];
"
"DP4 o[HPOS].y, c[1], v[OPOS];
"
"DP4 o[HPOS].z, c[2], v[OPOS];
"
"DP4 o[HPOS].w, c[3], v[OPOS];
"
"MOV o[COL0], c[5];
"
"MOV o[TEX0], v[TEX0];
"
"END
");
GetError();

can you see whats wrong?

The language is case sensitive, so try changing !!vp1.0 to !!VP1.0

Try using an actual variable for it instead, like so…

GLubyte vp1[]={"!!VP1.0"
“DP4 o[HPOS].x, c[0], v[0];”
“DP4 o[HPOS].y, c[1], v[0];”
“DP4 o[HPOS].z, c[2], v[0];”
“DP4 o[HPOS].w, c[3], v[0];”
“MOV o[COL0], v[3];”
“MOV o[TEX0], v[8];”
“END”};

glLoadProgramNV(GL_VERTEX_PROGRAM_NV,vpID,srlen((char*)vp1),vp1);

I suspect that your “(unsigned char*)”!!vp1.0
“” is stopping with that because your entire program isn’t enclosed within brackets.

I did this but by putting the whole code inside a single string (" "). You dont need to specifically allocate memory for it.

V-man

ok, i changed it to VP and it doenst do INVALID_OPERAION anymore, but i still get a black screen, i mean the quad is not drawn. how can i debug it, to see whats wrong?

ok, i changed it to VP and it doenst do INVALID_OPERAION anymore, but i still get a black screen, i mean the quad is not drawn. how can i debug it, to see whats wrong?

Do you track the martix (c[0]-c[3])?

Shlomi.

[This message has been edited by Quaternion (edited 05-23-2002).]

[This message has been edited by Quaternion (edited 05-23-2002).]

yes

Just to be sure…

You do have a valid color in c[5]? This is what you’re assigning to the vertex’s output color.

If you change this line:
"MOV o[COL0], c[5];
"

to this:
"MOV o[COL0], v[COL0];
"

do things start working?

As an aside, one other thing looks a little weird. You’re passing in “strlen(Prog)” as the length of your program string, and then you’re passing in a static string as the actual program. Are you sure this will work?

I think it will as long as “strlen(Prog)” is greater than the length of the static string, but I’m sure it won’t if it’s less than the length of the static string.

why should it be less? it is the length of the string. and i do init the c[5] register, and even if im not, i use texturing, so the vertex color doesnt matter, i just wanted to fool around.

problem solved. i tracked the wrong matrix