You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
#ifndef __GUIOPENGLPROVIDER_H_INCL__
#define __GUIOPENGLPROVIDER_H_INCL__
#include <WinSock2.h>
#include "windows.h"
#include <gl/GL.h>
#include <gl/GLU.h>
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glu32.lib")
#include "../components/base/basicMutex.h"
#include "gui.h"
#include <QtGui/QOpenGLFunctions>
/**
* guiOpenGLProvider singletone class to provide OpenGL context globally * * @author gagua */class guiOpenGLProvider {public: // Method to fetch singleton instance.
static guiOpenGLProvider* getInstance();
// Destructor
virtual ~guiOpenGLProvider();
QOpenGLContext *grabContext( void ); QOpenGLContext *tryGrabContext( void ); void releaseContext( void );
protected: // Constructor - protected so users cannot call it.
guiOpenGLProvider();
private: // private static member referencing the single instance of the object
// TODO: Replace guiOpenGLProvider with the type of object you want to
// return the single instance of
static guiOpenGLProvider *_instance; basicMutex *m_pContextProtectorMutex; // Copy constructor
// Declared but not defined to prevent auto-generated
// copy constructor. Refer to "Effective C++" by Meyers
guiOpenGLProvider(const guiOpenGLProvider& src);
// Assignment operator
// Declared but not defined to prevent auto-generated
// assignment operator. Refer to "Effective C++" by Meyers
guiOpenGLProvider& operator=(const guiOpenGLProvider& src);
QOpenGLContext *m_pContext;};
// Constructor implementation
inline guiOpenGLProvider::guiOpenGLProvider(){ m_pContextProtectorMutex = new basicMutex(); m_pContext = new QOpenGLContext(); //initializeOpenGLFunctions();
}
// Destructor implementation
inline guiOpenGLProvider::~guiOpenGLProvider(){ emit m_pContext->aboutToBeDestroyed(); delete(m_pContextProtectorMutex); delete(m_pContext);}
// TODO: Uncomment the copy constructor when you need it.
//inline guiOpenGLProvider::guiOpenGLProvider(const guiOpenGLProvider& src)
//{
// // TODO: copy
//}
// TODO: Uncomment the assignment operator when you need it.
//inline guiOpenGLProvider& guiOpenGLProvider::operator=(const guiOpenGLProvider& rhs)
//{
// if (this == &rhs) {
// return *this;
// }
//
// // TODO: assignment
//
// return *this;
//}
#endif // __GUIOPENGLPROVIDER_H_INCL__
|