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

An opaque handle to an OpenGL context. More...

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

Public Member Functions

 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

Since
This datatype is available since SDL 3.2.0.
See also
GLContextBase.GLContextBase
Category:
Resource
See also
GLContext
GLContextRef

Constructor & Destructor 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

Member Function Documentation

◆ MakeCurrent()

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

The context must have been created with a compatible window.

Parameters
windowthe window to associate with the context.
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
GLContextBase.GLContextBase

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