Gamp v0.0.7-36-g24b1eb6
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
gamp::render::gl::GLContext Class Reference

OpenGL Rendering Context. More...

#include <GLContext.hpp>

Inheritance diagram for gamp::render::gl::GLContext:
Collaboration diagram for gamp::render::gl::GLContext:

Classes

struct  Private
 

Public Member Functions

 GLContext (Private) noexcept
 Private: Create an invalid instance.
 
 GLContext (Private, const wt::SurfaceRef &surface, gamp::handle_t context, GLProfile profile, RenderContextFlags contextFlags, GLVersionNumber glVersion) noexcept
 Private: Create a new instance of a current context.
 
 GLContext (Private, gamp::handle_t context, GLProfile profile, RenderContextFlags contextFlags, GLVersionNumber glVersion) noexcept
 Private: Create a new instance of a non-current context.
 
 ~GLContext () noexcept override
 
void dispose () noexcept override
 
void disposedNotify () override
 
constexpr const GLProfileglProfile () const noexcept
 
constexpr const GLVersionNumberglVersion () const
 
bool isCurrent () const noexcept
 
bool isExtensionAvailable (const char *name) const noexcept
 
bool isExtensionAvailable (GLenum name) const noexcept
 
bool makeCurrent (const gamp::wt::SurfaceRef &s) noexcept override
 Make this context current (used for OpenGL, but a NOP on Vulkan)
 
void releaseContext () noexcept override
 Release this context (used for OpenGL, but a NOP on Vulkan)
 
constexpr const RenderProfilerenderProfile () const noexcept override
 
const jau::type_infosignature () const noexcept override
 
std::string toString () const override
 
- Public Member Functions inherited from gamp::render::RenderContext
 RenderContext (Private) noexcept
 Private: Create an invalid instance.
 
 RenderContext (Private, gamp::handle_t context, RenderContextFlags contextFlags, const jau::util::VersionNumber &version) noexcept
 Private: Create an instance.
 
virtual ~RenderContext () noexcept=default
 
AttachableRef attachObject (std::string_view key, const AttachableRef &obj)
 Attaches user object for the given name, overwrites old mapping if exists.
 
const gamp::wt::SurfaceRefboundSurface () const noexcept
 
void clearAttachedObjects ()
 Clears the attachment map.
 
constexpr gamp::handle_t context () const noexcept
 
constexpr RenderContextFlags contextFlags () const noexcept
 
AttachableRef detachObject (std::string_view key)
 Removes attached object if exists and returns it, otherwise returns nullptr.
 
AttachableRef getAttachedObject (std::string_view key) const
 Returns the attached user object for the given name.
 
constexpr bool isValid () const noexcept
 
constexpr const jau::util::VersionNumberversion () const
 

Static Public Member Functions

static RenderContextPtr create (const wt::SurfaceRef &surface, gamp::handle_t context, GLProfile profile, RenderContextFlags contextFlags, const char *gl_version_cstr) noexcept
 Create a new instance of a current.
 
static RenderContextPtr create (gamp::handle_t context, GLProfile profile, RenderContextFlags contextFlags, const char *gl_version_cstr) noexcept
 Create a new instance of a non-current context.
 
static GLContextdowncast (RenderContext *rc)
 Downcast dereferenced given RenderContext* to GLContext&, throws exception if signature doesn't match GLSignature()
 
static GLContextgetCurrent () noexcept
 Return thread local GLContext or an invalid GLContext, see isValid()
 
static GLContextgetInvalid () noexcept
 Returns an invalid GLContext reference.
 
static const jau::type_infoGLSignature () noexcept
 

Additional Inherited Members

- Protected Attributes inherited from gamp::render::RenderContext
gamp::wt::SurfaceRef m_surface
 

Detailed Description

OpenGL Rendering Context.

Definition at line 423 of file GLContext.hpp.

Constructor & Destructor Documentation

◆ GLContext() [1/3]

gamp::render::gl::GLContext::GLContext ( Private )
inlinenoexcept

Private: Create an invalid instance.

Definition at line 437 of file GLContext.hpp.

Here is the caller graph for this function:

◆ GLContext() [2/3]

gamp::render::gl::GLContext::GLContext ( Private ,
gamp::handle_t context,
GLProfile profile,
RenderContextFlags contextFlags,
GLVersionNumber glVersion )
inlinenoexcept

Private: Create a new instance of a non-current context.

Given profile tag must be one of this class' constant GL profiles.

Definition at line 440 of file GLContext.hpp.

◆ GLContext() [3/3]

gamp::render::gl::GLContext::GLContext ( Private ,
const wt::SurfaceRef & surface,
gamp::handle_t context,
GLProfile profile,
RenderContextFlags contextFlags,
GLVersionNumber glVersion )
inlinenoexcept

Private: Create a new instance of a current context.

Given profile tag must be one of this class' constant GL profiles.

Definition at line 446 of file GLContext.hpp.

◆ ~GLContext()

gamp::render::gl::GLContext::~GLContext ( )
inlineoverridenoexcept

Definition at line 455 of file GLContext.hpp.

Member Function Documentation

◆ create() [1/2]

static RenderContextPtr gamp::render::gl::GLContext::create ( gamp::handle_t context,
GLProfile profile,
RenderContextFlags contextFlags,
const char * gl_version_cstr )
inlinestaticnoexcept

Create a new instance of a non-current context.

Given profile tag must be one of this class' constant GL profiles.

Definition at line 462 of file GLContext.hpp.

Here is the caller graph for this function:

◆ create() [2/2]

static RenderContextPtr gamp::render::gl::GLContext::create ( const wt::SurfaceRef & surface,
gamp::handle_t context,
GLProfile profile,
RenderContextFlags contextFlags,
const char * gl_version_cstr )
inlinestaticnoexcept

Create a new instance of a current.

Given profile tag must be one of this class' constant GL profiles.

Definition at line 468 of file GLContext.hpp.

◆ signature()

const jau::type_info & gamp::render::gl::GLContext::signature ( ) const
inlineoverridevirtualnoexcept

Reimplemented from gamp::render::RenderContext.

Definition at line 474 of file GLContext.hpp.

◆ GLSignature()

static const jau::type_info & gamp::render::gl::GLContext::GLSignature ( )
inlinestaticnoexcept

Definition at line 475 of file GLContext.hpp.

Here is the caller graph for this function:

◆ renderProfile()

const RenderProfile & gamp::render::gl::GLContext::renderProfile ( ) const
inlineconstexproverridevirtualnoexcept

Reimplemented from gamp::render::RenderContext.

Definition at line 477 of file GLContext.hpp.

◆ glProfile()

const GLProfile & gamp::render::gl::GLContext::glProfile ( ) const
inlineconstexprnoexcept

Definition at line 478 of file GLContext.hpp.

Here is the caller graph for this function:

◆ glVersion()

const GLVersionNumber & gamp::render::gl::GLContext::glVersion ( ) const
inlineconstexpr

Definition at line 480 of file GLContext.hpp.

Here is the caller graph for this function:

◆ getInvalid()

static GLContext & gamp::render::gl::GLContext::getInvalid ( )
inlinestaticnoexcept

Returns an invalid GLContext reference.

Definition at line 483 of file GLContext.hpp.

Here is the caller graph for this function:

◆ downcast()

static GLContext & gamp::render::gl::GLContext::downcast ( RenderContext * rc)
inlinestatic

Downcast dereferenced given RenderContext* to GLContext&, throws exception if signature doesn't match GLSignature()

Examples
GearsES2.hpp, GraphShapes01.cpp, Primitives02.cpp, and RedSquareES2.hpp.

Definition at line 488 of file GLContext.hpp.

Here is the caller graph for this function:

◆ getCurrent()

static GLContext & gamp::render::gl::GLContext::getCurrent ( )
inlinestaticnoexcept

Return thread local GLContext or an invalid GLContext, see isValid()

Definition at line 499 of file GLContext.hpp.

◆ makeCurrent()

bool gamp::render::gl::GLContext::makeCurrent ( const gamp::wt::SurfaceRef & s)
inlineoverridevirtualnoexcept

Make this context current (used for OpenGL, but a NOP on Vulkan)

Reimplemented from gamp::render::RenderContext.

Definition at line 505 of file GLContext.hpp.

◆ releaseContext()

void gamp::render::gl::GLContext::releaseContext ( )
inlineoverridevirtualnoexcept

Release this context (used for OpenGL, but a NOP on Vulkan)

Reimplemented from gamp::render::RenderContext.

Definition at line 513 of file GLContext.hpp.

Here is the caller graph for this function:

◆ isCurrent()

bool gamp::render::gl::GLContext::isCurrent ( ) const
inlinenoexcept

Definition at line 518 of file GLContext.hpp.

Here is the caller graph for this function:

◆ isExtensionAvailable() [1/2]

bool gamp::render::gl::GLContext::isExtensionAvailable ( GLenum name) const
inlinenoexcept

Definition at line 520 of file GLContext.hpp.

◆ isExtensionAvailable() [2/2]

bool gamp::render::gl::GLContext::isExtensionAvailable ( const char * name) const
inlinenoexcept

Definition at line 524 of file GLContext.hpp.

◆ dispose()

void render::gl::GLContext::dispose ( )
overridevirtualnoexcept

Reimplemented from gamp::render::RenderContext.

Definition at line 219 of file gamp_sdl2_gl.cpp.

◆ disposedNotify()

void gamp::render::gl::GLContext::disposedNotify ( )
inlineoverridevirtual

Reimplemented from gamp::render::RenderContext.

Definition at line 531 of file GLContext.hpp.

Here is the caller graph for this function:

◆ toString()

std::string gamp::render::gl::GLContext::toString ( ) const
inlineoverridevirtual

Reimplemented from gamp::render::RenderContext.

Definition at line 538 of file GLContext.hpp.

Here is the caller graph for this function:

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