7#ifndef PXR_IMAGING_GLF_GL_CONTEXT_H
8#define PXR_IMAGING_GLF_GL_CONTEXT_H
11#include "pxr/imaging/glf/api.h"
16PXR_NAMESPACE_OPEN_SCOPE
19typedef std::shared_ptr<class GlfGLContext> GlfGLContextSharedPtr;
55 static void MakeCurrent(
const GlfGLContextSharedPtr& context);
59 static bool AreSharing(GlfGLContextSharedPtr
const & context1,
60 GlfGLContextSharedPtr
const & context2);
83 bool IsSharing(GlfGLContextSharedPtr
const & otherContext);
109 virtual bool _IsSharing(
const GlfGLContextSharedPtr& rhs)
const = 0;
112 virtual bool _IsEqual(
const GlfGLContextSharedPtr& rhs)
const = 0;
169 void _MakeNewContextCurrent();
171 void _RestoreOldContext();
174 GlfGLContextSharedPtr _newContext;
175 GlfGLContextSharedPtr _oldContext;
229 static GlfGLContextSharedPtr _GetSharedContext()
234 return GlfGLContextSharedPtr();
238#define API_GLF_HAS_ANY_GL_CONTEXT_SCOPE_HOLDER 1
296 static GlfGLContextSharedPtr _GetAnyContext()
299 GlfGLContextSharedPtr
const current =
302 current->IsValid() &&
307 return GlfGLContextSharedPtr();
347PXR_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.