MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ogl::Context Class Referenceabstract

Abstraction of a rendering context/viewport that displays renderings. More...

#include <context.h>

Public Member Functions

virtual ~Context (void)
 
int get_height (void) const
 Returns the height of the viewport.
 
int get_width (void) const
 Returns the width of the viewport.
 
void init (void)
 Initializes the context.
 
virtual bool keyboard_event (KeyboardEvent const &event)
 Injects a keyboard event to the context.
 
virtual bool mouse_event (MouseEvent const &event)
 Injects a mouse event to the context.
 
void paint (void)
 Paints the frame.
 
void resize (int new_width, int new_height)
 Resizes the context.
 

Protected Member Functions

virtual void init_impl (void)=0
 Overwrite to define actions on init.
 
virtual void paint_impl (void)=0
 Overwrite to define actions on paint.
 
virtual void resize_impl (int old_width, int old_height)=0
 Overwrite to define actions on resize.
 

Protected Attributes

int height
 
int width
 

Detailed Description

Abstraction of a rendering context/viewport that displays renderings.

This class is to abstract from the actual system that creates the OpenGL context and delivers the events, for example GLX/X11, QT, GTK, etc. Creating the OpenGL rendering context is out of scope of this class. Also, creating the event loop / main loop is task of the controlling system.

The context can be init'ed, resized and repeatedly painted. Mouse and keyboard events can be injected for the implementation to react on.

Definition at line 35 of file context.h.

Constructor & Destructor Documentation

◆ ~Context()

ogl::Context::~Context ( void  )
inlinevirtual

Definition at line 122 of file context.h.

Member Function Documentation

◆ get_height()

int ogl::Context::get_height ( void  ) const
inline

Returns the height of the viewport.

Definition at line 167 of file context.h.

◆ get_width()

int ogl::Context::get_width ( void  ) const
inline

Returns the width of the viewport.

Definition at line 161 of file context.h.

◆ init()

void ogl::Context::init ( void  )
inline

Initializes the context.

Definition at line 127 of file context.h.

◆ init_impl()

virtual void ogl::Context::init_impl ( void  )
protectedpure virtual

Overwrite to define actions on init.

◆ keyboard_event()

bool ogl::Context::keyboard_event ( KeyboardEvent const &  event)
inlinevirtual

Injects a keyboard event to the context.

Default implementation prints debug information only.

Reimplemented in ogl::CameraContext< CTRL >.

Definition at line 154 of file context.h.

◆ mouse_event()

bool ogl::Context::mouse_event ( MouseEvent const &  event)
inlinevirtual

Injects a mouse event to the context.

Default implementation prints debug information only.

Reimplemented in ogl::CameraContext< CTRL >.

Definition at line 147 of file context.h.

◆ paint()

void ogl::Context::paint ( void  )
inline

Paints the frame.

Definition at line 141 of file context.h.

◆ paint_impl()

virtual void ogl::Context::paint_impl ( void  )
protectedpure virtual

Overwrite to define actions on paint.

◆ resize()

void ogl::Context::resize ( int  new_width,
int  new_height 
)
inline

Resizes the context.

Definition at line 133 of file context.h.

◆ resize_impl()

virtual void ogl::Context::resize_impl ( int  old_width,
int  old_height 
)
protectedpure virtual

Overwrite to define actions on resize.

Implemented in ogl::CameraContext< CTRL >.

Member Data Documentation

◆ height

int ogl::Context::height
protected

Definition at line 74 of file context.h.

◆ width

int ogl::Context::width
protected

Definition at line 73 of file context.h.


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