i want to filter a texture (no mipmapping) and write the filtered levels into a 3D-Texture. I already created a 3D-Texture with following code:
glGenTextures(1, &outTexture);
glBindTexture(GL_TEXTURE_3D, outTexture);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8, width, height, layer, 0, GL_RGBA, GL_INT, 0);
glBindTexture(GL_TEXTURE_3D, 0);
and i render my models like so:
glFramebufferTexture3D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_3D, outTexture, 0, layer);
entity.render();
is there a way for a fragment-shader to write into multiple layers at the same time and knowing in which layer you are? Like so?
out_color[layer] = vec4(r,g,b,a);
PS: i need to know in which layer in the fragment shader (some filtering things & please no gl_Layer ... can be only used at OpenGL 4 and i can only use OpenGL 3) ... I could write it into a uniform and render multiple times but if there is a way to go with a one pass ... it would be nice :)