glwidget.h

Go to the documentation of this file.
00001 //=============================================================================
00016 #ifndef __GLWIDGET_H_INCLUDED__
00017 #define __GLWIDGET_H_INCLUDED__
00018 
00019 #include <QtCore/QTime>
00020 #include <QtOpenGL/QGLWidget>
00021 
00022 // forward declarations
00023 class ICameraState;
00024 
00025 
00026 //=============================================================================
00027 // CGLWidget
00028 //=============================================================================
00029 
00039 class CGLWidget : public QGLWidget
00040 {
00041     Q_OBJECT
00042 public:
00047     CGLWidget( const QGLFormat & format, ICameraState* cs );
00048     virtual ~CGLWidget( void ); 
00049 
00055     bool isSuccessfullyInitialized( void ) const { return m_initSucceeded; }
00056 
00057 
00062     QString getDriverInfoString( void ) const;
00063 
00064 signals:;
00065 
00072     void render( void );
00073 
00074 private:
00075 
00076     // QWidget inherited
00077     QSize minimumSizeHint( void ) const;
00078     QSize sizeHint( void ) const;
00079 
00080     // QGLWidget inherited
00081     void paintGL( void );
00082     void initializeGL( void );
00083     void resizeGL( int width, int height );
00084 
00085     // event handling
00086     void  timerEvent( QTimerEvent* timer );
00087     void  mouseMoveEvent( QMouseEvent* event );
00088     void  keyPressEvent( QKeyEvent* event );
00089 
00090     // FPS
00091     void drawFPS( void );
00092     int   m_fpsCounter;     // counter for this period
00093     int   m_fpsValue;       // dispalyed to the used
00094     int   m_fpsLastPeriod;  // time point of last update
00095     QTime m_fpsTimer;
00096 
00097     // caught on resizeGL()
00098     QSize m_viewportSize;
00099 
00100     // store last position to calc deltas
00101     QPoint m_lastMousePosition;
00102 
00103     // wether OpenGL 2.0 and shader functions are available.
00104     bool m_initSucceeded;
00105 
00106     // the widgets transforms input events to camera transformations
00107     ICameraState* m_cameraState;
00108 };
00109 
00110 
00111 #endif  // __GLWIDGET_H_INCLUDED__
00112 
00113 

Generated on Sun Mar 2 17:12:31 2008 for Shader Maker by  doxygen 1.5.4