I am writing some volume rendering code. I have 2 shader programs. In the first one I am writing to 10-20 2D textures which I need to read in the second one.
What would be the most efficient way to upload the 10-20 textures to the second program. I’m under the impression that having an array of textures like textures in the glsl code is outdated.
In the first program I write to many separate textures for now which have been declared in the OpenGL code as textures (using only 10 textures for now). Can I somehow create a texture_2d_array out of these 10 textures to use in the second program?
What would be the best way to proceed?
In the first one I am writing to 10-20 2D textures which I need to read in the second one.
… I’m curious as to how you plan to do that. Do you mean to write to those textures at the same time? Because even DX11-class hardware can only write to 8 textures simultaneously. And similarly, a single shader stage can only access 16 textures simultaneously.
Now, you can bind an array texture for layered rendering, which sort of allows you to render to more textures. The thing is that a single primitive is rasterized to a single layer, and the layer is controlled by a geometry shader, which also has the ability to write multiple primitives (one to each layer).
That’s probably your best bet.
Well I’m using glsl on a GTX 580 and I have already been able to write to 10 textures. I do not write all of them simultaneously: I write to 10 textures but at different times: after going thorough 1/10 of the volume, I write the data in one texture, then after 2/10 I write in another, …
I wrote the output out as pgm images to confirm that the result is correct and it is.
My issue is how to pass all of them to another shader efficiently.