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

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

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

Public Member Functions

void MakeCurrent (WindowRef window)
 Set up an OpenGL context for rendering into an OpenGL window.
 
constexpr Resource (T resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< T > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
- Public Member Functions inherited from SDL::Resource< SDL_GLContextState * >
constexpr Resource (SDL_GLContextState * resource={})
 Constructs from the underlying resource.
 
constexpr Resource (const ResourceHandle< Resource< SDL_GLContextState * > > auto &resource)
 Constructs from pointer like.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr operator value_type () const
 Converts back to underlying type.
 
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 const SDL_GLContextState * operator-> () const
 Access to fields.
 
constexpr SDL_GLContextState * operator-> ()
 Access to fields.
 

Static Public Member Functions

static void reset (SDL_GLContextState *resource)
 Delete an OpenGL context.
 

Additional Inherited Members

- Public Types inherited from SDL::Resource< SDL_GLContextState * >
using value_type = SDL_GLContextState *
 The raw resource type.
 

Detailed Description

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

Member Function Documentation

◆ MakeCurrent()

void SDL::GLContextRef::MakeCurrent ( WindowRef  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
GLContext.GLContext

◆ reset()

static void SDL::GLContextRef::reset ( SDL_GLContextState *  resource)
inlinestatic
Parameters
resourcethe OpenGL context to be deleted.
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
GLContext.Create

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