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

Thread: sampler parameters: bind texture object id OR bind texture unit

  1. #1
    Member Regular Contributor
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    293

    sampler parameters: bind texture object id OR bind texture unit

    the spec of ARB_fragment_program and ARB_shader_objects isn't clear about this topic. what must be bound to a sampler2D uniform parameter, the texture unit (GL_MAX_TEXTURE_UNITS is the maximum) or the texture object id (created with glGenTextures()).
    in the first case this issue would limit the shader to 4 textures (on a geforce card) while GL_MAX_TEXTURE_IMAGE_UNITS reports 16 available units per shader. also would the first case imply quiet an overhead for the setup for multiple textures for one shader (glActiveTexture must be set for every texture and an texture object must be bound).

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    17

    Re: sampler parameters: bind texture object id OR bind texture unit

    you bind a texture unit

    i agree - the spec isnt clear on this, and it caused me a lot of grief trying to find out why my program was not working

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    Posts
    10

    Re: sampler parameters: bind texture object id OR bind texture unit

    From the spec:
    The value of a sampler indicates the
    texture image unit being accessed. Setting a sampler's value to i selects texture
    image unit number i. The values of i range from zero to the maximum supported number
    of texture image units. This maximum is implementation dependent, and defined in other
    specifications.

    The type of the sampler identifies the target on the texture image unit. The texture
    object bound to that texture image unit's target is then used for the texture lookup.
    For example, a variable of type sampler2D selects target TEXTURE_2D on its texture
    image unit.
    Is it the wording using texture image unit that you find confusing ?

Posting Permissions

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