GlContext* GlContext::create() { GlContext* context = new ContextType(sharedContext); context->initialize(); return context; }
GlContext* GlContext::New() { GlContext* context = new ContextType(sharedContext); context->Initialize(); return context; }
GlContext* GlContext::create(const ContextSettings& settings, unsigned int width, unsigned int height) { // Make sure that there's an active context (context creation may need extensions, and thus a valid context) assert(sharedContext != NULL); Lock lock(mutex); GlContext* context = NULL; // We don't use acquireTransientContext here since we have // to ensure we have exclusive access to the shared context // in order to make sure it is not active during context creation { sharedContext->setActive(true); // Create the context context = new ContextType(sharedContext, settings, width, height); sharedContext->setActive(false); } context->initialize(settings); context->checkSettings(settings); return context; }
GlContext* GlContext::create() { Lock lock(mutex); // Create the context GlContext* context = new ContextType(sharedContext); context->initialize(); return context; }
GlContext* GlContext::create(const ContextSettings& settings, unsigned int width, unsigned int height) { // Make sure that there's an active context (context creation may need extensions, and thus a valid context) ensureContext(); // Create the context GlContext* context = new ContextType(sharedContext, settings, width, height); context->initialize(); return context; }
GlContext* GlContext::create(const ContextSettings& settings, const WindowImpl* owner, unsigned int bitsPerPixel) { // Make sure that there's an active context (context creation may need extensions, and thus a valid context) ensureContext(); // Create the context GlContext* context = new ContextType(sharedContext, settings, owner, bitsPerPixel); context->initialize(); return context; }
void OpenGl::flush() { LOG_ALL(opengllog) << "attempting to flush current context" << std::endl; GlContext* context = getInstance()->_context.get(); if (context != 0) context->flush(); else LOG_ALL(opengllog) << "there is no current context in this thread" << std::endl; }
bool shared(GlContext& a, GlContext& b) { std::lock_guard<std::mutex> lock(contextShareMutex()); const auto& shared = a.shared(); for(auto& c : shared) if(c == &b) return true; return false; }