OgreWidget.cc 880 Bytes
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4 5 6 7 8 9
#ifndef __OGREWIDGET_H__
#define __OGREWIDGET_H__

#include <OGRE/Ogre.h>
#include <QGLWidget>
#include <QX11Info>

class OgreWidget : public QGLWidget
{
10 11 12 13 14 15 16
    //Q_OBJECT;

public:
    OgreWidget( QWidget *parent=0 ):
        QGLWidget( parent ),
        mOgreWindow(NULL) {
        init( "../bin/plugins.cfg", "../bin/ogre.cfg", "../bin/ogre.log" );
pixhawk's avatar
pixhawk committed
17 18
    }

19 20 21 22
    virtual ~OgreWidget() {
        mOgreRoot->shutdown();
        delete mOgreRoot;
        destroy();
pixhawk's avatar
pixhawk committed
23 24
    }

25 26 27 28
protected:
    virtual void initializeGL();
    virtual void resizeGL( int, int );
    virtual void paintGL();
pixhawk's avatar
pixhawk committed
29

30
    void init( std::string, std::string, std::string );
pixhawk's avatar
pixhawk committed
31

32
    virtual Ogre::RenderSystem* chooseRenderer( Ogre::RenderSystemList* );
pixhawk's avatar
pixhawk committed
33

34 35 36 37 38
    Ogre::Root *mOgreRoot;
    Ogre::RenderWindow *mOgreWindow;
    Ogre::Camera *mCamera;
    Ogre::Viewport *mViewport;
    Ogre::SceneManager *mSceneMgr;
pixhawk's avatar
pixhawk committed
39 40 41
};

#endif