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.
30 lines
759 B
30 lines
759 B
#include "guiOpenGLProvider.h"
|
|
|
|
guiOpenGLProvider* guiOpenGLProvider::_instance = 0;
|
|
|
|
/**
|
|
* Returns the single instance of the object.
|
|
*/
|
|
guiOpenGLProvider* guiOpenGLProvider::getInstance() {
|
|
// check if the instance has been created yet
|
|
if (0 == _instance) {
|
|
// if not, then create it
|
|
_instance = new guiOpenGLProvider;
|
|
}
|
|
// return the single instance
|
|
return _instance;
|
|
};
|
|
|
|
QOpenGLContext *guiOpenGLProvider::grabContext( void ){
|
|
m_pContextProtectorMutex->lock();
|
|
return m_pContext;
|
|
};
|
|
|
|
QOpenGLContext *guiOpenGLProvider::tryGrabContext( void ){
|
|
if( m_pContextProtectorMutex->try_lock() ) return m_pContext;
|
|
return NULL;
|
|
};
|
|
|
|
void guiOpenGLProvider::releaseContext( void ){
|
|
m_pContextProtectorMutex->unlock();
|
|
};
|