Blender V5.0
GHOST_Context Class Referenceabstract

#include <GHOST_Context.hh>

Inherits GHOST_IContext.

Inherited by GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

Public Member Functions

 GHOST_Context (const GHOST_ContextParams &context_params)
 ~GHOST_Context () override
GHOST_TSuccess swapBufferAcquire () override=0
GHOST_TSuccess swapBufferRelease () override=0
GHOST_TSuccess activateDrawingContext () override=0
GHOST_TSuccess releaseDrawingContext () override=0
virtual GHOST_TSuccess initializeDrawingContext ()=0
virtual GHOST_TSuccess updateDrawingContext ()
virtual GHOST_TSuccess releaseNativeHandles ()=0
virtual GHOST_TSuccess setSwapInterval (int)
virtual GHOST_TSuccess getSwapInterval (int &)
void * getUserData ()
void setUserData (void *user_data)
bool isStereoVisual () const
virtual GHOST_TVSyncModes getVSync ()
virtual bool isUpsideDown () const
unsigned int getDefaultFramebuffer () override
Public Member Functions inherited from GHOST_IContext
virtual ~GHOST_IContext ()=default

Static Public Member Functions

static GHOST_ContextgetActiveDrawingContext ()
Static Public Member Functions inherited from GHOST_IContext
static GHOST_IContextgetActiveDrawingContext ()

Protected Attributes

GHOST_ContextParams context_params_
void * user_data_ = nullptr

Static Protected Attributes

static GHOST_Contextactive_context_

Detailed Description

Definition at line 17 of file GHOST_Context.hh.

Constructor & Destructor Documentation

◆ GHOST_Context()

◆ ~GHOST_Context()

GHOST_Context::~GHOST_Context ( )
inlineoverride

Destructor.

Definition at line 31 of file GHOST_Context.hh.

References active_context_.

Member Function Documentation

◆ activateDrawingContext()

GHOST_TSuccess GHOST_Context::activateDrawingContext ( )
overridepure virtual

Activates the drawing context.

Returns
A boolean success indicator.

Implements GHOST_IContext.

Implemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

◆ getActiveDrawingContext()

GHOST_Context * GHOST_Context::getActiveDrawingContext ( )
inlinestatic

Returns the thread's currently active drawing context.

Definition at line 41 of file GHOST_Context.hh.

References active_context_, and GHOST_Context().

Referenced by GHOST_IContext::getActiveDrawingContext().

◆ getDefaultFramebuffer()

unsigned int GHOST_Context::getDefaultFramebuffer ( )
inlineoverridevirtual

Gets the OpenGL frame-buffer associated with the OpenGL context

Returns
The ID of an OpenGL frame-buffer object.

Implements GHOST_IContext.

Reimplemented in GHOST_ContextD3D, and GHOST_ContextMTL.

Definition at line 141 of file GHOST_Context.hh.

◆ getSwapInterval()

virtual GHOST_TSuccess GHOST_Context::getSwapInterval ( int & )
inlinevirtual

Gets the current swap interval for #swapBuffers.

Parameters
interval_outVariable to store the swap interval if it can be read.
Returns
Whether the swap interval can be read.

Reimplemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

Definition at line 95 of file GHOST_Context.hh.

References GHOST_kFailure.

◆ getUserData()

void * GHOST_Context::getUserData ( )
inline

Get user data.

Definition at line 103 of file GHOST_Context.hh.

References user_data_.

◆ getVSync()

◆ initializeDrawingContext()

virtual GHOST_TSuccess GHOST_Context::initializeDrawingContext ( )
pure virtual

Call immediately after new to initialize. If this fails then immediately delete the object.

Returns
Indication as to whether initialization has succeeded.

Implemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

◆ isStereoVisual()

bool GHOST_Context::isStereoVisual ( ) const
inline

Stereo visual created. Only necessary for 'real' stereo support, ie quad buffered stereo. This is not always possible, depends on the graphics h/w

Definition at line 121 of file GHOST_Context.hh.

References context_params_.

◆ isUpsideDown()

virtual bool GHOST_Context::isUpsideDown ( ) const
inlinevirtual

Returns if the context is rendered upside down compared to OpenGL.

Reimplemented in GHOST_ContextD3D, and GHOST_ContextVK.

Definition at line 135 of file GHOST_Context.hh.

Referenced by GHOST_XrGraphicsBindingVulkan::needsUpsideDownDrawing().

◆ releaseDrawingContext()

GHOST_TSuccess GHOST_Context::releaseDrawingContext ( )
overridepure virtual

Release the drawing context of the calling thread.

Returns
A boolean success indicator.

Implements GHOST_IContext.

Implemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

◆ releaseNativeHandles()

virtual GHOST_TSuccess GHOST_Context::releaseNativeHandles ( )
pure virtual

Checks if it is OK for a remove the native display

Returns
Indication as to whether removal has succeeded.

Implemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

◆ setSwapInterval()

virtual GHOST_TSuccess GHOST_Context::setSwapInterval ( int )
inlinevirtual

Sets the swap interval for #swapBuffers.

Parameters
intervalThe swap interval to use.
Returns
A boolean success indicator.

Reimplemented in GHOST_ContextD3D, GHOST_ContextEGL, GHOST_ContextGLX, GHOST_ContextMTL, GHOST_ContextNone, GHOST_ContextSDL, GHOST_ContextVK, and GHOST_ContextWGL.

Definition at line 85 of file GHOST_Context.hh.

References GHOST_kFailure.

◆ setUserData()

void GHOST_Context::setUserData ( void * user_data)
inline

Set user data (intended for the caller to use as needed).

Definition at line 111 of file GHOST_Context.hh.

References user_data_.

◆ swapBufferAcquire()

GHOST_TSuccess GHOST_Context::swapBufferAcquire ( )
overridepure virtual

◆ swapBufferRelease()

GHOST_TSuccess GHOST_Context::swapBufferRelease ( )
overridepure virtual

◆ updateDrawingContext()

virtual GHOST_TSuccess GHOST_Context::updateDrawingContext ( )
inlinevirtual

Updates the drawing context of this window. Needed whenever the window is changed.

Returns
Indication of success.

Reimplemented in GHOST_ContextD3D, GHOST_ContextMTL, and GHOST_ContextNone.

Definition at line 69 of file GHOST_Context.hh.

References GHOST_kFailure.

Member Data Documentation

◆ active_context_

◆ context_params_

◆ user_data_

void* GHOST_Context::user_data_ = nullptr
protected

Caller specified, not for internal use.

Definition at line 175 of file GHOST_Context.hh.

Referenced by getUserData(), and setUserData().


The documentation for this class was generated from the following file: