Hi Javier

Sorry, I see what you're asking now, what you actually want to look at is
osgUtil::RenderStage::runCameraSetup

In this function you will see how a cameras BufferAttachment list is used to
create relevant fbo etc. The created fbo is stored in the _fbo variable of
the RenderStage. I think this stems back to the days of osg using producer
as it feels rather like this sort of thing should be happening in the
viewer. I think that's why it's quite difficult to follow.

What are you trying to achieve with the fbo once you have it?

Tom

On 14 February 2011 23:30, Javier Taibo <[email protected]> wrote:

>   Hi Thomas,
>
>   Thanks for the answer, but you didn't really understand what I was asking
> for. I know I can use a FBO to do render to texture or to an image or to a
> render buffer. The question was if I can have access to the FBO used by the
> camera, either by passing a FBO pointer to the camera or getting a pointer
> to the FBO of the camera. I have looked for it in the source code, but I
> found no way to do it.
>
>   Thanks anyway. I think I will try by adding an FBO to the StateSet of the
> part of the scenegraph under the camera.
>
>
>   Regards
>
>
> On Mon, Feb 14, 2011 at 4:35 PM, Thomas Hogarth 
> <[email protected]>wrote:
>
>> Hi Javier
>>
>>
>> >>Is there any way to explicitly pass an osg::FrameBufferObject to a
>> Camera,
>> >>so the camera renders into it?
>>
>> Yes you can use a framebufferobject as a render to texture target,
>> checkout the osgprerender example. If you want to use the result of your
>> render in your main app i.e. read the pixel info for some sort of gpu
>> compute, then you need to use a pbuffer for your main viewer. You set it up
>> something like the following
>>
>> Set pbuffer in the graphics traits (used to create your context) to true
>> Set the viewers renderTargetImplementation to FRAME_BUFFER_OBJECT
>> Attach an image as the cameras color buffer.
>>
>> Now when you render the result will end up in the image and could be saved
>> to disk if you like.
>>
>> Hope that helps
>> Tom
>>
>> PS
>> Checkout my helper viewer class and check for the _renderOffScreen bits
>>
>> http://code.google.com/p/hogbox/source/browse/trunk/src/hogbox/HogBoxViewer.cpp
>> Around line 305 and 357
>>
>>
>>>
>>
>
>
> --
> Javier Taibo
>
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to