PDA

View Full Version : glLoadProgramNV



okapota
05-22-2002, 05:38 AM
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\n"
"DP4 o[HPOS].x, c[0], v[OPOS];\n"
"DP4 o[HPOS].y, c[1], v[OPOS];\n"
"DP4 o[HPOS].z, c[2], v[OPOS];\n"
"DP4 o[HPOS].w, c[3], v[OPOS];\n"
"MOV o[COL0], c[5];\n"
"MOV o[TEX0], v[TEX0];\n"
"END\n");
GetError();

can you see whats wrong?

PH
05-22-2002, 05:41 AM
The language is case sensitive, so try changing !!vp1.0 to !!VP1.0

Dan82181
05-22-2002, 06:56 AM
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((c har*)vp1),vp1);

I suspect that your "(unsigned char*)"!!vp1.0\n"" is stopping with that because your entire program isn't enclosed within brackets.

V-man
05-22-2002, 03:04 PM
I did this but by putting the whole code inside a single string (" "). You dont need to specifically allocate memory for it.

V-man

okapota
05-22-2002, 10:31 PM
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?

okapota
05-22-2002, 10:32 PM
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?

Quaternion
05-22-2002, 10:46 PM
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).]

okapota
05-22-2002, 11:59 PM
yes

secnuop
05-23-2002, 06:57 AM
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];\n"

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

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.

okapota
05-23-2002, 09:23 AM
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.

okapota
05-23-2002, 09:44 AM
problem solved. i tracked the wrong matrix http://www.opengl.org/discussion_boards/ubb/smile.gif