Added extra methods WindowSystemInterface for controlling frame rate and resolution, and adde useCursor flag.
This commit is contained in:
@@ -573,6 +573,8 @@ void CompositeViewer::setUpRenderingSupport()
|
||||
sceneView->setSceneData(view->getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(view->getCamera()->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
view->getCamera()->getGraphicsContext()->add(new CompositeViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
|
||||
@@ -592,6 +594,8 @@ void CompositeViewer::setUpRenderingSupport()
|
||||
sceneView->setSceneData(view->getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(slave._camera->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
slave._camera->getGraphicsContext()->add(new CompositeViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,6 +358,9 @@ void GraphicsWindowX11::useCursor(bool cursorOn)
|
||||
XFlush(_display);
|
||||
XSync(_display,0);
|
||||
}
|
||||
|
||||
_traits->useCursor = cursorOn;
|
||||
|
||||
}
|
||||
|
||||
void GraphicsWindowX11::init()
|
||||
@@ -488,7 +491,7 @@ void GraphicsWindowX11::init()
|
||||
_nullCursor = XCreatePixmapCursor( _display, pixmap, pixmap, &ncol, &ncol, 0, 0 );
|
||||
}
|
||||
|
||||
useCursor(true);
|
||||
useCursor(_traits->useCursor);
|
||||
|
||||
XSelectInput( _display, _window, ExposureMask | StructureNotifyMask |
|
||||
KeyPressMask | KeyReleaseMask |
|
||||
|
||||
@@ -29,12 +29,15 @@ SimpleViewer::SimpleViewer():
|
||||
_eventVisitor = new osgGA::EventVisitor;
|
||||
|
||||
setDatabasePager(new osgDB::DatabasePager);
|
||||
|
||||
_databasePager->setCompileGLObjectsForContextID(_sceneView->getState()->getContextID(), true);
|
||||
}
|
||||
|
||||
SimpleViewer::~SimpleViewer()
|
||||
{
|
||||
_sceneView->releaseAllGLObjects();
|
||||
osg::GraphicsContext::decrementContextIDUsageCount(_sceneView->getState()->getContextID());
|
||||
_databasePager->setCompileGLObjectsForContextID(_sceneView->getState()->getContextID(), false);
|
||||
}
|
||||
|
||||
void SimpleViewer::setSceneData(osg::Node* node)
|
||||
@@ -53,6 +56,7 @@ void SimpleViewer::setSceneData(osg::Node* node)
|
||||
{
|
||||
// register any PagedLOD that need to be tracked in the scene graph
|
||||
_databasePager->registerPagedLODs(node);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -463,12 +463,12 @@ struct ViewerRenderingOperation : public osg::GraphicsOperation
|
||||
_sceneView->cull();
|
||||
_sceneView->draw();
|
||||
|
||||
double availableTime = 0.004; // 4 ms
|
||||
if (_databasePager.valid())
|
||||
{
|
||||
double availableTime = 0.004; // 4 ms
|
||||
_databasePager->compileGLObjects(*(_sceneView->getState()), availableTime);
|
||||
_sceneView->flushDeletedGLObjects(availableTime);
|
||||
}
|
||||
_sceneView->flushDeletedGLObjects(availableTime);
|
||||
}
|
||||
|
||||
osg::observer_ptr<osgUtil::SceneView> _sceneView;
|
||||
@@ -508,6 +508,8 @@ void Viewer::setUpRenderingSupport()
|
||||
sceneView->setState(_camera->getGraphicsContext()->getState());
|
||||
sceneView->setSceneData(getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(_camera->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
_camera->getGraphicsContext()->add(new ViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
@@ -528,6 +530,8 @@ void Viewer::setUpRenderingSupport()
|
||||
sceneView->setSceneData(getSceneData());
|
||||
sceneView->setFrameStamp(frameStamp);
|
||||
|
||||
if (dp) dp->setCompileGLObjectsForContextID(slave._camera->getGraphicsContext()->getState()->getContextID(), true);
|
||||
|
||||
slave._camera->getGraphicsContext()->add(new ViewerRenderingOperation(sceneView, dp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,6 +309,7 @@ BEGIN_OBJECT_REFLECTOR(osg::GraphicsContext::Traits)
|
||||
I_PublicMemberProperty(unsigned int, face);
|
||||
I_PublicMemberProperty(unsigned int, mipMapGeneration);
|
||||
I_PublicMemberProperty(bool, vsync);
|
||||
I_PublicMemberProperty(bool, useCursor);
|
||||
I_PublicMemberProperty(osg::GraphicsContext *, sharedContext);
|
||||
END_REFLECTOR
|
||||
|
||||
@@ -325,6 +326,14 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::GraphicsContext::WindowingSystemInterface)
|
||||
__void__getScreenResolution__C5_ScreenIdentifier_R1__unsigned_int_R1__unsigned_int_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method3(bool, setScreenResolution, IN, const osg::GraphicsContext::ScreenIdentifier &, x, IN, unsigned, int, IN, unsigned, int,
|
||||
__bool__setScreenResolution__C5_ScreenIdentifier_R1__unsigned__unsigned,
|
||||
"",
|
||||
"");
|
||||
I_Method2(bool, setScreenRefreshRate, IN, const osg::GraphicsContext::ScreenIdentifier &, x, IN, double, x,
|
||||
__bool__setScreenRefreshRate__C5_ScreenIdentifier_R1__double,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::GraphicsContext *, createGraphicsContext, IN, osg::GraphicsContext::Traits *, traits,
|
||||
__GraphicsContext_P1__createGraphicsContext__Traits_P1,
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user