2007-06-12 22:20:16 +08:00
|
|
|
/* OpenSceneGraph example, osganimate.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2006-10-01 00:26:53 +08:00
|
|
|
|
2007-06-03 17:09:09 +08:00
|
|
|
#if USE_QT4
|
2007-06-03 00:01:56 +08:00
|
|
|
|
|
|
|
#include <QtGui/QApplication>
|
2007-06-03 17:09:09 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
#include <qapplication.h>
|
2007-06-03 00:01:56 +08:00
|
|
|
#endif
|
2006-10-01 00:26:53 +08:00
|
|
|
|
2007-12-08 23:46:19 +08:00
|
|
|
#include <osg/ArgumentParser>
|
2006-10-01 00:26:53 +08:00
|
|
|
|
2007-12-08 23:46:19 +08:00
|
|
|
#include <iostream>
|
2007-06-06 03:10:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-08 23:46:19 +08:00
|
|
|
extern int mainQOSGWidget(QApplication& a, osg::ArgumentParser& arguments);
|
|
|
|
extern int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments);
|
2006-10-15 19:39:35 +08:00
|
|
|
|
2006-10-01 00:26:53 +08:00
|
|
|
int main( int argc, char **argv )
|
|
|
|
{
|
|
|
|
QApplication a( argc, argv );
|
|
|
|
|
2006-10-01 04:05:36 +08:00
|
|
|
if (argc<2)
|
2006-10-01 00:26:53 +08:00
|
|
|
{
|
|
|
|
std::cout << argv[0] <<": requires filename argument." << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-06-06 03:10:18 +08:00
|
|
|
osg::ArgumentParser arguments(&argc, argv);
|
|
|
|
|
2007-12-08 23:46:19 +08:00
|
|
|
if (arguments.read("--QOSGWidget"))
|
2007-06-06 03:10:18 +08:00
|
|
|
{
|
2007-12-08 23:46:19 +08:00
|
|
|
// Use QWidget and integrate OSG/OpenGL with it via osgViewer's built in support
|
|
|
|
return mainQOSGWidget(a, arguments);
|
2007-06-06 03:10:18 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-08 23:46:19 +08:00
|
|
|
// Use QGLWidget and integrate OSG with it by adapting osgViewer via its embedded window mode
|
|
|
|
return mainAdapterWidget(a, arguments);
|
|
|
|
}
|
2006-10-01 00:26:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*EOF*/
|