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: glGetActiveUniform + uniform arrays

  1. #1
    Newbie Newbie
    Join Date
    Jul 2013
    Posts
    2

    glGetActiveUniform + uniform arrays

    assuming I have an array of uniform values in my shader code, i.e.:

    Code :
    #version 330 core
     
    uniform vec3 samplePositions[ 16 ]
     
    ...

    in my current glsl wrapper class, i query all active uniforms right after linking a program object & store the locations in a lookup table.
    Now, with regards to arrays of uniforms like the above example, I've noticed sth. weird:
    I'll get different active uniform names depending on the graphics card; on my PC ( Radeon 6900 ) i would get an active unform named "samplePositions[0]"
    while on my notebook ( Radeon 8970M ) I'd get an active uniform named just "samplePositions".

    ok, so I can easily work around this problem by just looking for both names - "samplePositions" and "samplePositions[0]" - in my table;
    however, i'd still like to know if this is a driver bug on one of those cards, or if the OpenGL specification is just so vague that both results are ok,
    or if using glGetActiveUniform itself is maybe problematic?

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Jan 2012
    Location
    Australia
    Posts
    1,101
    or if the OpenGL specification is just so vague that both results


    To my reading it seems vague

    Getting active uniform names for arrays with glGetActiveUniform does seems problematic. On nVidia driver I get name[0] but not any other names like name[1] if the object is a simple one like vec3 but if the object is a
    structure I get name[0].structure _member and name[1].structure _member etc.


    You might like to look at glGetProgramResourceiv which is designed to more information GLSL objects.

Posting Permissions

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