ViewerQOSG declaration in QOSGWidget.h separated out from QOSGWidget.cpp
To use the QT moc class definitions must each be in their own header.
// Parent class derived from QObject must come first.
class ViewerQOSG : public QOSGWidget,public osgViewer::Viewer
{
//Include this if you want to emit signals, but file will have to go through
the moc
//Q_OBJECT
public:
ViewerQOSG(QWidget * parent = 0, const char * name = 0, WindowFlags f =
0):
QOSGWidget( parent, name, f )
{
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
// This line causes the image to be stretched vertically on Nvidia (but
not ATI) on XP!
//getCamera()->setProjectionMatrixAsPerspective(30.0f,
static_cast<double>(width())
static_cast<double>(height()), 1.0f,
10000.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());
setThreadingModel(osgViewer::Viewer::SingleThreaded);
connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
_timer.start(10);
}
virtual void paintEvent( QPaintEvent * event ) { frame(); }
protected:
QTimer _timer;
};
--------------------------------------
Martin
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org