Need an example

Hello Im trying to do a shader that moves the y position of a vertex depending on a variable. Im new to shader programming.

I already know how to create and bind a vertex program.

First Im passing the variable to the vertex enviroment as this:

glProgramEnvParameter4fARB(
GL_VERTEX_PROGRAM_ARB,
10, 0.0f, 0.5, 0.0f);

No problem there

But the shader:

!!ARBvp1.0
ATTRIB iPos = vertex.position;
ATTRIB iColor = vertex.color;
TEMP t;
PARAM mvp[4] = { state.matrix.mvp };
PARAM c10 = program.env[10];
OUTPUT oPos = result.position;
OUTPUT oColor = result.color;
MOV t,iPos;
ADD t.y,c10;
DP4 oPos.x, mvp[0], t;
DP4 oPos.y, mvp[1], t;
DP4 oPos.z, mvp[2], t;
DP4 oPos.w, mvp[3], t;
MOV oColor, iColor;
END

Does not compile and failes on line:
ADD t.y,c10;

Can anyone tell me what im doing wrong?

I figure it out.

I should have use

ADD t.y,t,c10;

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.