2
$\begingroup$

I am writing an OpenSceneGraph based program that uses two cameras, one to render the preview for the user and one that uses a callback to make screenshots with MRT. The exporter camera is using an orthographic projection and always from the same position with the same view and up vector, whereas the preview camera can be moved by the user (which is why I use two cameras rather than one for both tasks).

Upon starting the program, I create the preview camera, add the shaders to it, then set up the viewer and add the preview camera to the viewer.

Afterwards I create the export camera, add its shaders, textures and callback and then I add the export camera as a child to the preview camera. Up to this point, nothing has been rendered (i.e. no frame call has been made).

The addChild call is issued (i.e. the break point is reached in Visual Studio, and stepping further I can see that the exporter camera is now a child of the preview camera). However, once I issue a command to actually make a screenshot, the exporter camera is not the child of the preview camera anymore (by now, a few render calls have been made).

Why is this, and how can I fix it apart from adding the exporter camera again?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.