[osg-submissions] Multiple RTT support
J.P. Delport
jpdelport at csir.co.za
Mon Oct 1 03:42:20 PDT 2007
Hi Robert/John,
I'm sorry I don't have time to work on this. I'm attaching an email from
Mauricio below where he also had some problem with retrieving the depth
buffer after using some of my changes, maybe this can help.
jp
--------------------------------8<---
Hi JP
Thank you very much for your help.
In fact, we both have been working around the same piece of code. That
"_bufferAttachmentMap" and the work around it had to be created by me,
some months ago, because before of that you could only retrieve one
buffer to CPU (color or depth buffer, the last requested, if I remember).
Now I can retrieve to CPU as many color buffers I need and the depth
buffer too. But I had to make a little modification in your code.
Although I could retrieve the depth buffer, the following error was
issued to console:
Warning: detected OpenGL error 'invalid enumerant' after
RenderBin::draw(,)
RenderStage::drawInner(,) FBO status= 0x8cd5
It was because the FBO extension enumeration does not match with
osg::camera::BufferComponent enumeration. While DEPTH_BUFFER is in the
beginning of osg::camera, GL_DEPTH_ATTACHMENT_EXT is in the end of FBO.
This way, an invalid parameter was passed to glReadBuffer().
So I had to change the line
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + (itr->first -
osg::Camera::COLOR_BUFFER0));
by this code
int attachment=itr->first;
if (attachment==osg::CameraNode::DEPTH_BUFFER){
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
}
else
{
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + (attachment -
osg::CameraNode::COLOR_BUFFER0));
}
Witch is far from clean but solved my problem.
Again, thank you very much.
Mauricio Hofmam
hofmam at tecgraf.puc-rio.br
--------------------------------8<---
Robert Osfield wrote:
> Hi John,
>
> I've just applied your changes and osgprerender still works fine but when I run:
>
> osgviewer cow.osg --3d-sd
>
> And
>
> osgviewer cow.osg --panoramic-sd
>
> I get the error:
>
> Warning: detected OpenGL error 'invalid operation' after RenderBin::draw(,)
> RenderStage::drawInner(,) FBO status= 0x8cd5
>
> I haven't had a chance to look into this, its an error that didn't
> occur before. The above viewer options use render to texture to do
> distortion correction for a spherical display.
>
> Robert.
> On 10/1/07, John Donovan <john.donovan at embryonicstudios.com> wrote:
>> Hi Robert,
>> With code first written by J.P. Delport, I've made the necessary changes to
>> allow for multiple render to texture, and read from texture. By attaching more
>> than one buffer to a camera, it automatically calls glDrawBuffers() if it's
>> supported, otherwise it falls back to glDrawBuffer().
>> If images are attached to a camera, it automatically reads the texture into the
>> image. I've not put in any support to switch this on and off on the fly, but I
>> can do that if you want.
>> I've tested all the codepaths on Windows with an nVidia card, and it all seems
>> shiny. But I don't have a Linux box or ATI card to test it any further.
>>
>> Kindest regards,
>> John Donovan
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
More information about the osg-submissions
mailing list