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

Thread: GLSL uniform sampler question

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2004
    Posts
    11

    GLSL uniform sampler question

    Hi, I am a new bie to GLSL. Here is my question:
    I have set a sampler uniform to a fragment shader using glUniformiv(), but I want to get the texture stage it used and the texture target so that i can set some sampler states for it. I have looked for the specification again and again and found nothing.
    May be this question is not very advanced, may be I am very stupid

    Previously I am using NVIDIA's Cg language and it has the ability to do this, but how can I do this with GLSL?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: GLSL uniform sampler question

    The value you set into the GLSL sampler uniform is index of texture unit to which you have to bind the desired texture.

  3. #3
    Intern Contributor
    Join Date
    Oct 2005
    Location
    Belgium, Li├Ęge
    Posts
    70

    Re: GLSL uniform sampler question

    try this:

    int my_sampler_uniform_location;
    my_sampler_uniform_location = GetVariable("tex");
    glUniform1iARB(my_sampler_uniform_location, unit);

    where "tex" is the sampler in your fragment shader
    and "unit" is the texture unit index Komat is talking about.

    HTH,

    HardTop
    Don't tell me what's in, tell me how to write
    Don't tell me how to win this fight
    Isn't your life, it isn't your right to take the only thing that's
    Mine

  4. #4
    Junior Member Newbie
    Join Date
    Aug 2004
    Posts
    11

    Re: GLSL uniform sampler question

    Thank you Komat and hardtop, I'v misunderstand it. Thank you!

Posting Permissions

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