[osg-users] Camera weirdness

Paul Martz pmartz at skew-matrix.com
Mon Nov 30 13:42:58 PST 2009


My guess would be that your camera callback isn't inheriting to the 
slave cameras, sort of like the problem I recently encountered (and 
fixed) relating to the clear mask (see the thread "Problem with 
Camera::inheritCullSettings" from about a week ago). You might need to 
submit a similar fix.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466



Mark Jones wrote:
> In main() I have:
> [code]
>     viewer.setSceneData( rootNode );
>     osg::Camera *pCamera = viewer.getCamera();
> 
>     //osg::Image* image = new osg::Image;
>     //image->allocateImage(tex_width, tex_height, 1, GL_RGBA,
> GL_UNSIGNED_BYTE);
>     //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,
> colorSamples);
>     pCamera->setFinalDrawCallback(new MyCameraPostDrawCallback(NULL));
> 
>     return viewer.run();
> [/code]
> and in RenderStage::draw() is the code
> [code]
>     // render all the post draw callbacks
>     drawPostRenderStages(renderInfo,previous);
> 
>     if (_camera && _camera->getFinalDrawCallback())
>     {
>         // if we have a camera with a final callback invoke it.
>         (*(_camera->getFinalDrawCallback()))(renderInfo);
>     }
> 
>     // pop the render stages camera.
>     if (_camera) renderInfo.popCamera();
> }
> [/code]
> 
> 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
> strange.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


More information about the osg-users mailing list