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

Thread: Sampler information

  1. #1
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Sampler information

    Hi all!

    I've got the following problem:
    I want to get all samplers out of a program object. But how can I do that? If I loop through all uniform I'm not able to seperate an integer from a sampler. Furthermore I'm not able to find out which sampler type it is.
    Ok, I can write my own source which scans the whole GLslang source code but this is REALLY messy.
    But is there any other possibility?

    Thanks a lot
    Florian Rudolf
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: Sampler information

    What do you mean by "loop through uniforms"?

    Anyway, you could do a sub-string search or have a higher level file that describes the uniforms.

    The sub-string search will cost you 10 or 20 lines of code. That's a problem?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: Sampler information

    Originally posted by V-man:
    What do you mean by "loop through uniforms"?
    By using glGetActiveUniform and scanning all active uniforms.

    Originally posted by V-man:

    Anyway, you could do a sub-string search or have a higher level file that describes the uniforms.

    The sub-string search will cost you 10 or 20 lines of code. That's a problem?
    That would be an idea, yeah. But it is quite messy too.
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

  4. #4
    Intern Contributor
    Join Date
    Sep 2001
    Location
    Marlboro MA
    Posts
    96

    Re: Sampler information

    Originally posted by Corrail:
    Hi all!

    I've got the following problem:
    I want to get all samplers out of a program object. But how can I do that? If I loop through all uniform I'm not able to seperate an integer from a sampler. Furthermore I'm not able to find out which sampler type it is.
    Ok, I can write my own source which scans the whole GLslang source code but this is REALLY messy.
    But is there any other possibility?

    Thanks a lot
    Florian Rudolf
    This is unfortunately a known issue. The resolution is in process. It may include additional types representing the different samplers (from Sampler1D through Sampler2DShadow) returned by the <type> parameter of GetActiveUniformARB, which is precisely what you want.

    Another alternative to consider until (if) this change is approved is to establish a naming convention for sampler names between application programmers and shader writers. For example:
    Code :
    uniform sampler2D s2Dbase; // a terse convention
    uniform sampler2D sampler2D_basemap; // a less terse convention
    -mr. bill

  5. #5
    Member Regular Contributor
    Join Date
    Apr 2002
    Location
    Austria
    Posts
    328

    Re: Sampler information

    Originally posted by mrbill:
    [CODE]
    This is unfortunately a known issue. The resolution is in process. It may include additional types representing the different samplers (from Sampler1D through Sampler2DShadow) returned by the <type> parameter of GetActiveUniformARB, which is precisely what you want.
    Yes, that's exactly what I want. Do you know how/when this will be included in shader objects extension?
    There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.

    There is another theory which states that this has already happened...

Posting Permissions

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