[info-performer] Vertex attributes and GLSL shaders

Date view Thread view Subject view Author view

From: Jason Daly (jdaly++at++ist.ucf.edu)
Date: 01/10/2006 13:51:01


Hi all,

I can't seem to get vertex attributes (as with glBindAttribLocation) to
work with any of my GLSL programs. Uniforms work fine, but there seems
to be no API for vertex attributes. For example, in the shader, the
attribute would be declared as:

attribute vec4 weight;

and in regular OpenGL code, you make a call like this to bind a generic
vertex attribute array to the attribute variable in the shader:

glBindAttribLocation(program, "weight", 1);

Since there wasn't direct support, I tried to handle it myself with a
draw process callback attached to an appropriate pfGroup. It looks
something like this:

drawCallback(...)
{
    ...

    // Get userdata
    ...

    // Get the OpenGL handle from the pfShaderProgram
    programHandle = userdata->performerProgram->getGLHandle();

    // Check for attributes to bind and bind them
    for (i = 0; i < MAX_ATTRS; i++)
    {
        if (userdata->attr[i])
            glBindAttribLocationARB(programHandle, userdata->attr[i], i);
    }
}

Unfortunately, the getGLHandle() call always seems to come back as 0,
which causes a GL_INVALID_VALUE error when the call to
glBindAttribLocationARB is made. Not having access to vertex attributes
severely limits what can be done with GLSL programs. Is there something
I'm missing?

-- 

--"J"

"I'm a castaway stranded in a desolate land, I can see the footprints in the virtual sand." --Neil Peart


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Jan 10 2006 - 13:51:09 PST