Results 1 to 2 of 2

Thread: glGetActiveUniform + uniform arrays

  1. #1
    Junior Member Newbie
    Join Date
    May 2011

    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
    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.

Similar Threads

  1. How does Uniform block indexing work for arrays of arrays?
    By timothyja1 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 03-21-2015, 03:51 PM
  2. Uniform arrays on ATI/AMD
    By Ketracel White in forum OpenGL: GLSL
    Replies: 5
    Last Post: 07-16-2010, 01:55 AM
  3. Replies: 5
    Last Post: 02-07-2006, 10:28 AM
  4. ATI and uniform arrays
    By Fitz in forum OpenGL: GLSL
    Replies: 2
    Last Post: 02-14-2005, 03:03 AM
  5. uniform arrays
    By Marty666 in forum OpenGL: GLSL
    Replies: 6
    Last Post: 03-03-2004, 04:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean