0 Replies Latest reply on Mar 5, 2013 9:39 AM by sepul

    Problem with Sampling Layered Texture Array (Depth)

    sepul

      Hi

      Problem is accessing depth (internal format) texture array in the shader and writing it to some output.

      My hardware is GL4.2 (AMD 5750) - drivers Catalyst 13.1

      And here is the screenshot of the whole thing in PerfStudio frame debugger:

      http://www.hmrengine.com/tmp/texarr-shot1.png

      As you can see, in the fragment shader, FS[0] (the only texture binded) is is GL_DEPTH_COMPONENT binded to sampler2DArray, I just fetch the first array slice and put it in first RT (RT[0]) but the result is always zero. I even tried fetching texture with texelFetch and the result is the same. I also included the shot of the source texture array info. the shots are pretty self explanatory.

      http://www.hmrengine.com/tmp/texarr-shot2.png

       

      The code for textue/framebuffer creation :

      glGenTextures(1, &tex_id);
      glBindTexture(GL_TEXTURE_2D_ARRAY, tex_id);
      glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT, 1024, 1024, 3, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL);
      
      glGenFramebuffers(1, &fb);
      glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
      glDrawBuffer(GL_NONE);
      glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, tex_id, 0);
      ASSERT(glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
      // ... draw to frame buffer
      

       

      Can anybody hint what I'm doing wrong ?

      thx