24#ifndef PXR_IMAGING_GLF_GL_CONTEXT_H
25#define PXR_IMAGING_GLF_GL_CONTEXT_H
28#include "pxr/imaging/glf/api.h"
33PXR_NAMESPACE_OPEN_SCOPE
36typedef std::shared_ptr<class GlfGLContext> GlfGLContextSharedPtr;
72 static void MakeCurrent(
const GlfGLContextSharedPtr& context);
76 static bool AreSharing(GlfGLContextSharedPtr
const & context1,
77 GlfGLContextSharedPtr
const & context2);
100 bool IsSharing(GlfGLContextSharedPtr
const & otherContext);
126 virtual bool _IsSharing(
const GlfGLContextSharedPtr& rhs)
const = 0;
129 virtual bool _IsEqual(
const GlfGLContextSharedPtr& rhs)
const = 0;
186 void _MakeNewContextCurrent();
188 void _RestoreOldContext();
191 GlfGLContextSharedPtr _newContext;
192 GlfGLContextSharedPtr _oldContext;
246 static GlfGLContextSharedPtr _GetSharedContext()
251 return GlfGLContextSharedPtr();
255#define API_GLF_HAS_ANY_GL_CONTEXT_SCOPE_HOLDER 1
313 static GlfGLContextSharedPtr _GetAnyContext()
316 GlfGLContextSharedPtr
const current =
319 current->IsValid() &&
324 return GlfGLContextSharedPtr();
364PXR_NAMESPACE_CLOSE_SCOPE
Architecture-specific thread function calls.
Helper class to make the shared GL context current if there is no valid current context,...
Provides window system independent access to GL contexts.
static GLF_API GlfGLContextSharedPtr GetCurrentGLContext()
Returns an instance for the current GL context.
virtual bool _IsEqual(const GlfGLContextSharedPtr &rhs) const =0
Returns true if this context is equal to rhs.
virtual void _MakeCurrent()=0
Makes this context current.
GLF_API bool IsSharing(GlfGLContextSharedPtr const &otherContext)
Returns true if this context is sharing with otherContext.
GLF_API bool IsCurrent() const
Returns true if this context is current.
static GLF_API bool AreSharing(GlfGLContextSharedPtr const &context1, GlfGLContextSharedPtr const &context2)
Returns true if context1 and context2 are sharing.
static GLF_API GlfGLContextSharedPtr GetSharedGLContext()
Returns an instance for the shared GL context.
virtual GlfGLContextSharedPtr CreateSharingContext()
Creates a new GlfContext that shares GL resources with this context.
virtual bool _IsSharing(const GlfGLContextSharedPtr &rhs) const =0
Returns true if this context is sharing with rhs.
static GLF_API bool IsInitialized()
Returns whether this interface has been initialized.
static GLF_API void MakeCurrent(const GlfGLContextSharedPtr &context)
Makes context current if valid, otherwise makes no context current.
static GLF_API void DoneCurrent()
Makes no context current.
virtual bool IsValid() const =0
Returns true if this context is valid.
Interface for registering a GlfGLContext system.
virtual GlfGLContextSharedPtr GetCurrent()=0
Whatever your GLContext system thinks is the current GL context may not really be the current context...
virtual GlfGLContextSharedPtr GetShared()=0
If this GLContext system supports a shared context this should return it.
Helper class to make a GL context current.
GLF_API GlfGLContextScopeHolder(const GlfGLContextSharedPtr &newContext)
Make the given context current and restore the current context when this object is destroyed.
Helper class to make the shared GL context current.
ARCH_API bool ArchIsMainThread()
Return true if the calling thread is the main thread, false otherwise.