PDA

View Full Version : Need an example.



xanatose
01-29-2004, 02:30 PM
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?

xanatose
01-29-2004, 06:35 PM
I figure it out.

I should have use

ADD t.y,t,c10;