Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
#include <OpenGLContext.hpp>

Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| OpenGLContext (int w=0, int h=0) | |
| Constructor. | |
| ~OpenGLContext () | |
| Destructor. | |
| void | initExtensions (bool log=true) |
| Initializes the supported OpenGL extensions. | |
| void | logOpenGLInfo () |
| Logs some information about the OpenGL context. | |
| bool | isExtensionSupported (const char *ext_name) |
| Returns true if the given extension is supported. | |
| void * | getProcAddress (const char *function_name) |
| Returns the address of an OpenGL extension function. | |
| RenderTarget * | renderTarget () |
| The render target representing this OpenGL context. | |
| const RenderTarget * | renderTarget () const |
| The render target representing this OpenGL context. | |
| ref< FBORenderTarget > | createFBORenderTarget (int width, int height) |
| Creates a new FBORenderTarget (framebuffer object RenderTarget). | |
| ref< FBORenderTarget > | createFBORenderTarget () |
Equivalent to "createFBORenderTarget(0,0);". | |
| void | destroyFBORenderTarget (FBORenderTarget *fbort) |
| void | destroyAllFBORenderTargets () |
| virtual void | quitApplication () |
| Asks to the windowing system that is managing the OpenGLContext to quit the application. | |
| virtual void | destroy () |
| virtual void | update () |
| virtual void | setWindowTitle (const String &) |
| virtual bool | setFullscreen (bool) |
| virtual void | show () |
| virtual void | hide () |
| virtual void | setPosition (int, int) |
| virtual void | setSize (int, int) |
| virtual ivec2 | position () const |
| virtual ivec2 | size () const |
| virtual bool | mouseVisible () const |
| virtual bool | fullscreen () const |
| virtual void | setMouseVisible (bool) |
| virtual void | getFocus () |
| virtual void | swapBuffers () |
| virtual void | makeCurrent () |
| virtual void | setMousePosition (int, int) |
| void | setVSyncEnabled (bool enable) |
| bool | vsyncEnabled () const |
| virtual void | setContinuousUpdate (bool continuous) |
| bool | continuousUpdate () const |
| void | sortEventListeners () |
| void | addEventListener (UIEventListener *el) |
| void | removeEventListener (UIEventListener *el) |
| void | eraseAllEventListeners () |
| const std::vector< ref < UIEventListener > > & | eventListeners () const |
| UIEventListener * | eventListener (int i) const |
| int | eventListenerCount () const |
| const OpenGLContextFormat & | openglContextInfo () const |
| void | setOpenGLContextInfo (const OpenGLContextFormat &info) |
| void | ignoreNextMouseMoveEvent () |
| int | width () const |
| int | height () const |
| void | dispatchResizeEvent (int w, int h) |
| void | dispatchMouseMoveEvent (int x, int y) |
| void | dispatchMouseUpEvent (EMouseButton button, int x, int y) |
| void | dispatchMouseDownEvent (EMouseButton button, int x, int y) |
| void | dispatchMouseWheelEvent (int n) |
| void | dispatchKeyPressEvent (unsigned short unicode_ch, EKey key) |
| void | dispatchKeyReleaseEvent (unsigned short unicode_ch, EKey key) |
| void | dispatchDestroyEvent () |
| void | dispatchRunEvent () |
| void | dispatchVisibilityEvent (bool visible) |
| void | dispatchInitEvent () |
| Dispatches the init event. | |
| void | dispatchFileDroppedEvent (const std::vector< String > &files) |
| int | textureUnitCount () const |
| const std::set< EKey > & | keyboard () const |
| Returns the std::set containing the currently pressed keys. | |
| bool | isKeyPressed (EKey key) const |
| Returns true if the given key is pressed. | |
| void | keyPress (EKey key) |
| For internal use only. | |
| void | keyRelease (EKey key) |
| For internal use only. | |
Protected Attributes | |
| ref< RenderTarget > | mRenderTarget |
| std::vector< ref < FBORenderTarget > > | mFBORenderTarget |
| std::vector< ref < UIEventListener > > | mEventListeners |
| std::set< EKey > | mKeyboard |
| OpenGLContextFormat | mGLContextInfo |
| bool | mMouseVisible |
| bool | mContinuousUpdate |
| bool | mIgnoreNextMouseMoveEvent |
| bool | mFullscreen |
| int | mTextureUnitCount |
OpenGLContext is an abstract class that wraps a minimal common subset of GUI APIs like Win32, Qt, wxWidgets, SDL, GLUT, etc.
In order to respond to the events generated by the OpenGLContext you must subclass an UIEventListener and bind it to the OpenGLContext using the functions addEventListener(ref<UIEventListener>) and removeEventListener(ref<UIEventListener>).
| vl::OpenGLContext::OpenGLContext | ( | int | w = 0, |
|
| int | h = 0 | |||
| ) | [inline] |
Constructor.
| vl::OpenGLContext::~OpenGLContext | ( | ) | [inline] |
Destructor.
Dispatches also destroyEvent() to its event listeners.
| virtual const char* vl::OpenGLContext::className | ( | ) | [inline, virtual] |
| void OpenGLContext::initExtensions | ( | bool | log = true |
) |
Initializes the supported OpenGL extensions.
| void OpenGLContext::logOpenGLInfo | ( | ) |
Logs some information about the OpenGL context.
| bool OpenGLContext::isExtensionSupported | ( | const char * | ext_name | ) |
Returns true if the given extension is supported.
| void * OpenGLContext::getProcAddress | ( | const char * | function_name | ) |
Returns the address of an OpenGL extension function.
| RenderTarget* vl::OpenGLContext::renderTarget | ( | ) | [inline] |
The render target representing this OpenGL context.
The returned RenderTarget's dimensions will be automatically updated to the OpenGLContext's dimensions.
| const RenderTarget* vl::OpenGLContext::renderTarget | ( | ) | const [inline] |
The render target representing this OpenGL context.
The returned RenderTarget's dimensions will be automatically updated to the OpenGLContext's dimensions.
| ref<FBORenderTarget> vl::OpenGLContext::createFBORenderTarget | ( | int | width, | |
| int | height | |||
| ) | [inline] |
Creates a new FBORenderTarget (framebuffer object RenderTarget).
| ref<FBORenderTarget> vl::OpenGLContext::createFBORenderTarget | ( | ) | [inline] |
Equivalent to "createFBORenderTarget(0,0);".
| void vl::OpenGLContext::destroyFBORenderTarget | ( | FBORenderTarget * | fbort | ) | [inline] |
| void vl::OpenGLContext::destroyAllFBORenderTargets | ( | ) | [inline] |
| virtual void vl::OpenGLContext::quitApplication | ( | ) | [inline, virtual] |
Asks to the windowing system that is managing the OpenGLContext to quit the application.
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::destroy | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWin32::Win32Window, vlMFC::MFCWindow, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::update | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::setWindowTitle | ( | const String & | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual bool vl::OpenGLContext::setFullscreen | ( | bool | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual void vl::OpenGLContext::show | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual void vl::OpenGLContext::hide | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual void vl::OpenGLContext::setPosition | ( | int | , | |
| int | ||||
| ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::setSize | ( | int | , | |
| int | ||||
| ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual ivec2 vl::OpenGLContext::position | ( | ) | const [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual ivec2 vl::OpenGLContext::size | ( | ) | const [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual bool vl::OpenGLContext::mouseVisible | ( | ) | const [inline, virtual] |
| virtual bool vl::OpenGLContext::fullscreen | ( | ) | const [inline, virtual] |
| virtual void vl::OpenGLContext::setMouseVisible | ( | bool | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::getFocus | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.
| virtual void vl::OpenGLContext::swapBuffers | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::makeCurrent | ( | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| virtual void vl::OpenGLContext::setMousePosition | ( | int | , | |
| int | ||||
| ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.
| void OpenGLContext::setVSyncEnabled | ( | bool | enable | ) |
| bool OpenGLContext::vsyncEnabled | ( | ) | const |
| virtual void vl::OpenGLContext::setContinuousUpdate | ( | bool | continuous | ) | [inline, virtual] |
Reimplemented in vlQt4::Qt4Widget.
| bool vl::OpenGLContext::continuousUpdate | ( | ) | const [inline] |
| void OpenGLContext::sortEventListeners | ( | ) |
| void OpenGLContext::addEventListener | ( | UIEventListener * | el | ) |
UIEventListener can be associated only to one OpenGLContext at a time. | void OpenGLContext::removeEventListener | ( | UIEventListener * | el | ) |
| void OpenGLContext::eraseAllEventListeners | ( | ) |
| const std::vector< ref<UIEventListener> >& vl::OpenGLContext::eventListeners | ( | ) | const [inline] |
| UIEventListener* vl::OpenGLContext::eventListener | ( | int | i | ) | const [inline] |
| int vl::OpenGLContext::eventListenerCount | ( | ) | const [inline] |
| const OpenGLContextFormat& vl::OpenGLContext::openglContextInfo | ( | ) | const [inline] |
| void vl::OpenGLContext::setOpenGLContextInfo | ( | const OpenGLContextFormat & | info | ) | [inline] |
| void vl::OpenGLContext::ignoreNextMouseMoveEvent | ( | ) | [inline] |
| int vl::OpenGLContext::width | ( | ) | const [inline] |
| int vl::OpenGLContext::height | ( | ) | const [inline] |
| void vl::OpenGLContext::dispatchResizeEvent | ( | int | w, | |
| int | h | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchMouseMoveEvent | ( | int | x, | |
| int | y | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchMouseUpEvent | ( | EMouseButton | button, | |
| int | x, | |||
| int | y | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchMouseDownEvent | ( | EMouseButton | button, | |
| int | x, | |||
| int | y | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchMouseWheelEvent | ( | int | n | ) | [inline] |
| void vl::OpenGLContext::dispatchKeyPressEvent | ( | unsigned short | unicode_ch, | |
| EKey | key | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchKeyReleaseEvent | ( | unsigned short | unicode_ch, | |
| EKey | key | |||
| ) | [inline] |
| void vl::OpenGLContext::dispatchDestroyEvent | ( | ) | [inline] |
| void vl::OpenGLContext::dispatchRunEvent | ( | ) | [inline] |
| void vl::OpenGLContext::dispatchVisibilityEvent | ( | bool | visible | ) | [inline] |
| void vl::OpenGLContext::dispatchInitEvent | ( | ) | [inline] |
Dispatches the init event.
| void vl::OpenGLContext::dispatchFileDroppedEvent | ( | const std::vector< String > & | files | ) | [inline] |
| int vl::OpenGLContext::textureUnitCount | ( | ) | const [inline] |
| const std::set<EKey>& vl::OpenGLContext::keyboard | ( | ) | const [inline] |
Returns the std::set containing the currently pressed keys.
| bool vl::OpenGLContext::isKeyPressed | ( | EKey | key | ) | const [inline] |
Returns true if the given key is pressed.
| void vl::OpenGLContext::keyPress | ( | EKey | key | ) | [inline] |
For internal use only.
| void vl::OpenGLContext::keyRelease | ( | EKey | key | ) | [inline] |
For internal use only.
ref<RenderTarget> vl::OpenGLContext::mRenderTarget [protected] |
std::vector< ref<FBORenderTarget> > vl::OpenGLContext::mFBORenderTarget [protected] |
std::vector< ref<UIEventListener> > vl::OpenGLContext::mEventListeners [protected] |
std::set<EKey> vl::OpenGLContext::mKeyboard [protected] |
OpenGLContextFormat vl::OpenGLContext::mGLContextInfo [protected] |
bool vl::OpenGLContext::mMouseVisible [protected] |
bool vl::OpenGLContext::mContinuousUpdate [protected] |
bool vl::OpenGLContext::mIgnoreNextMouseMoveEvent [protected] |
bool vl::OpenGLContext::mFullscreen [protected] |
int vl::OpenGLContext::mTextureUnitCount [protected] |