Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Need an example.

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    11

    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?

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    11

    Re: Need an example.

    I figure it out.

    I should have use

    ADD t.y,t,c10;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •