Hi,
I noticed the problem with first call of viewer.frame() too. This is happens.
because meanwhile the viewer initialization - which is called by first call of
viewer.frame() - a call to glGetString (SceneView::init() ->
osg::isGLExtensionSupported(_renderInfo.getState()->getContextID(),""); )
triggers exiting to the caller of viewer.frame().
Actually nothing is rendered in the first frame.
The following code works for me to get an offscreen viewer. I don't know if you
can leave sth. out from the traits.
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits();
traits->x = viewport->x(); // viewport of camera
traits->y = viewport->y();
traits->width = viewport->width();
traits->height = viewport->height();
traits->windowDecoration = false;
traits->doubleBuffer = false;
traits->sharedContext = NULL;
traits->pbuffer = true;
osg::GraphicsContext *graphicsContext =
osg::GraphicsContext::createGraphicsContext(traits.get());
if(!graphicsContext) {
osg::notify(osg::NOTICE) << "Failed to create pbuffer, failing back to
normal graphics window." << std::endl;
traits->pbuffer = false;
graphicsContext =
osg::GraphicsContext::createGraphicsContext(traits.get());
}
viewer->getCamera()->setGraphicsContext(graphicsContext);
I found another problem:
I would like to change the textures used for render to texture. However the
framebufferobject used by osg is only initialized once and cannot be updated -
at least with an approach like in the osgmultiplerendertargets example.
Camera::detach() has no effect.
Best Regards
Dietmar Funck
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36728#36728
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org