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: how to enumerate uniform variables ?

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2009
    Posts
    29

    how to enumerate uniform variables ?

    Hi

    Is there any way in GLSL to enumerate (used) uniform variables ?
    for example i have this glsl shader:

    Code :
    uniform vec4 some_var;
    void main(void)
    {
     gl_FragColor = some_var;
    }

    now if i know the variable name 'in advance'
    i could get it's location by
    glGetUniformLocation(my_program, "some_var");

    but is there any way to enumerate ALL (used) uniform variables that shader have ?
    (something like cgGetFirstParameter/cgGetNextParameter ?)
    and idealy know their types (float, vec2, sampler3D, etc.)

    CG is realy broken in terms of GLSL profiles
    and without those it is unusable on ATI cards
    so I'm looking for replacement.
    I do not use CG-FX - just the CG - i could easily port my shaders to GLSL - but i need a way to enumerate their uniforms to not hardcode them.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Mar 2007
    Location
    Latvia
    Posts
    225

    Re: how to enumerate uniform variables ?

    You can do it with glGetActiveUniform function.

Posting Permissions

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