Multiple Render Target with texture3D

I’m trying to perform MRT throught FBO on 3D textures using instancing…
It seems to work for one render target but not for more.
Does anyone have noted this issue ?(it could be my bug…)


//init fbo
glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
cbuffer=new GLuint[2];
glGenRenderbuffers(2, cbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, cbuffer[0]);
	glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA, _width, _height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, (GL_COLOR_ATTACHMENT0), GL_RENDERBUFFER, cbuffer[0]);
glBindRenderbuffer(GL_RENDERBUFFER, cbuffer[1]);
glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA16F, _width, _height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, (GL_COLOR_ATTACHMENT1), GL_RENDERBUFFER, cbuffer[1]);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);


//draw
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);
glViewport(0,0,_width, _height);
GLenum bufferlist [] = { GL_COLOR_ATTACHMENT0 ,GL_COLOR_ATTACHMENT1 };
glDrawBuffers(2,bufferlist);
glUseProgram(PO);	
glBindVertexArray(this->SliceVertexArray);		
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,  targettex[0], 0);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1,  targettex[1], 0);				glDrawElementsInstanced(GL_QUADS, 4, GL_UNSIGNED_INT, 0,_depth);
glFinish();
glPopAttrib();

Seems like some limitation in using MRT with layered rendering.
Are you actually rendering to several slices of the 3D texture (layered rendering)?

(Excuse me for being late to answer…)
Yes I use gl_layer to set my target layer but seams like MRT doesnt work with my parameters…

I dont see the drawElement call how are you pushing in the geometry?

//init fbo

What is the purpose of this code? You create a bunch of renderbuffers and attach them to the FBO, only to replace them with texture objects before you actually do any rendering (to the extent that you actually are rendering. See mobeen’s question).

I’m making an eulerian(grid based) 3D fluid simulator with the use of texture3D RTT. My question was about the use of MRT with texture3D RTT.
But it seems not working…(yet?)…

The other question I would glad to be answered is about the use of a 3D texture mapped in a Texture Array…It’s seems to have several interesting pros
-such as the abilities to use gaussian splatting as we do with 2D texture rtt (i’ve read it)
-it may support MRT (??)
but one cons:
-it may(?) no support HW interpolation (texture2DArray eq gl_texelfetch)
But I havent test it

Perhaps someone have already bench it and can tell me if we can use MRT performance benefits with this other texture layout…
No?

Else i will code it in a bad day…