Added missing Camera::setDrawBuffer/setReadBuffer()
This commit is contained in:
parent
f8eabd38ba
commit
98cdeac9f6
@ -297,6 +297,10 @@ static void Internal_SetAlpha(NSBitmapImageRep *imageRep, unsigned char alpha_va
|
||||
osg::DisplaySettings::instance()->setMaxNumberOfGraphicsContexts(1);
|
||||
#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.
|
||||
theViewer->getEventQueue()->getCurrentEventState()->setMouseYOrientation(osgGA::GUIEventAdapter::Y_INCREASING_UPWARDS);
|
||||
// Use a trackball manipulator...matches nicely with the Mighty Mouse Scrollball.
|
||||
|
@ -32,6 +32,11 @@ FOX_OSG_MDIView::FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
|
||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||
viewer->getCamera()->setGraphicsContext(m_gwFox);
|
||||
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);
|
||||
|
||||
// FOX example does not catch the close of the graphics window, so
|
||||
|
@ -318,6 +318,8 @@ private:
|
||||
_viewer->getCamera()->setGraphicsContext(graphicsContext);
|
||||
_viewer->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
|
||||
_viewer->getCamera()->setProjectionMatrixAsPerspective(60.0, (double)traits->width/(double)traits->height, 0.1, 1000.0);
|
||||
_viewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||
_viewer->getCamera()->setReadBuffer(GL_BACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,10 @@ void cOSG::InitCameraConfig(void)
|
||||
// Set the viewport for the Camera
|
||||
camera->setViewport(new osg::Viewport(traits->x, traits->y, 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);
|
||||
|
||||
// Set projection matrix and camera attribtues
|
||||
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
camera->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.4f, 1.0f));
|
||||
|
@ -128,6 +128,11 @@ int main( int argc, char **argv )
|
||||
|
||||
osgViewer::Viewer viewer;
|
||||
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.setCameraManipulator(new osgGA::TrackballManipulator);
|
||||
viewer.addEventHandler(new osgViewer::StatsHandler);
|
||||
|
@ -64,8 +64,11 @@ bool wxOsgApp::OnInit()
|
||||
osgViewer::Viewer *viewer = new osgViewer::Viewer;
|
||||
viewer->getCamera()->setGraphicsContext(gw);
|
||||
viewer->getCamera()->setViewport(0,0,width,height);
|
||||
viewer->getCamera()->setDrawBuffer(GL_BACK);
|
||||
viewer->getCamera()->setReadBuffer(GL_BACK);
|
||||
|
||||
// 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->setThreadingModel(osgViewer::Viewer::SingleThreaded);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user