PDA

View Full Version : ARB_vertex_program Invalid header error



gq3gq3
01-28-2010, 06:59 AM
Hey

I'm trying to convert my working GLSL shader system to oleder ASM based shader system, using ARB_vertex_program. But
"glProgramStringARB" throws me an error.
"line 1, column 1: Error: invalid vertex program header"

The code for setting up the vertex shader:
shadertext:string;
thevertprogram:Gluint;

glEnable(GL_VERTEX_PROGRAM_ARB);
glGenProgramsARB(1,@thevertprogram);
glBindProgramARB(GL_VERTEX_PROGRAM_ARB,thevertprog ram);
glProgramStringARB(GL_VERTEX_PROGRAM_ARB,GL_PROGRA M_FORMAT_ASCII_ARB,length(shadertext)-1,PChar(shadertext));

//Errorcheck
showmessage('Error ' + inttostr( glGeterror() ));
ErrorStr := glGetString(GL_PROGRAM_ERROR_STRING_ARB);
ShowMessage(ErrorStr);

My test vertex shader:
!!ARBvp1.0
ATTRIB pos = vertex.position;
PARAM mat[4] = { state.matrix.mvp };
# Transform by concatenation of the
# MODELVIEW and PROJECTION matrices.
DP4 result.position.x, mat[0], pos;
DP4 result.position.y, mat[1], pos;
DP4 result.position.z, mat[2], pos;
DP4 result.position.w, mat[3], pos;
# Pass the primary color through w/o lighting.
MOV result.color, vertex.color;
END

The error message complains about the header "!!ARBvp1.0", so the rest of the shader shouldn't even matter. As far as I know the header is correct. What might be the problem?

I would really appreciate any help





Just in case: I'm using opengl with SDL

gq3gq3
01-30-2010, 06:27 AM
Okay, problem solved, the header was offset by one space