Radium Engine
1.5.20
|
#include <Headless/OpenGLContext/OpenGLContext.hpp>
Public Member Functions | |
OpenGL context management | |
These methods allow to create and manipulate an openGLContext. Using this function, the openGL context created is an offscreen context with no exposed window. | |
OpenGLContext (const glbinding::Version &glVersion={ 4, 1 }, const std::array< int, 2 > &size={ { 1, 1 } }) | |
virtual | ~OpenGLContext ()=default |
destructor | |
virtual void | makeCurrent () const =0 |
make the context active | |
virtual void | doneCurrent () const =0 |
make the context inactive | |
virtual bool | isValid () const =0 |
Check for validity of the context. | |
virtual bool | isWindow () const |
Check if the context is associated to a window. | |
virtual std::string | getInfo () const |
Return a string identifying the openGL Context and its supported versions. | |
Protected Member Functions | |
virtual bool | processEvents () |
Process the pending events according to the window show mode. | |
void | resizeFrameBuffer (int width, int height) |
Resize callback. | |
void | keyboardEventCallback (int key, int scancode, int action, int mods) |
Keyboard callback. | |
void | mouseEventCallback (int button, int action, int mods, int x, int y) |
Mouse callback. | |
void | mouseMoveEventCallback (int x, int y) |
Mouse move callback. | |
void | scrollEventCallback (int xoffset, int yoffset) |
Scroll callback. | |
Protected Attributes | |
Ra::Core::Utils::Observable< int, int > | m_resizers |
Resize event observable. | |
Ra::Core::Utils::Observable< int, int, int, int > | m_keyboardObservers |
Keyboard event observable. | |
Ra::Core::Utils::Observable< int, int, int, int, int > | m_mouseObservers |
Mouse event observable. | |
Ra::Core::Utils::Observable< int, int > | m_mouseMoveObservers |
Mouse move event observable. | |
Ra::Core::Utils::Observable< int, int > | m_scrollObservers |
Scroll event observable. | |
EventMode | m_mode { EventMode::POLL } |
Event processing mode. | |
float | m_delay { 1.f / 60.f } |
Timeout delay for event processing. | |
Window management from an openGL context | |
These methods allow to display and interact with a simple window associated with the created OpenGL Context, if any. | |
enum class | EventMode : int { POLL = 0 , WAIT , TIMEOUT , NUM_MODES } |
Identify the event processing method when the window is exposed. More... | |
virtual void | show (EventMode, float) |
Show the window. | |
virtual void | hide () |
Hide the window. | |
virtual void | resize (const std::array< int, 2 > &) |
Resize the window. | |
virtual void | renderLoop (std::function< void(float)>) |
loop on events and execute the functor render after each event | |
Ra::Core::Utils::Observable< int, int > & | resizeListener () |
Ra::Core::Utils::Observable< int, int, int, int > & | keyboardListener () |
Ra::Core::Utils::Observable< int, int, int, int, int > & | mouseListener () |
Ra::Core::Utils::Observable< int, int > & | mouseMoveListener () |
Ra::Core::Utils::Observable< int, int > & | scrollListener () |
This class defines the interface for any off-screen OpenGL Context. There are two use cases of such a context :
Definition at line 22 of file OpenGLContext.hpp.
|
strong |
Identify the event processing method when the window is exposed.
Definition at line 68 of file OpenGLContext.hpp.
|
inlineexplicit |
Create an offscreen openGl context. The created context has the following properties
glVersion | (optional, default is 4.1) indicates the OpenGL version the context MUST be compatible with. If there is no compatible context, the application will stop |
size |
Definition at line 41 of file OpenGLContext.hpp.
|
inlinenodiscardvirtual |
Return a string identifying the openGL Context and its supported versions.
Definition at line 164 of file OpenGLContext.hpp.
|
inlinevirtual |
Hide the window.
Definition at line 72 of file OpenGLContext.hpp.
|
inlinevirtual |
Check if the context is associated to a window.
Definition at line 56 of file OpenGLContext.hpp.
|
inlineprotected |
Keyboard callback.
Definition at line 184 of file OpenGLContext.hpp.
|
inline |
Give access to the keyboard event observable so that client can add Observer to this event.
The parameters sent to the keyboard listeners are the keyboard key, platform-specific scancode, key action and modifier bits.
Definition at line 95 of file OpenGLContext.hpp.
|
inlineprotected |
Mouse callback.
Definition at line 188 of file OpenGLContext.hpp.
|
inline |
Give access to the mouse event observable so that client can add Observer to this event.
The parameters sent to the mouse listeners are the mouse button, button action and modifier bits as well as the mouse position in pixel unit and in the FrameBuffer space. The origin is at the top left of the framebuffer.
Definition at line 107 of file OpenGLContext.hpp.
|
inlineprotected |
Mouse move callback.
Definition at line 192 of file OpenGLContext.hpp.
|
inline |
Give access to the mouse move event observable so that client can add Observer to this event.
The parameters sent to the mouse move listeners are the mouse position in pixel unit and in the FrameBuffer space. The origin is at the top left of the framebuffer.
Definition at line 118 of file OpenGLContext.hpp.
|
inlineprotectedvirtual |
Process the pending events according to the window show mode.
Definition at line 131 of file OpenGLContext.hpp.
|
inlinevirtual |
loop on events and execute the functor render after each event
Definition at line 76 of file OpenGLContext.hpp.
|
inlinevirtual |
Resize the window.
Definition at line 74 of file OpenGLContext.hpp.
|
inlineprotected |
Resize callback.
Definition at line 179 of file OpenGLContext.hpp.
|
inline |
Give access to the resize event observable so that client can add Observer to this event.
The parameters sent to the resize listeners are in pixels and correspond to the OpenGL Framebuffer size (i.e. the size given to glViewport function)
Definition at line 84 of file OpenGLContext.hpp.
|
inlineprotected |
Scroll callback.
Definition at line 196 of file OpenGLContext.hpp.
|
inline |
Give access to the scroll event observable so that client can add Observer to this event.
The parameters sent to the scroll listeners are two-dimensional scroll offsets in pixel unit and in the FrameBuffer space.
Definition at line 126 of file OpenGLContext.hpp.
|
inlinevirtual |
Show the window.
Definition at line 70 of file OpenGLContext.hpp.
|
protected |
Timeout delay for event processing.
Definition at line 161 of file OpenGLContext.hpp.
|
protected |
Keyboard event observable.
Definition at line 141 of file OpenGLContext.hpp.
|
protected |
Event processing mode.
Definition at line 159 of file OpenGLContext.hpp.
|
protected |
Mouse move event observable.
Definition at line 151 of file OpenGLContext.hpp.
|
protected |
Mouse event observable.
Definition at line 146 of file OpenGLContext.hpp.
|
protected |
Resize event observable.
Definition at line 136 of file OpenGLContext.hpp.
|
protected |
Scroll event observable.
Definition at line 156 of file OpenGLContext.hpp.