SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::GLContextScoped Struct Reference

RAII owning version GLContext. More...

Inheritance diagram for SDL::GLContextScoped:
[legend]

Public Member Functions

constexpr GLContextScoped (const GLContextScoped &other)=delete
constexpr GLContextScoped (GLContextScoped &&other) noexcept
 Move constructor.
constexpr GLContextScoped (GLContext &&other) noexcept
 Move constructor.
 ~GLContextScoped ()
 Destructor.
 GLContext (WindowRef window)
 Create an OpenGL context for an OpenGL window, and make it current.
Public Member Functions inherited from SDL::GLContext
 GLContext (WindowRef window)
 Create an OpenGL context for an OpenGL window, and make it current.
constexpr operator GLContextRaw () const noexcept
 Converts to underlying GLContextRaw.
void Destroy ()
 Delete an OpenGL context.
void MakeCurrent (WindowRef window)
 Set up an OpenGL context for rendering into an OpenGL window.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< GLContextRaw >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< GLContextRaw >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

RAII owning version GLContext.

Member Function Documentation

◆ GLContext()

Create an OpenGL context for an OpenGL window, and make it current.

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: