[osg-users] Camera weirdness

Mark Jones mark0978 at gmail.com
Mon Nov 30 12:54:29 PST 2009

In main() I have:
    viewer.setSceneData( rootNode );
    osg::Camera *pCamera = viewer.getCamera();

    //osg::Image* image = new osg::Image;
    //image->allocateImage(tex_width, tex_height, 1, GL_RGBA,
    //image->allocateImage(tex_width, tex_height, 1, GL_RGBA, GL_FLOAT);

    // attach the image so its copied on each frame.
    //pCamera->attach(osg::Camera::COLOR_BUFFER, image, samples,
    pCamera->setFinalDrawCallback(new MyCameraPostDrawCallback(NULL));

    return viewer.run();
and in RenderStage::draw() is the code
    // render all the post draw callbacks

    if (_camera && _camera->getFinalDrawCallback())
        // if we have a camera with a final callback invoke it.

    // pop the render stages camera.
    if (_camera) renderInfo.popCamera();

When my code is running, the pointer to camera in main is nothing like the
_camera in the RenderStage, meaning that my callback never happens.

When I breakpoint in RenderStage (the only place I found FinalDrawCallback
used) the camera I put the callback on isn't one of those cameras.  Why?

I'm on a dual screen setup and I find 2 cameras (where the camera pointer is
different) which makes me think there might be something going on there.

I'm using a modified version of osgprerender.cpp as the base for what I am
doing at the moment.

I'm using other cameras for textures with callbacks in another part of the
program just fine, so the fact that this callback doesn't happen seems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20091130/6880a205/attachment.htm>

More information about the osg-users mailing list