PDA

View Full Version : Fill a GL_TEXTURE_2D_ARRAY with textures already loaded



cifacia
06-11-2014, 05:11 AM
Hi!

As the title states, I have a set of textures (specifically render targets textures) that I need to combine somehow. This are already loaded on GPU, is there a way to fill a GL_TEXTURE_2D_ARRAY with such textures or I have to retrieve the images from them first?

Thanks

Osbios
06-11-2014, 09:17 AM
If you render the images, the most efficient way would be to render directly into the 2d array. You just need a very simple geometry shader that sets gl_Layer​ via uniform value.
Or you can use ARB_copy_image (http://www.opengl.org/registry/specs/ARB/copy_image.txt), but this feature is kind of new and not available everywhere.

cifacia
06-11-2014, 11:49 AM
If you render the images, the most efficient way would be to render directly into the 2d array. You just need a very simple geometry shader that sets gl_Layer​ via uniform value.
Or you can use ARB_copy_image (http://www.opengl.org/registry/specs/ARB/copy_image.txt), but this feature is kind of new and not available everywhere.

The problem is that my system infrastructure doesn't allow me to do the render directly onto the layer easily. Also, I was curious if that was possible in general, but I'm afraid is not, right?

Osbios
06-11-2014, 01:53 PM
OpenGL 3.2 brings everything you need to use layered rendering. The geometry shader is core in 3.2. The rest you need is core in 3.0.
You also could bind the layers separately onto the FBO. But changing the FBO bindings is expensive on the CPU side.