Templatized OpenGLWidget so users can specify the version of OpenGL to support.

This commit is contained in:
David Williams
2015-02-24 22:17:46 +01:00
parent d3b71a92b9
commit e985dce075
8 changed files with 33 additions and 18 deletions

View File

@ -37,7 +37,9 @@ distribution.
// This is a very basic class for getting an OpenGL example up and running with Qt5. It simply displays
// an OpenGL widget and implements an FPS-style camera as well as other very basic functionality. User
// code can derive from this and override the provided virtual functions to implement functionality.
class OpenGLWidget : public QGLWidget, protected QOpenGLFunctions_3_1
// The class is templatized so users can specify the OpenGL version via the appropriate QOpenGLFunctions.
template <typename QOpenGLFunctionsType>
class OpenGLWidget : public QGLWidget, protected QOpenGLFunctionsType
{
protected:
// Protected constructor because this widget should not be created directly - it should only be subclassed.
@ -93,4 +95,6 @@ private:
QElapsedTimer mElapsedTimer;
};
#include "OpenGLWidget.inl"
#endif //__BasicExample_OpenGLWidget_H__