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 6 of 6

Thread: Generic vertex attributes

  1. #1

    Generic vertex attributes

    Can anyone tell me how to access generic vertex attributes with the GLSL. The spec only mentions standard attributes.

  2. #2
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    29

    Re: Generic vertex attributes

    // Get the attribute index for the
    // monkey parameter
    monkeyAttrib = glGetAttribLocationARB(myVertexProgram, "monkey");

    glVertexAttribPointerARB(monkeyAttrib, 1, GL_FLOAT, GL_FALSE, 1234, monkeyData);
    http://www.3dlabs.com/support/develo...ocationARB.htm http://www.3dlabs.com/support/develo...PointerARB.htm

  3. #3

    Re: Generic vertex attributes

    I understand how to set generic attributes. I just don't know how to get at them from within a vertex shader.

    For example, to get the normal, I can use gl_Normal, but how do I get attribute 6?

  4. #4

    Re: Generic vertex attributes

    Scratch that. I see what you mean. There's no way to access a specific attrib because the GLSL determines the number for me. Thanks!

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2003
    Posts
    29

    Re: Generic vertex attributes

    You can tell GLSL which attrib index you want a given variable to have using glBindAttribLocationARB().

    http://www.3dlabs.com/support/develo...ocationARB.htm

  6. #6

    Re: Generic vertex attributes

    That's useful. I should really RTFM at some point. I hadn't realised 3DLabs' documentation was so good. Thanks again.

Posting Permissions

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