Hi, Since the change I suggest is very small from what JP has implemented I don't submit files here just the differences:
I removed getDrawBuffers and setDrawBuffers from the Camera.cpp / h In RenderStage the changes are as follows: RanderStage //.h Added vector of GLEnum named _drawBuffers. RenderStage.cpp In function runCameraSetUp, before the attachments loop (line 245) _drawBuffers.clear(); In the loop, add at the start of the loop the few lines: if(itr->first >= COLOR_BUFFER0 && itr->first <= COLOR_BUFFER7) _drawBuffers.push_back(itr->first - COLOR_BUFFER0 + GL_COLOR_ATTACHMENT0_EXT); And removed the line JP added (about line 404) // set up draw buffers if using multiple render targets osg::Camera::DrawBufferVector& cam_buffers = _camera->getDrawBuffers(); _drawBuffers.clear(); for (osg::Camera::DrawBufferVector::iterator buf = cam_buffers.begin(); buf != cam_buffers.end(); ++buf) { _drawBuffers.push_back(GL_COLOR_ATTACHMENT0_EXT+(*buf - osg::Camera::COLOR_BUFFER0)); } Then in function drawInner, in the second line JP wrote: bool using_multiple_render_targets = !(_drawBuffers.empty()); I changed it to bool using_multiple_render_targets = (_drawBuffers.size() > 1); That's all the changes. So if JP can check it (I have a mess of OSG1.2 and OSG2.3 code) then you can decide what to submit. Now after the follow up discussion of the matter, it still won't be a complete solution. I think in the setUpCamera code, the render stage should run custom visitor on the camera and it's sub-graphs that checks for nodes requests for MRT, for the camera it would be the color attachments, and for nodes, whatever data that could be implemented in the StateAttribute, that later would mapped to Color Attachment, and only after collecting all the requests and having all the attachments that will be used, the RenderStage will set up the _drawBuffers as implemented above. This is more complicated to implement and since I'm not very good with visitors I can only suggest a pseudo code to write in the renderstage setUpCamera before the _drawBuffers initialization (about line 245) something like this should happen: RTTVisitor rttVS; Camera->accept(rttVS); _drawBuffers = rttVS.getDrawBuffers(); And remove the code that push_back stuff to the _drawBuffers. Now the RTTVisitor apply methods should be something like Apply(Camera& cam) { Foreach attachment in AttachmentBuffers If( COLOR_BUFFER0 <= attachment <= COLOR_BUFFER7) _drawBuffers.pushback(attachment - COLOR_BUFFER0 + GL_COLOR_ATTACHMENT0_EXT); cam.Traverse(); } This is what should implemented and I'm not sure how Apply(Node& node) { Foreach attachment in Node.GetStateAtrributeMRTStuff If( COLOR_BUFFER0 <= attachment <= COLOR_BUFFER7( _drawBuffers.pushback(attachment - COLOR_BUFFER0 + GL_COLOR_ATTACHMENT0_EXT);} node.Traverse(); } What do you think? Will that give a full solution? I think that this way even if the MRT code is down there somewhere at some node, the camera will be set correctly, the fixed pipeline will render to COLOR_BUFFER0 and the specific node with the shader can render what it wants to what buffer it wants. Is that what Art ment? Thanks, Guy. _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org