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: Binding a single TEXTURE_2D_ARRAY layer to a sampler2D

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    27

    Binding a single TEXTURE_2D_ARRAY layer to a sampler2D

    With glFramebufferTextureLayer you can attach a single layer of a texture array to a framebuffer. In the same way I'd like to be able to bind a single layer to a sampler2D in a shader. This would allow existing shaders to function with either TEXTURE_2D or TEXTURE_2D_ARRAY as input, just the same way as a shader may now render to a framebuffer with either attached for output. I guess you could supply both sampler2D and sampler2DArray, use a branch to select and pass in the layer index as an alternative, but this just wouldn't be clean.

    I haven't come across anything in the API that looks like it'd provide this binding. Am I right in assuming it doesn't exist? Would it make sense to include the feature in OpenGL?

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    894
    Take a look at glTextureView.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    27
    Just what I'm after. Thanks!

    I guess I'll have to experiment with creating many texture handles for each layer or call glTextureView many times.

Tags for this Thread

Posting Permissions

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