SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::GLContextRef Struct Reference

Handle to a non owned gLContext. More...

Inheritance diagram for SDL::GLContextRef:
Inheritance graph
[legend]

Public Member Functions

constexpr GLContextRef (const GLContextRef &other)
 Copy constructor.
 
constexpr GLContextRef (GLContextRef &&other)
 Move constructor.
 
constexpr ~GLContextRef ()=default
 Default constructor.
 
GLContextRefoperator= (GLContextRef other)
 Assignment operator.
 
bool reset (SDL_GLContextState *newResource={})
 Delete an OpenGL context.
 
 GLContextBase (WindowBase &window)
 Create an OpenGL context for an OpenGL window, and make it current.
 
- Public Member Functions inherited from SDL::GLContextBase
 GLContextBase (WindowBase &window)
 Create an OpenGL context for an OpenGL window, and make it current.
 
void MakeCurrent (WindowBase &window)
 Set up an OpenGL context for rendering into an OpenGL window.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_GLContextState * >
constexpr Resource (SDL_GLContextState * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_GLContextState * get () const
 Return contained resource;.
 
constexpr SDL_GLContextState * release (SDL_GLContextState * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_GLContextState * operator-> () const
 Access to fields.
 
constexpr SDL_GLContextState * operator-> ()
 Access to fields.
 

Detailed Description

Category:
Resource
See also
GLContextBase
GLContext

Member Function Documentation

◆ GLContextBase()

SDL::GLContextBase::GLContextBase ( WindowBase window)
inline

Windows users new to OpenGL should note that, for historical reasons, GL functions added after OpenGL version 1.1 are not available by default. Those functions must be loaded at run-time, either with an OpenGL extension-handling library or with GL_GetProcAddress() and its related functions.

GLContextBase is opaque to the application.

Parameters
windowthe window to associate with the context.
Postcondition
the OpenGL context associated with window.
Exceptions
Erroron failure.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContextRef.reset
GLContextBase.MakeCurrent

◆ reset()

bool SDL::GLContextRef::reset ( SDL_GLContextState *  newResource = {})
inline
Returns
true on success or false on failure; call GetError() for more information.
Thread safety:
This function should only be called on the main thread.
Since
This function is available since SDL 3.2.0.
See also
GLContextBase.GLContextBase

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