3

I am asking probably a simple question.I have a texture array (GL_TEXTURE_2D_ARRAY) of image2D textures.I access the array in a fragment shader via image2DArray.How do I get an access to the images of the array? imageLoad() has a param for layer number? I have read here and here ,but failed to figure out how it's done.

The thing is that if I access it like this:

void main(void)
{

color = vec4(imageLoad(output_image, ivec3(gl_FragCoord.xy,0) ).xyzw) / 255.0;
}

That is, third number of texture coords is texture layer index.I am getting texture's output onto the screen but it becomes static (doesn't move with cam movement) and displaced.

UPDATE:

Ok,it was my fault.I was referencing wrong texture object.Yes, the third coordinate of ivec3 in imageLoad should target texture array layer index.

jozxyqk
  • 16,424
  • 12
  • 91
  • 180
Michael IV
  • 11,016
  • 12
  • 92
  • 223
  • No,image2DArray http://developer.download.nvidia.com/opengl/specs/GL_ARB_shader_image_load_store.txt But I guess the concept should be similar... – Michael IV Jun 26 '13 at 12:40

0 Answers0