Added missing Camera::setDrawBuffer()/setReadBuffer()
This commit is contained in:
parent
f3607134a2
commit
ee3e820277
@ -297,6 +297,10 @@ static void Internal_SetAlpha(NSBitmapImageRep *imageRep, unsigned char alpha_va
|
|||||||
osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(1);
|
osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(1);
|
||||||
#endif // VIEWER_USE_SHARED_CONTEXTS
|
#endif // VIEWER_USE_SHARED_CONTEXTS
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
theViewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
theViewer->getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
// Cocoa follows the same coordinate convention as OpenGL. osgViewer's default is inverted.
|
// Cocoa follows the same coordinate convention as OpenGL. osgViewer's default is inverted.
|
||||||
theViewer->getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
theViewer->getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
||||||
// Use a trackball manipulator...matches nicely with the Mighty Mouse Scrollball.
|
// Use a trackball manipulator...matches nicely with the Mighty Mouse Scrollball.
|
||||||
|
@ -104,6 +104,11 @@ class ViewerFLTK : public osgViewer::Viewer, public AdapterWidget
|
|||||||
getCamera()->setViewport(new osg::Viewport(0,0,w,h));
|
getCamera()->setViewport(new osg::Viewport(0,0,w,h));
|
||||||
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f);
|
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f);
|
||||||
getCamera()->setGraphicsContext(getGraphicsWindow());
|
getCamera()->setGraphicsContext(getGraphicsWindow());
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,6 +166,11 @@ int main( int argc, char **argv )
|
|||||||
view1->getCamera()->setGraphicsContext(viewerWindow.getGraphicsWindow());
|
view1->getCamera()->setGraphicsContext(viewerWindow.getGraphicsWindow());
|
||||||
view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
|
view1->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
|
||||||
view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2));
|
view1->getCamera()->setViewport(new osg::Viewport(0,0,width,height/2));
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
view1->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
view1->getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
view1->setCameraManipulator(new osgGA::TrackballManipulator);
|
view1->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
view1->setSceneData(loadedModel.get());
|
view1->setSceneData(loadedModel.get());
|
||||||
|
|
||||||
@ -172,6 +182,11 @@ int main( int argc, char **argv )
|
|||||||
view2->getCamera()->setGraphicsContext(viewerWindow.getGraphicsWindow());
|
view2->getCamera()->setGraphicsContext(viewerWindow.getGraphicsWindow());
|
||||||
view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
|
view2->getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width)/static_cast<double>(height/2), 1.0, 1000.0);
|
||||||
view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2));
|
view2->getCamera()->setViewport(new osg::Viewport(0,height/2,width,height/2));
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
view2->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
view2->getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
view2->setCameraManipulator(new osgGA::TrackballManipulator);
|
view2->setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
view2->setSceneData(loadedModel.get());
|
view2->setSceneData(loadedModel.get());
|
||||||
|
|
||||||
|
@ -32,6 +32,11 @@ FOX_OSG_MDIView::FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
|
|||||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||||
viewer->getCamera()->setGraphicsContext(m_gwFox);
|
viewer->getCamera()->setGraphicsContext(m_gwFox);
|
||||||
viewer->getCamera()->setViewport(0,0,w,h);
|
viewer->getCamera()->setViewport(0,0,w,h);
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
viewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
viewer->getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||||
|
|
||||||
// FOX example does not catch the close of the graphics window, so
|
// FOX example does not catch the close of the graphics window, so
|
||||||
|
@ -301,6 +301,10 @@ private:
|
|||||||
{
|
{
|
||||||
_viewer->getCamera()->setGraphicsContext(graphicsContext);
|
_viewer->getCamera()->setGraphicsContext(graphicsContext);
|
||||||
_viewer->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
|
_viewer->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
_viewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
_viewer->getCamera()->setReadBuffer(GL_BACK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +112,10 @@ void cOSG::InitCameraConfig(void)
|
|||||||
camera->setProjectionMatrixAsPerspective(
|
camera->setProjectionMatrixAsPerspective(
|
||||||
30.0f, static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0, 1000.0);
|
30.0f, static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0, 1000.0);
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
camera->setDrawBuffer(GL_BACK);
|
||||||
|
camera->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
// Add the Camera to the Viewer
|
// Add the Camera to the Viewer
|
||||||
//mViewer->addSlave(camera.get());
|
//mViewer->addSlave(camera.get());
|
||||||
mViewer->setCamera(camera.get());
|
mViewer->setCamera(camera.get());
|
||||||
|
@ -53,6 +53,11 @@ public:
|
|||||||
|
|
||||||
camera->setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );
|
camera->setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );
|
||||||
camera->setViewport( new osg::Viewport(0, 0, traits->width, traits->height) );
|
camera->setViewport( new osg::Viewport(0, 0, traits->width, traits->height) );
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
camera->setDrawBuffer(GL_BACK);
|
||||||
|
camera->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
camera->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0f, 10000.0f );
|
camera->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0f, 10000.0f );
|
||||||
|
|
||||||
view->setSceneData( scene );
|
view->setSceneData( scene );
|
||||||
|
@ -128,6 +128,11 @@ int main( int argc, char **argv )
|
|||||||
|
|
||||||
osgViewer::Viewer viewer;
|
osgViewer::Viewer viewer;
|
||||||
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw = viewer.setUpViewerAsEmbeddedInWindow(0,0,windowWidth,windowHeight);
|
osg::ref_ptr<osgViewer::GraphicsWindowEmbedded> gw = viewer.setUpViewerAsEmbeddedInWindow(0,0,windowWidth,windowHeight);
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
viewer.getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
viewer.getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
viewer.setSceneData(loadedModel.get());
|
viewer.setSceneData(loadedModel.get());
|
||||||
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
|
||||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||||
|
@ -64,6 +64,11 @@ bool wxOsgApp::OnInit()
|
|||||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||||
viewer->getCamera()->setGraphicsContext(gw);
|
viewer->getCamera()->setGraphicsContext(gw);
|
||||||
viewer->getCamera()->setViewport(0,0,width,height);
|
viewer->getCamera()->setViewport(0,0,width,height);
|
||||||
|
|
||||||
|
// set the draw and read buffers up for a double buffered window with rendering going to back buffer
|
||||||
|
viewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||||
|
viewer->getCamera()->setReadBuffer(GL_BACK);
|
||||||
|
|
||||||
viewer->addEventHandler(new osgViewer::StatsHandler);
|
viewer->addEventHandler(new osgViewer::StatsHandler);
|
||||||
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user