Hi,
I need to automatically check the rendering capabilities of the current
hardware and chose rendering techniques from that. I want to find the best
practical way to do this.
I have looked into the OSGShaderTerrain example.
It uses a osg::GraphicsOperation class to do actual capability checking.
My application creates a osgViewer::CompositeViewer instance.
Basically this is the initialization in pseudocode:
viewer = new osgViewer::CompositeViewer();
view = new osgViewer::View;
viewer->addView( view );
view->setSceneData( myRootNode );
view->setUpViewInWindow( 100, 100, 1024, 768 );
viewer->run();
Now say that I have 3 different levels of rendering techniques:
2 = Complex
1 = Normal
0 = Simple
If I shall use the same method as done in the OSGShaderTerrain example, then I
would write the code like this:
level = 3
while( level-- )
{
viewer = new osgViewer::CompositeViewer();
capabilityChecker = new myTestSupportOperationClass( level ); //
myTestSupportOperationClass is a specialized version of osg::GraphicsOperation.
viewer->setRealizeOperation( capabilityChecker );
view = new osgViewer::View;
viewer->addView( view );
view->setSceneData( myRootNode );
view->setUpViewInWindow( 100, 100, 1024, 768 );
viewer->realize();
if( !capabilityChecker->_supported )
{
..cleanup so we are ready to initialize again...
continue; // Check one lower level...
}
viewer->run();
break; // We did manage to run, so break the loop
}
I wonder if this is a good way to organize the capability testing?
Is there other ways I should explore?
QITODMWTAM-section (Questions I think OSG developers may want to ask me):
------------------------------------------------------------------------------
Q: What capabilities are you trying to check?
A:
I want to check if the current hardware can run shaders.
I would also check basic stuff like how many texture units I can use.
I would also check if I can render to an offscreen surface.
I plan to give each special-effect that I write a capability checking function
which I should be able to call from my specialization of the
osg::GraphicsOperation class. Each piece of code I have that require checking
will then be able to stop the system from using them if the capability needs
are not met.
Cheers,
Viggo
_________________________________________________________________
Få Windows Live Messenger på mobilen.
http://windowslivemobile.msn.com/Homepage.aspx?lang=nb-no&ocid=30032_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org