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

RAII owning version GLContext.

Inheritance diagram for SDL::GLContextScoped:
Inheritance graph
[legend]
Collaboration diagram for SDL::GLContextScoped:
Collaboration graph
[legend]

Public Member Functions

constexpr GLContextScoped (const GLContext &other)=delete
 
constexpr GLContextScoped (GLContext &&other) noexcept
 Move constructor.
 
 ~GLContextScoped ()
 Destructor.
 
constexpr GLContext (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr GLContext (const GLContextRaw resource) noexcept
 Constructs from GLContextParam. More...
 
constexpr GLContext (const GLContext &other) noexcept=default
 Copy constructor.
 
constexpr GLContext (GLContext &&other) noexcept
 Move constructor.
 
 GLContext (WindowParam window)
 Create an OpenGL context for an OpenGL window, and make it current. More...
 
- Public Member Functions inherited from SDL::GLContext
constexpr GLContext (std::nullptr_t=nullptr) noexcept
 Default ctor.
 
constexpr GLContext (const GLContextRaw resource) noexcept
 Constructs from GLContextParam. More...
 
constexpr GLContext (const GLContext &other) noexcept=default
 Copy constructor.
 
constexpr GLContext (GLContext &&other) noexcept
 Move constructor.
 
 GLContext (WindowParam window)
 Create an OpenGL context for an OpenGL window, and make it current. More...
 
 ~GLContext ()
 Destructor.
 
constexpr GLContextoperator= (GLContext &&other) noexcept
 Assignment operator.
 
constexpr GLContextoperator= (const GLContext &other) noexcept=default
 Assignment operator.
 
constexpr GLContextRaw get () const noexcept
 Retrieves underlying GLContextRaw.
 
constexpr GLContextRaw release () noexcept
 Retrieves underlying GLContextRaw and clear this.
 
constexpr auto operator<=> (const GLContext &other) const noexcept=default
 Comparison.
 
constexpr operator bool () const noexcept
 Converts to bool.
 
constexpr operator GLContextParam () const noexcept
 Converts to GLContextParam.
 
void Destroy ()
 Delete an OpenGL context. More...
 
void MakeCurrent (WindowParam window)
 Set up an OpenGL context for rendering into an OpenGL window. More...
 

Member Function Documentation

◆ GLContext() [1/2]

constexpr SDL::GLContext::GLContext ( const GLContextRaw  resource)
inlineconstexprnoexcept
Parameters
resourcea GLContextRaw to be wrapped.

◆ GLContext() [2/2]

SDL::GLContext::GLContext ( WindowParam  window)
inline

The OpenGL context will be created with the current states set through GL_SetAttribute().

The Window specified must have been created with the WINDOW_OPENGL flag, or context creation will fail.

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.

GLContext is opaque to the application.

Parameters
windowthe window to associate with the context.
Postcondition
the OpenGL context associated with window or nullptr 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
GLContext.Destroy
GLContext.MakeCurrent

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