Kanzi 4.0.0-beta2
kanzi::platform::OpenGLPlatform Class Referenceabstract

The OpenGL platform interface that is used by the OpenGL backend to interact with the platform. More...

#include <kanzi/platform/platform/context/opengl_platform.hpp>

Classes

struct  InitializationInfo
 The initialization parameters for the OpenGL platform. More...
 
struct  SurfaceContextHandle
 The SurfaceContext handle is used to identify an OpenGL context that is used by the rendering thread. More...
 
struct  SurfaceHandle
 The Surface handle is used to identify a platform surface that can be used as a target for OpenGL rendering. More...
 
struct  ThreadContextHandle
 The ThreadContext handle is used to identify an OpenGL context that is used by user threads to perform OpenGL operations on behalf of the rendering thread. More...
 

Public Member Functions

virtual SurfaceHandle createSurface (NativeSurfaceHandle windowHandle, const SurfaceProperties &properties)=0
 Creates a new Surface, potentially a new GL Context for the surface.
 
virtual ThreadContextHandle createThreadContext ()=0
 Creates a new headless OpenGL context that is shared with the default context.
 
virtual bool destroySurface (SurfaceHandle surface)=0
 Destroy a created SurfaceHandle.
 
virtual void destroyThreadContext (ThreadContextHandle context)=0
 Destroys the Thread context.
 
virtual SurfaceContextHandle getCurrentSurfaceContext ()=0
 Gets the currently active SurfaceContextHandle.
 
virtual voidgetOGLProcAddress (const char *name)=0
 Gets the address of an OpenGL entry point.
 
virtual SurfaceContextHandle getSurfaceGLContext (SurfaceHandle surface)=0
 Gets the SurfaceContextHandle associated with the given surface.
 
virtual SurfaceProperties getSurfaceProperties (SurfaceHandle surface)=0
 Gets the SurfaceProperties for a given SurfaceHandle object.
 
virtual vector< SurfaceHandlegetSurfaces (SurfaceContextHandle context)=0
 Gets the surfaces associated with a context.
 
virtual void initializePlatform ()=0
 Initializes the OpenGL Platform API and creates a default headless SurfaceContext that can be used for off screen rendering.
 
virtual bool isFeatureEnabled (PlatformFeatureId feature)=0
 Tests if a platform FeatureId is enabled on the current platform.
 
virtual void makeSurfaceCurrent (SurfaceHandle surface)=0
 Makes the requested SurfaceHandle current.
 
virtual void makeThreadCurrent (ThreadContextHandle context)=0
 Makes the ThreadContextHandle active on the current thread.
 
virtual void shutdownPlatform ()=0
 Shuts down the OpenGL platform API.
 
virtual bool swapBuffers (SurfaceHandle surface)=0
 Swaps the buffers associated with the SurfaceHandle.
 
virtual ~OpenGLPlatform ()=default
 Destructor.
 

Detailed Description

The OpenGL platform interface that is used by the OpenGL backend to interact with the platform.

Since
Kanzi 4.0.0

Constructor & Destructor Documentation

◆ ~OpenGLPlatform()

virtual kanzi::platform::OpenGLPlatform::~OpenGLPlatform ( )
virtualdefault

Destructor.

Member Function Documentation

◆ initializePlatform()

virtual void kanzi::platform::OpenGLPlatform::initializePlatform ( )
pure virtual

Initializes the OpenGL Platform API and creates a default headless SurfaceContext that can be used for off screen rendering.

The newly created context is made current on the calling thread.

◆ shutdownPlatform()

virtual void kanzi::platform::OpenGLPlatform::shutdownPlatform ( )
pure virtual

Shuts down the OpenGL platform API.

This will invalidate all SurfaceHandle, SurfaceContextHandle, and ThreadContextHandle instances. After this call, it is possible to call initializePlatform again.

◆ swapBuffers()

virtual bool kanzi::platform::OpenGLPlatform::swapBuffers ( SurfaceHandle surface)
pure virtual

Swaps the buffers associated with the SurfaceHandle.

Parameters
surfaceThe surface will be swapped.
Returns
true if the operation was successful.

◆ createThreadContext()

virtual ThreadContextHandle kanzi::platform::OpenGLPlatform::createThreadContext ( )
pure virtual

Creates a new headless OpenGL context that is shared with the default context.

Returns
The newly created ThreadContextHandle.

◆ destroyThreadContext()

virtual void kanzi::platform::OpenGLPlatform::destroyThreadContext ( ThreadContextHandle context)
pure virtual

Destroys the Thread context.

Parameters
contextThe thread context to be destroyed.

◆ createSurface()

virtual SurfaceHandle kanzi::platform::OpenGLPlatform::createSurface ( NativeSurfaceHandle windowHandle,
const SurfaceProperties & properties )
pure virtual

Creates a new Surface, potentially a new GL Context for the surface.

Also calls makeSurfaceCurrent on the new surface.

If the default context is compatible with this surface, the default context should be used. If a new context is required, the OpenGL backend will still function, but may result in reduced performance.

Parameters
windowHandleOpaque platform specific window handle.
propertiesThe requested surface properties.
Returns
The newly created surface handle.

◆ destroySurface()

virtual bool kanzi::platform::OpenGLPlatform::destroySurface ( SurfaceHandle surface)
pure virtual

Destroy a created SurfaceHandle.

Parameters
surfaceThe surface handle to destroy.
Returns
If the surface was found and destroyed, true, otherwise false.

◆ getSurfaceProperties()

virtual SurfaceProperties kanzi::platform::OpenGLPlatform::getSurfaceProperties ( SurfaceHandle surface)
pure virtual

Gets the SurfaceProperties for a given SurfaceHandle object.

Parameters
surfaceThe surface handle to query.
Returns
The actual surface properties of the created surface.

◆ getSurfaceGLContext()

virtual SurfaceContextHandle kanzi::platform::OpenGLPlatform::getSurfaceGLContext ( SurfaceHandle surface)
pure virtual

Gets the SurfaceContextHandle associated with the given surface.

If the SurfaceHandle is the empty surface, the SurfaceContextHandle for the default context is returned.

Parameters
surfaceThe surface handle.
Returns
The surface context handle.

◆ makeSurfaceCurrent()

virtual void kanzi::platform::OpenGLPlatform::makeSurfaceCurrent ( SurfaceHandle surface)
pure virtual

Makes the requested SurfaceHandle current.

If the surface is the empty surface, the default context is made active. If a compatible context is already active, no changes are made.

Parameters
surfaceThe surface handle to make current.

◆ getCurrentSurfaceContext()

virtual SurfaceContextHandle kanzi::platform::OpenGLPlatform::getCurrentSurfaceContext ( )
pure virtual

Gets the currently active SurfaceContextHandle.

Returns
The currently active surface context handle.

◆ getSurfaces()

virtual vector< SurfaceHandle > kanzi::platform::OpenGLPlatform::getSurfaces ( SurfaceContextHandle context)
pure virtual

Gets the surfaces associated with a context.

Parameters
contextThe context to query.
Returns
A list of surface handles associated with the context.

◆ getOGLProcAddress()

virtual void * kanzi::platform::OpenGLPlatform::getOGLProcAddress ( const char * name)
pure virtual

Gets the address of an OpenGL entry point.

Parameters
nameThe name of the entry point.
Returns
The pointer to the OpenGL entry point.

◆ makeThreadCurrent()

virtual void kanzi::platform::OpenGLPlatform::makeThreadCurrent ( ThreadContextHandle context)
pure virtual

Makes the ThreadContextHandle active on the current thread.

Must be on non-rendering threads.

Calling makeThreadCurrent with a default constructed ThreadContextHandle will release the context from the current thread and leave no context current.

Parameters
contextThe thread context to make current.

◆ isFeatureEnabled()

virtual bool kanzi::platform::OpenGLPlatform::isFeatureEnabled ( PlatformFeatureId feature)
pure virtual

Tests if a platform FeatureId is enabled on the current platform.

Parameters
featureThe FeatureId to test.
Returns
True if the feature is supported, else false.

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