Hi Rabbi,
This is my first response, I myself am a newbi, so the more experienced may
kindly correct.
You have not set the camera manipulator for the viewer class. Calling
viewer.run() automatically creates a default trackball manipulator object and
sets it as the manipulator. The same does not happen in this case. Just try
setting the appropriate manipulator.
Bye
Harash
________________________________
From: Rabbi Robinson <[email protected]>
To: [email protected]
Sent: Monday, August 10, 2009 11:55:24 PM
Subject: Re: [osg-users] offscreen rendering
Hi,
Here is what I got so far.
osgViewer::Viewer viewer;
//graphics context
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = image->s();
traits->height = image->t();
traits->red = 8;
traits->green = 8;
traits->blue = 8;
traits->alpha = 8;
traits->depth = 24;
traits->windowDecoration = false;
traits->pbuffer = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> pbuffer =
osg::GraphicsContext::createGraphicsContext(traits.get());
if (pbuffer.valid())
{
osg::ref_ptr<osg::Camera> camera = viewer.getCamera();
camera->setGraphicsContext(pbuffer.get());
camera->setViewport(new osg::Viewport(0,0,image->s(),image->t()));
camera->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f));
camera->setDrawBuffer(GL_BACK);
camera->setReadBuffer(GL_BACK);
viewer.realize();
}
else
{
std::cout << "Error cofiguring pbuffer\n";
exit(0);
}
//draw
viewer.setSceneData(geode);
viewer.frame();
It crashes at viewer.frame(), complaining some resource already in use.
Thank you!
Cheers,
Rabbi
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16051#16051
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org