OgreWidget.cc 848 Bytes
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#ifndef __OGREWIDGET_H__
#define __OGREWIDGET_H__

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

class OgreWidget : public QGLWidget
{
  //Q_OBJECT;

 public:
  OgreWidget( QWidget *parent=0 ):
    QGLWidget( parent ),
    mOgreWindow(NULL)
    {
      init( "../bin/plugins.cfg", "../bin/ogre.cfg", "../bin/ogre.log" );
    }

  virtual ~OgreWidget()
    {
      mOgreRoot->shutdown();
      delete mOgreRoot;
      destroy();
    }

 protected:
  virtual void initializeGL();
  virtual void resizeGL( int, int );
  virtual void paintGL();

  void init( std::string, std::string, std::string );

  virtual Ogre::RenderSystem* chooseRenderer( Ogre::RenderSystemList* );

  Ogre::Root *mOgreRoot;
  Ogre::RenderWindow *mOgreWindow;
  Ogre::Camera *mCamera;
  Ogre::Viewport *mViewport;
  Ogre::SceneManager *mSceneMgr;
};

#endif