Visualization LibraryA lightweight C++ OpenGL middleware for 2D/3D graphics |
[Home] [Tutorials] [All Classes] [Grouped Classes] |
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard, mouse or system events. More...
#include <OpenGLContext.hpp>
Classes | |
| struct | VertexArrayInfo |
Public Member Functions | |
| virtual const char * | className () |
| Returns the name of the class. | |
| OpenGLContext (int w=0, int h=0) | |
| Constructor. | |
| ~OpenGLContext () | |
| Destructor. | |
| virtual void | swapBuffers ()=0 |
| Swaps the back and front buffers to present the last rendering. | |
| virtual void | makeCurrent ()=0 |
| Sets the OpenGL context as current for the calling thread. | |
| void | initGLContext (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 () |
Equivalent to "createFBORenderTarget(0,0);". | |
| ref< FBORenderTarget > | createFBORenderTarget (int width, int height) |
| Creates a new FBORenderTarget (framebuffer object RenderTarget). | |
| void | destroyFBORenderTarget (FBORenderTarget *fbort) |
| Destroys the specified FBORenderTarget. | |
| void | destroyAllFBORenderTargets () |
| Removes all FBORenderTargets belonging to an OpenGLContext. | |
| virtual void | quitApplication () |
| Asks to the windowing system that is managing the OpenGLContext to quit the application. | |
| virtual void | update ()=0 |
| If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent(). | |
| virtual void | setWindowTitle (const String &) |
| If the OpenGL context is a top window this function sets its title. | |
| virtual bool | setFullscreen (bool) |
| If the OpenGL context is a widget this function requests a maximization to fullscreen. | |
| virtual bool | fullscreen () const |
| If the OpenGL context is a widget this function returns whether it has been maximized to fullscreen. | |
| virtual void | show () |
| If the OpenGL context is a widget this function makes it visible to the user. | |
| virtual void | hide () |
| If the OpenGL context is a widget this function makes it invisible to the user. | |
| virtual void | setPosition (int, int) |
| If the OpenGL context is a widget this function sets its position. | |
| virtual ivec2 | position () const |
| If the OpenGL context is a widget this function returns its position. | |
| virtual void | setSize (int, int) |
| If the OpenGL context is a widget this function sets its size. | |
| int | width () const |
| Returns the width in pixels of an OpenGLContext. | |
| int | height () const |
| Returns the height in pixels of an OpenGLContext. | |
| virtual void | setMouseVisible (bool) |
| If the OpenGL context is a widget this function sets whether the mouse is visible over it or not. | |
| virtual bool | mouseVisible () const |
| If the OpenGL context is a widget this function returns whether the mouse is visible over it or not. | |
| virtual void | setMousePosition (int, int) |
| If the OpenGL context is a widget this function sets the mouse position. | |
| virtual void | getFocus () |
| If the OpenGL context is a widget this function requests the mouse focus on it. | |
| void | setVSyncEnabled (bool enable) |
| If the OpenGL context is a widget this function enabled/disables double buffer swapping to the monitor's vertical synch. | |
| bool | vsyncEnabled () const |
| If the OpenGL context is a widget this function returns whether vsync is enabled or not. | |
| virtual void | setContinuousUpdate (bool continuous) |
| If the OpenGL context is a widget this function sets whether its area is continuously updated at each frame. | |
| bool | continuousUpdate () const |
| If the OpenGL context is a widget this function returns whether its area is continuously updated at each frame. | |
| void | addEventListener (UIEventListener *el) |
| Adds an UIEventListener to be notified of OpenGLContext related events. | |
| void | removeEventListener (UIEventListener *el) |
| Removes an UIEventListener. | |
| void | eraseAllEventListeners () |
| Removes all UIEventListener previously registered. | |
| const std::vector< ref < UIEventListener > > & | eventListeners () const |
| The currently UIEventListener registered to be notified of OpenGLContext related events. | |
| UIEventListener * | eventListener (int i) const |
Returns the i-th UIEventListener registered to an OpenGLContext. | |
| int | eventListenerCount () const |
| Returns the number of UIEventListener registered to an OpenGLContext. | |
| const OpenGLContextFormat & | openglContextInfo () const |
| Returns an OpenGLContextFormat structure describing an OpenGLContext. | |
| void | setOpenGLContextInfo (const OpenGLContextFormat &info) |
| Sets the OpenGLContextFormat associated to an OpenGLContext. | |
| void | ignoreNextMouseMoveEvent () |
| Requests not to dispatch the next mouse move event. | |
| void | dispatchResizeEvent (int w, int h) |
| Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchMouseMoveEvent (int x, int y) |
| Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchMouseUpEvent (EMouseButton button, int x, int y) |
| Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchMouseDownEvent (EMouseButton button, int x, int y) |
| Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchMouseWheelEvent (int n) |
| Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchKeyPressEvent (unsigned short unicode_ch, EKey key) |
| Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchKeyReleaseEvent (unsigned short unicode_ch, EKey key) |
| Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchDestroyEvent () |
| Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener(s), calls destroyAllFBORenderTargets() and eraseAllEventListeners() This event must be issued just before the actual GL context is destroyed. | |
| void | dispatchRunEvent () |
| Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchVisibilityEvent (bool visible) |
| Dispatches the UIEventListener::visibilityEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchInitEvent () |
| Dispatches the UIEventListener::initEvent() notification to the subscribed UIEventListener objects. | |
| void | dispatchFileDroppedEvent (const std::vector< String > &files) |
| Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener objects. | |
| 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) |
| Inserts the specified key in the set of currently active keys - For internal use only. | |
| void | keyRelease (EKey key) |
| Removes the specified key from the set of currently active keys - For internal use only. | |
| bool | isInitialized () const |
| Returns true if the OpenGLContext is in an initialized state. | |
| int | textureUnitCount () const |
| The number (clamped to VL_MAX_TEXTURE_UNITS) of texture units supported by the current hardware. | |
| bool | hasDoubleBuffer () const |
Returns true if an OpenGLContext supports double buffering. | |
| bool | isCompatible () const |
Returns true if an OpenGLContext provides backwards compatibility to previous OpenGL API versions. | |
| int | openglVersionMajorNumber () const |
| Returns the OpenGL's driver version's major number. | |
| int | openglVersionMinorNumber () const |
| Returns the OpenGL's driver version's minor number. | |
| void | bindVAS (const IVertexAttribSet *vas, bool use_vbo, bool force) |
| Activates the specified vertex attribute set - For internal use only. | |
| void | applyEnables (const EnableSet *prev, const EnableSet *cur) |
| Applies an EnableSet to an OpenGLContext - For internal use only. | |
| void | applyRenderStates (const RenderStateSet *prev, const RenderStateSet *cur, const Camera *camera) |
| Applies a RenderStateSet to an OpenGLContext - For internal use only. | |
| void | resetEnables () |
| Resets all the interanal enable-tables - For internal use only. | |
| void | resetRenderStates () |
| Resets all the interanal render-states-tables - For internal use only. | |
| void | resetContextStates () |
| Resets the OpenGL states necessary to begin and finish a rendering. - For internal use only. | |
| void | setTexUnitBinding (int unit_i, ETextureDimension target) |
Declares that texture unit unit_i is currently bound to the specified texture target. - For internal use only. | |
| ETextureDimension | texUnitBinding (int unit_i) const |
| Returnes the texture target currently active for the specified texture unit. - For internal use only. | |
| bool | isCleanState (bool verbose) |
| Checks whether the OpenGL state is clean or not. | |
Static Public Member Functions | |
| static bool | areUniformsColliding (const UniformSet *u1, const UniformSet *u2) |
Returns true if the two UniformSet contain at least one Uniform variable with the same name. | |
Protected Attributes | |
| ref< RenderTarget > | mRenderTarget |
| std::vector< ref < FBORenderTarget > > | mFBORenderTarget |
| std::vector< ref < UIEventListener > > | mEventListeners |
| std::set< EKey > | mKeyboard |
| OpenGLContextFormat | mGLContextInfo |
| int | mMaxVertexAttrib |
| int | mTextureUnitCount |
| int | mMajorVersion |
| int | mMinorVersion |
| bool | mMouseVisible |
| bool | mContinuousUpdate |
| bool | mIgnoreNextMouseMoveEvent |
| bool | mFullscreen |
| bool | mHasDoubleBuffer |
| bool | mIsInitialized |
| bool | mIsCompatible |
| int | mEnableTable [EN_EnableCount] |
| int | mRenderStateTable [RS_COUNT] |
| bool | mCurrentEnable [EN_EnableCount] |
| const RenderState * | mCurrentRenderState [RS_COUNT] |
| ref< RenderState > | mDefaultRenderStates [RS_COUNT] |
| ETextureDimension | mTexUnitBinding [VL_MAX_TEXTURE_UNITS] |
| const IVertexAttribSet * | mCurVAS |
| VertexArrayInfo | mVertexArray |
| VertexArrayInfo | mNormalArray |
| VertexArrayInfo | mColorArray |
| VertexArrayInfo | mSecondaryColorArray |
| VertexArrayInfo | mFogArray |
| VertexArrayInfo | mTexCoordArray [VL_MAX_TEXTURE_UNITS] |
| VertexArrayInfo | mVertexAttrib [VL_MAX_GENERIC_VERTEX_ATTRIB] |
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard, mouse or system events.
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>).
Definition at line 122 of file OpenGLContext.hpp.
| OpenGLContext::OpenGLContext | ( | int | w = 0, |
| int | h = 0 |
||
| ) |
Constructor.
Definition at line 76 of file OpenGLContext.cpp.
References mCurrentEnable, mCurrentRenderState, mEnableTable, mRenderStateTable, mRenderTarget, mTexUnitBinding, and VL_DEBUG_SET_OBJECT_NAME.
| OpenGLContext::~OpenGLContext | ( | ) |
Destructor.
Definition at line 94 of file OpenGLContext.cpp.
References eraseAllEventListeners(), mEventListeners, mFBORenderTarget, mRenderTarget, and vl::Log::warning().
| virtual const char* vl::OpenGLContext::className | ( | ) | [inline, virtual] |
Returns the name of the class.
Reimplemented from vl::Object.
Definition at line 125 of file OpenGLContext.hpp.
| virtual void vl::OpenGLContext::swapBuffers | ( | ) | [pure virtual] |
Swaps the back and front buffers to present the last rendering.
Implemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Referenced by vl::Applet::updateEvent().
| virtual void vl::OpenGLContext::makeCurrent | ( | ) | [pure virtual] |
Sets the OpenGL context as current for the calling thread.
Implemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Referenced by vl::FBORenderTarget::bindFramebuffer(), vl::FBORenderTarget::checkFramebufferStatus(), vl::FBORenderTarget::create(), createFBORenderTarget(), vl::FBORenderTarget::destroy(), destroyAllFBORenderTargets(), destroyFBORenderTarget(), getProcAddress(), initGLContext(), isExtensionSupported(), logOpenGLInfo(), vl::FBORenderTarget::removeAttachment(), and setVSyncEnabled().
| void OpenGLContext::initGLContext | ( | bool | log = true ) |
Initializes the supported OpenGL extensions.
Definition at line 216 of file OpenGLContext.cpp.
References logOpenGLInfo(), makeCurrent(), mHasDoubleBuffer, mIsCompatible, mIsInitialized, mMajorVersion, mMaxVertexAttrib, mMinorVersion, mTextureUnitCount, VL_CHECK_OGL, VL_MAX_GENERIC_VERTEX_ATTRIB, VL_MAX_TEXTURE_UNITS, and VL_TRAP.
Referenced by vlGLUT::GLUTWindow::initGLUTWindow().
| void OpenGLContext::logOpenGLInfo | ( | ) |
Logs some information about the OpenGL context.
Definition at line 319 of file OpenGLContext.cpp.
References vl::globalSettings(), isCompatible(), makeCurrent(), vl::Log::print(), vl::VEL_VERBOSITY_NORMAL, VL_CHECK, and VL_CHECK_OGL.
Referenced by initGLContext().
| bool OpenGLContext::isExtensionSupported | ( | const char * | ext_name ) |
Returns true if the given extension is supported.
Definition at line 295 of file OpenGLContext.cpp.
References makeCurrent().
| void * OpenGLContext::getProcAddress | ( | const char * | function_name ) |
Returns the address of an OpenGL extension function.
Definition at line 313 of file OpenGLContext.cpp.
References glewGetProcAddress, and makeCurrent().
| 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.
Definition at line 154 of file OpenGLContext.hpp.
Referenced by vl::GhostCameraManipulator::enableEvent(), vlGLUT::GLUTWindow::glut_reshape_func(), vl::TrackballManipulator::mouseDownEvent(), vl::TrackballManipulator::mouseMoveEvent(), vl::GhostCameraManipulator::mouseMoveEvent(), and vlWin32::Win32Window::WindowProc().
| 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.
Definition at line 158 of file OpenGLContext.hpp.
| ref<FBORenderTarget> vl::OpenGLContext::createFBORenderTarget | ( | ) | [inline] |
Equivalent to "createFBORenderTarget(0,0);".
Definition at line 161 of file OpenGLContext.hpp.
References createFBORenderTarget().
Referenced by createFBORenderTarget().
| ref< FBORenderTarget > OpenGLContext::createFBORenderTarget | ( | int | width, |
| int | height | ||
| ) |
Creates a new FBORenderTarget (framebuffer object RenderTarget).
Definition at line 114 of file OpenGLContext.cpp.
References makeCurrent(), and mFBORenderTarget.
| void OpenGLContext::destroyFBORenderTarget | ( | FBORenderTarget * | fbort ) |
Destroys the specified FBORenderTarget.
Definition at line 122 of file OpenGLContext.cpp.
References makeCurrent(), and mFBORenderTarget.
| void OpenGLContext::destroyAllFBORenderTargets | ( | ) |
Removes all FBORenderTargets belonging to an OpenGLContext.
Definition at line 137 of file OpenGLContext.cpp.
References makeCurrent(), and mFBORenderTarget.
| virtual void vl::OpenGLContext::quitApplication | ( | ) | [inline, virtual] |
Asks to the windowing system that is managing the OpenGLContext to quit the application.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 174 of file OpenGLContext.hpp.
Referenced by vl::Applet::keyReleaseEvent().
| virtual void vl::OpenGLContext::update | ( | ) | [pure virtual] |
If the OpenGLContext is a widget this function requests a redraw and generates an updateEvent().
Implemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Referenced by vl::Applet::keyReleaseEvent(), and vl::TrackballManipulator::mouseMoveEvent().
| virtual void vl::OpenGLContext::setWindowTitle | ( | const String & | ) | [inline, virtual] |
If the OpenGL context is a top window this function sets its title.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 180 of file OpenGLContext.hpp.
| virtual bool vl::OpenGLContext::setFullscreen | ( | bool | ) | [inline, virtual] |
If the OpenGL context is a widget this function requests a maximization to fullscreen.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 183 of file OpenGLContext.hpp.
Referenced by vl::Applet::keyReleaseEvent().
| virtual bool vl::OpenGLContext::fullscreen | ( | ) | const [inline, virtual] |
If the OpenGL context is a widget this function returns whether it has been maximized to fullscreen.
Definition at line 186 of file OpenGLContext.hpp.
Referenced by vlWX::WXGLCanvas::setFullscreen().
| virtual void vl::OpenGLContext::show | ( | ) | [inline, virtual] |
If the OpenGL context is a widget this function makes it visible to the user.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 189 of file OpenGLContext.hpp.
| virtual void vl::OpenGLContext::hide | ( | ) | [inline, virtual] |
If the OpenGL context is a widget this function makes it invisible to the user.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 192 of file OpenGLContext.hpp.
| virtual void vl::OpenGLContext::setPosition | ( | int | , |
| int | |||
| ) | [inline, virtual] |
If the OpenGL context is a widget this function sets its position.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 195 of file OpenGLContext.hpp.
| virtual ivec2 vl::OpenGLContext::position | ( | ) | const [inline, virtual] |
If the OpenGL context is a widget this function returns its position.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 198 of file OpenGLContext.hpp.
| virtual void vl::OpenGLContext::setSize | ( | int | , |
| int | |||
| ) | [inline, virtual] |
If the OpenGL context is a widget this function sets its size.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 201 of file OpenGLContext.hpp.
| int vl::OpenGLContext::width | ( | ) | const [inline] |
Returns the width in pixels of an OpenGLContext.
Definition at line 204 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::setFullscreen().
| int vl::OpenGLContext::height | ( | ) | const [inline] |
Returns the height in pixels of an OpenGLContext.
Definition at line 207 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::setFullscreen().
| virtual void vl::OpenGLContext::setMouseVisible | ( | bool | ) | [inline, virtual] |
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 210 of file OpenGLContext.hpp.
Referenced by vl::TrackballManipulator::enableEvent(), and vl::GhostCameraManipulator::enableEvent().
| virtual bool vl::OpenGLContext::mouseVisible | ( | ) | const [inline, virtual] |
If the OpenGL context is a widget this function returns whether the mouse is visible over it or not.
Definition at line 213 of file OpenGLContext.hpp.
Referenced by vlWX::WXGLCanvas::setMouseVisible().
| virtual void vl::OpenGLContext::setMousePosition | ( | int | , |
| int | |||
| ) | [inline, virtual] |
If the OpenGL context is a widget this function sets the mouse position.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlSDL::SDLWindow, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 216 of file OpenGLContext.hpp.
Referenced by vl::GhostCameraManipulator::enableEvent(), and vl::GhostCameraManipulator::mouseMoveEvent().
| virtual void vl::OpenGLContext::getFocus | ( | ) | [inline, virtual] |
If the OpenGL context is a widget this function requests the mouse focus on it.
Reimplemented in vlGLUT::GLUTWindow, vlQt4::Qt4Widget, vlWin32::Win32Context, and vlWX::WXGLCanvas.
Definition at line 219 of file OpenGLContext.hpp.
| void OpenGLContext::setVSyncEnabled | ( | bool | enable ) |
If the OpenGL context is a widget this function enabled/disables double buffer swapping to the monitor's vertical synch.
Definition at line 193 of file OpenGLContext.cpp.
References makeCurrent().
Referenced by vlGLUT::GLUTWindow::initGLUTWindow().
| bool OpenGLContext::vsyncEnabled | ( | ) | const |
If the OpenGL context is a widget this function returns whether vsync is enabled or not.
Definition at line 204 of file OpenGLContext.cpp.
| virtual void vl::OpenGLContext::setContinuousUpdate | ( | bool | continuous ) | [inline, virtual] |
If the OpenGL context is a widget this function sets whether its area is continuously updated at each frame.
Reimplemented in vlQt4::Qt4Widget.
Definition at line 228 of file OpenGLContext.hpp.
Referenced by vl::TrackballManipulator::enableEvent(), vl::GhostCameraManipulator::enableEvent(), and vl::Applet::keyReleaseEvent().
| bool vl::OpenGLContext::continuousUpdate | ( | ) | const [inline] |
If the OpenGL context is a widget this function returns whether its area is continuously updated at each frame.
Definition at line 231 of file OpenGLContext.hpp.
Referenced by vlWin32::dispatchUpdate(), and vlWX::WXGLCanvas::OnIdle().
| void OpenGLContext::addEventListener | ( | UIEventListener * | el ) |
Adds an UIEventListener to be notified of OpenGLContext related events.
This method triggers immediately an UIEventListener::addedListenerEvent() and if the OpenGLContext is initialized also an UIEventListener::initEvent().
UIEventListener can be associated only to one OpenGLContext at a time. Definition at line 148 of file OpenGLContext.cpp.
References vl::UIEventListener::addedListenerEvent(), vl::UIEventListener::initEvent(), isInitialized(), mEventListeners, and VL_CHECK.
Referenced by vl::Applet::addedListenerEvent().
| void OpenGLContext::removeEventListener | ( | UIEventListener * | el ) |
Removes an UIEventListener.
Definition at line 162 of file OpenGLContext.cpp.
References mEventListeners, vl::UIEventListener::removedListenerEvent(), and VL_CHECK.
Referenced by vl::Applet::removedListenerEvent().
| void OpenGLContext::eraseAllEventListeners | ( | ) |
Removes all UIEventListener previously registered.
Definition at line 179 of file OpenGLContext.cpp.
References mEventListeners, and VL_CHECK.
Referenced by vlWX::WXGLCanvas::quitApplication(), and ~OpenGLContext().
| const std::vector< ref<UIEventListener> >& vl::OpenGLContext::eventListeners | ( | ) | const [inline] |
The currently UIEventListener registered to be notified of OpenGLContext related events.
Definition at line 245 of file OpenGLContext.hpp.
| UIEventListener* vl::OpenGLContext::eventListener | ( | int | i ) | const [inline] |
Returns the i-th UIEventListener registered to an OpenGLContext.
Definition at line 248 of file OpenGLContext.hpp.
| int vl::OpenGLContext::eventListenerCount | ( | ) | const [inline] |
Returns the number of UIEventListener registered to an OpenGLContext.
Definition at line 251 of file OpenGLContext.hpp.
| const OpenGLContextFormat& vl::OpenGLContext::openglContextInfo | ( | ) | const [inline] |
Returns an OpenGLContextFormat structure describing an OpenGLContext.
Definition at line 254 of file OpenGLContext.hpp.
| void vl::OpenGLContext::setOpenGLContextInfo | ( | const OpenGLContextFormat & | info ) | [inline] |
Sets the OpenGLContextFormat associated to an OpenGLContext.
Definition at line 257 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::initGLUTWindow().
| void vl::OpenGLContext::ignoreNextMouseMoveEvent | ( | ) | [inline] |
Requests not to dispatch the next mouse move event.
Definition at line 260 of file OpenGLContext.hpp.
Referenced by vl::GhostCameraManipulator::enableEvent(), and vl::GhostCameraManipulator::mouseMoveEvent().
| void vl::OpenGLContext::dispatchResizeEvent | ( | int | w, |
| int | h | ||
| ) | [inline] |
Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects.
Call this function at the beginning if you reimplement it
Definition at line 264 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_reshape_func(), vlWX::WXGLCanvas::OnSize(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchMouseMoveEvent | ( | int | x, |
| int | y | ||
| ) | [inline] |
Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objects.
Definition at line 277 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_motion_func(), vlGLUT::GLUTWindow::glut_passive_motion_func(), vlWX::WXGLCanvas::OnMouseMotion(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchMouseUpEvent | ( | EMouseButton | button, |
| int | x, | ||
| int | y | ||
| ) | [inline] |
Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects.
Definition at line 292 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_mouse_func(), vlWX::WXGLCanvas::OnMouseUp(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchMouseDownEvent | ( | EMouseButton | button, |
| int | x, | ||
| int | y | ||
| ) | [inline] |
Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objects.
Definition at line 302 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_mouse_func(), vlWX::WXGLCanvas::OnMouseDown(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchMouseWheelEvent | ( | int | n ) | [inline] |
Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener objects.
Definition at line 312 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_mouse_wheel_func(), vlWX::WXGLCanvas::OnMouseWheel(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchKeyPressEvent | ( | unsigned short | unicode_ch, |
| EKey | key | ||
| ) | [inline] |
Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener objects.
Definition at line 322 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_keyboard_func(), vlGLUT::GLUTWindow::glut_special_func(), vlWX::WXGLCanvas::OnKeyDown(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchKeyReleaseEvent | ( | unsigned short | unicode_ch, |
| EKey | key | ||
| ) | [inline] |
Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener objects.
Definition at line 333 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_keyboard_up_func(), vlGLUT::GLUTWindow::glut_special_up_func(), vlWX::WXGLCanvas::OnKeyUp(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchDestroyEvent | ( | ) | [inline] |
Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener(s), calls destroyAllFBORenderTargets() and eraseAllEventListeners() This event must be issued just before the actual GL context is destroyed.
Definition at line 346 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_close_func(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchRunEvent | ( | ) | [inline] |
Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects.
Definition at line 358 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_display_func(), vlWX::WXGLCanvas::OnPaint(), and vlWin32::Win32Window::WindowProc().
| void vl::OpenGLContext::dispatchVisibilityEvent | ( | bool | visible ) | [inline] |
Dispatches the UIEventListener::visibilityEvent() notification to the subscribed UIEventListener objects.
Definition at line 368 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_visibility_func().
| void vl::OpenGLContext::dispatchInitEvent | ( | ) | [inline] |
Dispatches the UIEventListener::initEvent() notification to the subscribed UIEventListener objects.
Definition at line 382 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::glut_reshape_func().
| void vl::OpenGLContext::dispatchFileDroppedEvent | ( | const std::vector< String > & | files ) | [inline] |
Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener objects.
Definition at line 392 of file OpenGLContext.hpp.
Referenced by vlWX::WXGLCanvas::OnDropFiles(), and vlWin32::Win32Window::WindowProc().
| const std::set<EKey>& vl::OpenGLContext::keyboard | ( | ) | const [inline] |
Returns the std::set containing the currently pressed keys.
Definition at line 402 of file OpenGLContext.hpp.
| bool vl::OpenGLContext::isKeyPressed | ( | EKey | key ) | const [inline] |
Returns true if the given key is pressed.
Definition at line 405 of file OpenGLContext.hpp.
Referenced by vl::GhostCameraManipulator::updateEvent().
| void vl::OpenGLContext::keyPress | ( | EKey | key ) | [inline] |
Inserts the specified key in the set of currently active keys - For internal use only.
Definition at line 408 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::updateModifiers().
| void vl::OpenGLContext::keyRelease | ( | EKey | key ) | [inline] |
Removes the specified key from the set of currently active keys - For internal use only.
Definition at line 411 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::updateModifiers().
| bool vl::OpenGLContext::isInitialized | ( | ) | const [inline] |
Returns true if the OpenGLContext is in an initialized state.
Definition at line 414 of file OpenGLContext.hpp.
Referenced by addEventListener().
| int vl::OpenGLContext::textureUnitCount | ( | ) | const [inline] |
The number (clamped to VL_MAX_TEXTURE_UNITS) of texture units supported by the current hardware.
Definition at line 417 of file OpenGLContext.hpp.
| bool vl::OpenGLContext::hasDoubleBuffer | ( | ) | const [inline] |
Returns true if an OpenGLContext supports double buffering.
Definition at line 420 of file OpenGLContext.hpp.
Referenced by resetContextStates().
| bool vl::OpenGLContext::isCompatible | ( | ) | const [inline] |
Returns true if an OpenGLContext provides backwards compatibility to previous OpenGL API versions.
Definition at line 423 of file OpenGLContext.hpp.
Referenced by vl::TextureUnit::apply(), vl::TexParameter::apply(), vl::Hint::apply(), bindVAS(), isCleanState(), logOpenGLInfo(), vl::Renderer::render(), vl::Geometry::render_Implementation(), and vl::OcclusionCullRenderer::render_pass2().
| int vl::OpenGLContext::openglVersionMajorNumber | ( | ) | const [inline] |
Returns the OpenGL's driver version's major number.
Definition at line 426 of file OpenGLContext.hpp.
| int vl::OpenGLContext::openglVersionMinorNumber | ( | ) | const [inline] |
Returns the OpenGL's driver version's minor number.
Definition at line 429 of file OpenGLContext.hpp.
| void OpenGLContext::bindVAS | ( | const IVertexAttribSet * | vas, |
| bool | use_vbo, | ||
| bool | force | ||
| ) |
Activates the specified vertex attribute set - For internal use only.
| vas | The IVertexAttribSet to be activated. It can be NULL, in which case all vertex attributes are disabled. If vas is the same as the last activated IVertexAttribSet then no operation is done. |
| use_vbo | Whether vertex-buffer-objects should be used when activating the vertex attributes. |
| force | Binds vas even if it was the last to be activated (this is also valid for NULL). |
Definition at line 1470 of file OpenGLContext.cpp.
References vl::VertexAttribInfo::attribIndex(), vl::IVertexAttribSet::colorArray(), vl::VertexAttribInfo::data(), vl::VertexAttribInfo::dataBehavior(), vl::IVertexAttribSet::fogCoordArray(), vl::IVertexAttribSet::getTexCoordArrayAt(), vl::IVertexAttribSet::getVertexAttribInfoAt(), vl::ArrayAbstract::glSize(), vl::ArrayAbstract::glType(), vl::ArrayAbstract::gpuBuffer(), vl::GLBufferObject::handle(), isCompatible(), mColorArray, mCurVAS, mFogArray, mMaxVertexAttrib, mNormalArray, mSecondaryColorArray, mTexCoordArray, mTextureUnitCount, mVertexArray, mVertexAttrib, vl::IVertexAttribSet::normalArray(), vl::VertexAttribInfo::normalize(), vl::Buffer::ptr(), vl::IVertexAttribSet::secondaryColorArray(), vl::IVertexAttribSet::texCoordArrayCount(), vl::VAB_NORMAL, vl::VAB_PURE_DOUBLE, vl::VAB_PURE_INTEGER, vl::IVertexAttribSet::vertexArray(), vl::IVertexAttribSet::vertexAttribInfoCount(), VL_CHECK, VL_CHECK_OGL, vl::VL_glBindBuffer(), vl::VL_glClientActiveTexture(), vl::VL_glDisableVertexAttribArray(), vl::VL_glEnableVertexAttribArray(), vl::VL_glVertexAttribIPointer(), vl::VL_glVertexAttribLPointer(), vl::VL_glVertexAttribPointer(), VL_MAX_GENERIC_VERTEX_ATTRIB, and VL_MAX_TEXTURE_UNITS.
Referenced by vl::Renderer::render(), vl::EdgeRenderer::render(), vl::Text::render_Implementation(), vl::Geometry::render_Implementation(), and resetContextStates().
Applies an EnableSet to an OpenGLContext - For internal use only.
Definition at line 544 of file OpenGLContext.cpp.
References vl::EnableSet::enables(), vl::Log::error(), mCurrentEnable, mEnableTable, VL_CHECK_OGL, and VL_TRAP.
Referenced by vl::Renderer::render(), and vl::OcclusionCullRenderer::render_pass2().
| void OpenGLContext::applyRenderStates | ( | const RenderStateSet * | prev, |
| const RenderStateSet * | cur, | ||
| const Camera * | camera | ||
| ) |
Applies a RenderStateSet to an OpenGLContext - For internal use only.
Definition at line 602 of file OpenGLContext.cpp.
References vl::RenderState::apply(), vl::RenderState::className(), vl::Log::error(), vl::ref< T >::get(), mCurrentRenderState, mDefaultRenderStates, mRenderStateTable, vl::RenderStateSet::renderStates(), vl::RenderState::type(), VL_CHECK, VL_CHECK_OGL, and VL_TRAP.
Referenced by vl::Renderer::render(), and vl::OcclusionCullRenderer::render_pass2().
| void OpenGLContext::resetEnables | ( | ) |
Resets all the interanal enable-tables - For internal use only.
Definition at line 806 of file OpenGLContext.cpp.
References mCurrentEnable, and mEnableTable.
Referenced by resetContextStates().
| void OpenGLContext::resetRenderStates | ( | ) |
Resets all the interanal render-states-tables - For internal use only.
Definition at line 799 of file OpenGLContext.cpp.
References mCurrentRenderState, mRenderStateTable, and mTexUnitBinding.
Referenced by resetContextStates().
| void OpenGLContext::resetContextStates | ( | ) |
Resets the OpenGL states necessary to begin and finish a rendering. - For internal use only.
Definition at line 1435 of file OpenGLContext.cpp.
References bindVAS(), vl::globalSettings(), hasDoubleBuffer(), isCleanState(), resetEnables(), resetRenderStates(), VL_CHECK_OGL, vl::VL_glBindFramebuffer(), and VL_TRAP.
| void vl::OpenGLContext::setTexUnitBinding | ( | int | unit_i, |
| ETextureDimension | target | ||
| ) | [inline] |
Declares that texture unit unit_i is currently bound to the specified texture target. - For internal use only.
Definition at line 456 of file OpenGLContext.hpp.
References VL_CHECK, and VL_MAX_TEXTURE_UNITS.
Referenced by vl::TextureUnit::apply().
| ETextureDimension vl::OpenGLContext::texUnitBinding | ( | int | unit_i ) | const [inline] |
Returnes the texture target currently active for the specified texture unit. - For internal use only.
Definition at line 463 of file OpenGLContext.hpp.
References VL_CHECK, and VL_MAX_TEXTURE_UNITS.
Referenced by vl::TextureUnit::apply().
| bool OpenGLContext::areUniformsColliding | ( | const UniformSet * | u1, |
| const UniformSet * | u2 | ||
| ) | [static] |
Returns true if the two UniformSet contain at least one Uniform variable with the same name.
Definition at line 1412 of file OpenGLContext.cpp.
References vl::Log::error(), and vl::UniformSet::uniforms().
Referenced by vl::Renderer::render().
| bool OpenGLContext::isCleanState | ( | bool | verbose ) |
Checks whether the OpenGL state is clean or not.
Definition at line 812 of file OpenGLContext.cpp.
References vl::EN_EnableCount, vl::Log::error(), isCompatible(), VL_CHECK_OGL, vl::VL_glActiveTexture(), vl::VL_glClientActiveTexture(), and VL_TRAP.
Referenced by vl::Renderer::render(), and resetContextStates().
ref<RenderTarget> vl::OpenGLContext::mRenderTarget [protected] |
Definition at line 493 of file OpenGLContext.hpp.
Referenced by OpenGLContext(), and ~OpenGLContext().
std::vector< ref<FBORenderTarget> > vl::OpenGLContext::mFBORenderTarget [protected] |
Definition at line 494 of file OpenGLContext.hpp.
Referenced by createFBORenderTarget(), destroyAllFBORenderTargets(), destroyFBORenderTarget(), and ~OpenGLContext().
std::vector< ref<UIEventListener> > vl::OpenGLContext::mEventListeners [protected] |
Definition at line 495 of file OpenGLContext.hpp.
Referenced by addEventListener(), eraseAllEventListeners(), removeEventListener(), and ~OpenGLContext().
std::set<EKey> vl::OpenGLContext::mKeyboard [protected] |
Definition at line 496 of file OpenGLContext.hpp.
OpenGLContextFormat vl::OpenGLContext::mGLContextInfo [protected] |
Definition at line 497 of file OpenGLContext.hpp.
int vl::OpenGLContext::mMaxVertexAttrib [protected] |
Definition at line 498 of file OpenGLContext.hpp.
Referenced by bindVAS(), and initGLContext().
int vl::OpenGLContext::mTextureUnitCount [protected] |
Definition at line 499 of file OpenGLContext.hpp.
Referenced by bindVAS(), and initGLContext().
int vl::OpenGLContext::mMajorVersion [protected] |
Definition at line 500 of file OpenGLContext.hpp.
Referenced by initGLContext().
int vl::OpenGLContext::mMinorVersion [protected] |
Definition at line 501 of file OpenGLContext.hpp.
Referenced by initGLContext().
bool vl::OpenGLContext::mMouseVisible [protected] |
Definition at line 502 of file OpenGLContext.hpp.
Referenced by vlWX::WXGLCanvas::setMouseVisible(), and vlGLUT::GLUTWindow::setMouseVisible().
bool vl::OpenGLContext::mContinuousUpdate [protected] |
Definition at line 503 of file OpenGLContext.hpp.
bool vl::OpenGLContext::mIgnoreNextMouseMoveEvent [protected] |
Definition at line 504 of file OpenGLContext.hpp.
bool vl::OpenGLContext::mFullscreen [protected] |
Definition at line 505 of file OpenGLContext.hpp.
Referenced by vlGLUT::GLUTWindow::initGLUTWindow(), vlWX::WXGLCanvas::setFullscreen(), and vlGLUT::GLUTWindow::setFullscreen().
bool vl::OpenGLContext::mHasDoubleBuffer [protected] |
Definition at line 506 of file OpenGLContext.hpp.
Referenced by initGLContext().
bool vl::OpenGLContext::mIsInitialized [protected] |
Definition at line 507 of file OpenGLContext.hpp.
Referenced by initGLContext().
bool vl::OpenGLContext::mIsCompatible [protected] |
Definition at line 508 of file OpenGLContext.hpp.
Referenced by initGLContext().
int vl::OpenGLContext::mEnableTable[EN_EnableCount] [protected] |
Definition at line 512 of file OpenGLContext.hpp.
Referenced by applyEnables(), OpenGLContext(), and resetEnables().
int vl::OpenGLContext::mRenderStateTable[RS_COUNT] [protected] |
Definition at line 513 of file OpenGLContext.hpp.
Referenced by applyRenderStates(), OpenGLContext(), and resetRenderStates().
bool vl::OpenGLContext::mCurrentEnable[EN_EnableCount] [protected] |
Definition at line 515 of file OpenGLContext.hpp.
Referenced by applyEnables(), OpenGLContext(), and resetEnables().
const RenderState* vl::OpenGLContext::mCurrentRenderState[RS_COUNT] [protected] |
Definition at line 516 of file OpenGLContext.hpp.
Referenced by applyRenderStates(), OpenGLContext(), and resetRenderStates().
ref<RenderState> vl::OpenGLContext::mDefaultRenderStates[RS_COUNT] [protected] |
Definition at line 518 of file OpenGLContext.hpp.
Referenced by applyRenderStates().
ETextureDimension vl::OpenGLContext::mTexUnitBinding[VL_MAX_TEXTURE_UNITS] [protected] |
Definition at line 521 of file OpenGLContext.hpp.
Referenced by OpenGLContext(), and resetRenderStates().
const IVertexAttribSet* vl::OpenGLContext::mCurVAS [protected] |
Definition at line 534 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mVertexArray [protected] |
Definition at line 535 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mNormalArray [protected] |
Definition at line 536 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mColorArray [protected] |
Definition at line 537 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mSecondaryColorArray [protected] |
Definition at line 538 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mFogArray [protected] |
Definition at line 539 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mTexCoordArray[VL_MAX_TEXTURE_UNITS] [protected] |
Definition at line 540 of file OpenGLContext.hpp.
Referenced by bindVAS().
VertexArrayInfo vl::OpenGLContext::mVertexAttrib[VL_MAX_GENERIC_VERTEX_ATTRIB] [protected] |
Definition at line 541 of file OpenGLContext.hpp.
Referenced by bindVAS().