Hello.

My task is to have 2 cameras being exactly the same.
The first one will render to my window and the second one to texture.

First i tried to create a camera as child to scene data and add the same
model as child.
So i used the following code:

Viewer viewer;
Camera* camera = new Camera(*viewer.getCamera(), CopyOp::DEEP_COPY_ALL);
ref_ptr<Image> image = new Image();
image->allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE);
camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
camera->attach(Camera::BufferComponent(Camera::COLOR_BUFFER0), image.get());
camera->setPostDrawCallback(new MyCameraPostDrawCallback(image.get()));

The post callback will writes image to file.
I couldnt make it work and i have no idea why. All i see in the texture is
an empty scene.
What more should i do ?

After that i decided to use slave camera. I noticed that i had to use 2
different graphics context.
But the problem is that i dont want the second window to appear.
What configuration should i pass to the second context to not appear any
window ?
I assume is something based on WindowingSystemInterface but i couldnt find
what exactly.

Thank you for your time.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to