help with opengl

About Monkey 2 Forums Monkey 2 Programming Help help with opengl

This topic contains 2 replies, has 2 voices, and was last updated by  AdamStrange 1 year, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8191

    AdamStrange
    Participant

    OK, I’ve a bit of code to do some basic opengl + glsl:

    It should be pretty obvious what is does:

    It draws the top and side of a cube that is rotating, with vertex colors. so far so good.

    What is not working is the ability to defines and reference the normal, uv and data parameters I am wanting to feed into the shader.

    checking the glGetAttributelocation return -1 for these 3.

    I’ve tried bindings them, but just can’t get it to work.

     

    Anyone have any suggestions what I’m doing wrong here?

     

    Here’s the matrix.monkey2 code to go with it…

    #8198

    Mark Sibly
    Keymaster

    The shader compiler may be optimizing out normal, color etc if they’re not actually used by the shader which they don’t appear to be.

    Another way to deal with attribs is to use glBindAttribLocation instead (after compiling but *before* linking) to ‘force’ attribs to go into fixed locations, position=0, normal=1, color=2 etc.

    #8199

    AdamStrange
    Participant

    thanks mark, thats good information 🙂

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.