View Full Version : arb vertex programs not working

09-25-2004, 02:27 AM
I cant compile this program:


PARAM mvp[4] = { state.matrix.mvp };
OUTPUT oPos = result.position;

DP4 oPos.x, mvp[0], vertex.position; # Compute position.
DP4 oPos.y, mvp[1], vertex.position;
DP4 oPos.z, mvp[2], vertex.position;
DP4 oPos.w, mvp[3], vertex.position;

MOV result.texcoord, vertex.texcoord;
MOV result.color, vertex.color;

ENDJust to see if the thing even works... but it won't pass with the following:

</font><blockquote><font size="1" face="Verdana, Arial">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">glEnable(GL_VERTEX_PROGRAM_ARB);
glGenProgramsARB(1, &ID);

File.GetSize(), File.GetBuffer());

if( !glIsProgramARB(ID)

09-25-2004, 03:38 AM
add this here instead of the !isProgramARB
it will give you the error.

err = (char*)glGetString(GL_PROGRAM_ERROR_STRING_ARB);
if (strcmp(err,"")!=0){
printf("ERROR gpuprog: %s (pos %d)\n", err,i);
}now to the program itself, you need to specify the vertex attribs before
and you also need to stick to what you define as output

so first you would define the attribs like

ATTRIB inPos = vertex.position;
ATTRIB inTex = vertex.texcoord;
ATTRIB inColor = vertex.color;

you also need to define all outputs

OUTPUT oPos = result.position;
OUTPUT oTex = result.texcoord;
OUTPUT oColor = result.color;

then in the code itself you will purely use the variables defined as attrib/param/output/temp/address

so instead of vertex.position you will use inPos
and instead of the result.texcoord / result.color
you use oTex and oColor
the variable names of course are up to you...

however you can not read from a output variable, and you cannot write to attrib or param.

hope that is somewhat correct

09-25-2004, 05:30 AM
Thanks CrazyButcher, it compiled now. Though I got an error with my basic fragment program:


ATTRIB iTexcoord = fragment.texcoord;
ATTRIB iColor = fragment.color;
OUTPUT oColor = result.color;
TEMP temp;

TEX temp, iTexcoord, texture[0], 2D;
MUL oColor, temp, iColor;

ENDIt gives: line 11: invalid character

09-25-2004, 05:55 AM
Ok I think it wasn't the shader, but i guess there shouldn't be a terminating \0 at the end.
Now it works.