libmx2 2.2.1
C++20 multimedia and game-engine library (SDL2 / OpenGL / Vulkan)
Loading...
Searching...
No Matches
gl::GLObject Class Referenceabstract

Abstract interface for scene objects managed by a GLWindow. More...

#include <gl.hpp>

Public Member Functions

 GLObject ()=default
virtual ~GLObject ()=default
virtual void load (GLWindow *win)=0
 Load GPU resources (textures, shaders, geometry).
virtual void draw (GLWindow *win)=0
 Render the scene for the current frame.
virtual void event (GLWindow *window, SDL_Event &e)=0
 Handle an SDL event.
virtual void resize (gl::GLWindow *win, int w, int h)
 Called when the window is resized (optional).

Detailed Description

Abstract interface for scene objects managed by a GLWindow.

Derived classes implement load(), draw(), event(), and optionally resize() to participate in the GLWindow render/event loop. Attach an instance via GLWindow::setObject().

Definition at line 593 of file gl.hpp.

Constructor & Destructor Documentation

◆ GLObject()

gl::GLObject::GLObject ( )
default

◆ ~GLObject()

virtual gl::GLObject::~GLObject ( )
virtualdefault

Member Function Documentation

◆ draw()

virtual void gl::GLObject::draw ( GLWindow * win)
pure virtual

Render the scene for the current frame.

Parameters
winParent window.

◆ event()

virtual void gl::GLObject::event ( GLWindow * window,
SDL_Event & e )
pure virtual

Handle an SDL event.

Parameters
windowParent window.
eSDL event.

◆ load()

virtual void gl::GLObject::load ( GLWindow * win)
pure virtual

Load GPU resources (textures, shaders, geometry).

Parameters
winParent window.

◆ resize()

virtual void gl::GLObject::resize ( gl::GLWindow * win,
int w,
int h )
inlinevirtual

Called when the window is resized (optional).

Parameters
winParent window.
wNew width.
hNew height.

Definition at line 623 of file gl.hpp.


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