cpp-sdl2
C++ header-only SDL2 wrapper
sdl::Window::GlContext Class Reference

Nested class that represent a managed OpenGL Context by the SDL. More...

#include <window.hpp>

Public Member Functions

 GlContext (SDL_Window *w)
 Create a GlContext for the given window. More...
 
 GlContext ()=default
 Construct an invalid GLContext object where you will need to move a new one. More...
 
 ~GlContext ()
 Dtor will call SDL_GL_DeleteContext on the enclosed context. More...
 
 GlContext (GlContext const &)=delete
 
GlContextoperator= (GlContext const &)=delete
 
 GlContext (GlContext &&other) noexcept
 
GlContextoperator= (GlContext &&other) noexcept
 
void make_current () const
 
SDL_GLContext ptr () const
 

Private Attributes

SDL_GLContext context_ = nullptr
 
SDL_Window * owner_ = nullptr
 

Detailed Description

Nested class that represent a managed OpenGL Context by the SDL.

Definition at line 340 of file window.hpp.

Constructor & Destructor Documentation

◆ GlContext() [1/4]

sdl::Window::GlContext::GlContext ( SDL_Window *  w)
inline

Create a GlContext for the given window.

You should use sdl::Window::gl_create_context() instead of this

Definition at line 345 of file window.hpp.

◆ GlContext() [2/4]

sdl::Window::GlContext::GlContext ( )
default

Construct an invalid GLContext object where you will need to move a new one.

◆ ~GlContext()

sdl::Window::GlContext::~GlContext ( )
inline

Dtor will call SDL_GL_DeleteContext on the enclosed context.

Definition at line 354 of file window.hpp.

References sdl::Window::operator=().

◆ GlContext() [3/4]

sdl::Window::GlContext::GlContext ( GlContext const &  )
delete

◆ GlContext() [4/4]

sdl::Window::GlContext::GlContext ( GlContext &&  other)
inlinenoexcept

Definition at line 360 of file window.hpp.

Member Function Documentation

◆ make_current()

void sdl::Window::GlContext::make_current ( ) const
inline

Definition at line 373 of file window.hpp.

◆ operator=() [1/2]

GlContext& sdl::Window::GlContext::operator= ( GlContext const &  )
delete

◆ operator=() [2/2]

GlContext& sdl::Window::GlContext::operator= ( GlContext &&  other)
inlinenoexcept

Definition at line 362 of file window.hpp.

References context_.

◆ ptr()

SDL_GLContext sdl::Window::GlContext::ptr ( ) const
inline

Definition at line 378 of file window.hpp.

Member Data Documentation

◆ context_

SDL_GLContext sdl::Window::GlContext::context_ = nullptr
private

Definition at line 381 of file window.hpp.

Referenced by operator=().

◆ owner_

SDL_Window* sdl::Window::GlContext::owner_ = nullptr
private

Definition at line 382 of file window.hpp.


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