Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]
Classes | Public Member Functions | Static Public Member Functions | Protected Attributes

vl::OpenGLContext Class Reference

Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard, mouse or system events. More...

#include <OpenGLContext.hpp>

Inheritance diagram for vl::OpenGLContext:
vl::Object vlGLUT::GLUTWindow vlQt4::Qt4Widget vlSDL::SDLWindow vlWin32::Win32Context vlWX::vlWXGLCanvas vlMFC::MFCWindow vlWin32::Win32Window

List of all members.

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.
RenderTargetrenderTarget ()
 The render target representing this OpenGL context.
const RenderTargetrenderTarget () const
 The render target representing this OpenGL context.
ref< FBORenderTargetcreateFBORenderTarget (int width, int height)
 Creates a new FBORenderTarget (framebuffer object RenderTarget).
ref< FBORenderTargetcreateFBORenderTarget ()
 Equivalent to "createFBORenderTarget(0,0);".
void destroyFBORenderTarget (FBORenderTarget *fbort)
 Destroyes 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 destroy ()
 This function should be appropriately reimplemented in all the subclasses of OpenGLContext.
virtual void update ()
 If the OpenGLContext is a widget this function requests a redraw.
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.
UIEventListenereventListener (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 OpenGLContextFormatopenglContextInfo () 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 objects.
void dispatchRunEvent ()
 Dispatches the UIEventListener::runEvent() 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.

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.
static bool isCleanState (bool verbose)
 Checks whether the OpenGL state is clean or not.

Protected Attributes

ref< RenderTargetmRenderTarget
std::vector< ref
< FBORenderTarget > > 
mFBORenderTarget
std::vector< ref
< UIEventListener > > 
mEventListeners
std::set< EKeymKeyboard
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 RenderStatemCurrentRenderState [RS_COUNT]
ref< RenderStatemDefaultRenderStates [RS_COUNT]
ETextureDimension mTexUnitBinding [VL_MAX_TEXTURE_UNITS]
const IVertexAttribSetmCurVAS
VertexArrayInfo mVertexArray
VertexArrayInfo mNormalArray
VertexArrayInfo mColorArray
VertexArrayInfo mSecondaryColorArray
VertexArrayInfo mFogArray
VertexArrayInfo mTexCoordArray [VL_MAX_TEXTURE_UNITS]
VertexArrayInfo mVertexAttrib [VL_MAX_GENERIC_VERTEX_ATTRIB]

Detailed Description

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>).

OpenGLContext Custom Implementation
  • Key_Alt/Ctrl/Shift events must always be notified before Key_Left/Right-Alt/Ctrl/Shift events.
  • Always update the mKeyboard structure appropriately especially with respect to Key_[Left/Right]-Alt/Ctrl/Shift events.
  • When cycling through EventListeners to dispatch the events you must do it on a temporary copy of mEventListeners so that the EventListeners can safely add/remove themselves or other EventListeners to the OpenGLContext itself.

Constructor & Destructor Documentation

OpenGLContext::OpenGLContext ( int  w = 0,
int  h = 0 
)

Constructor.

vl::OpenGLContext::~OpenGLContext (  ) [inline]

Destructor.

Dispatches also destroyEvent() to its event listeners.


Member Function Documentation

virtual const char* vl::OpenGLContext::className (  ) [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

virtual void vl::OpenGLContext::swapBuffers (  ) [pure virtual]

Swaps the back and front buffers to present the last rendering.

Implemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual void vl::OpenGLContext::makeCurrent (  ) [pure virtual]

Sets the OpenGL context as current for the calling thread.

Implemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

void OpenGLContext::initGLContext ( 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.

Note:
This is a relatively slow function, don't use it inside loops and similar.
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).

Note:
A framebuffer object always belongs to an OpenGL context and in order to render on it the appropriate OpenGL context must be active.
ref<FBORenderTarget> vl::OpenGLContext::createFBORenderTarget (  ) [inline]

Equivalent to "createFBORenderTarget(0,0);".

void vl::OpenGLContext::destroyFBORenderTarget ( FBORenderTarget fbort ) [inline]

Destroyes the specified FBORenderTarget.

void vl::OpenGLContext::destroyAllFBORenderTargets (  ) [inline]

Removes all FBORenderTargets belonging to an OpenGLContext.

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]

This function should be appropriately reimplemented in all the subclasses of OpenGLContext.

Reimplemented in vlQt4::Qt4Widget, vlWin32::Win32Window, vlMFC::MFCWindow, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual void vl::OpenGLContext::update (  ) [inline, virtual]

If the OpenGLContext is a widget this function requests a redraw.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual void vl::OpenGLContext::setWindowTitle ( const String  ) [inline, virtual]

If the OpenGL context is a top window this function sets its title.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual bool vl::OpenGLContext::setFullscreen ( bool   ) [inline, virtual]

If the OpenGL context is a widget this function requests a maximization to fullscreen.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

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.

virtual void vl::OpenGLContext::show (  ) [inline, virtual]

If the OpenGL context is a widget this function makes it visible to the user.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

virtual void vl::OpenGLContext::hide (  ) [inline, virtual]

If the OpenGL context is a widget this function makes it invisible to the user.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

virtual void vl::OpenGLContext::setPosition ( int  ,
int   
) [inline, virtual]

If the OpenGL context is a widget this function sets its position.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual ivec2 vl::OpenGLContext::position (  ) const [inline, virtual]

If the OpenGL context is a widget this function returns its position.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

virtual void vl::OpenGLContext::setSize ( int  ,
int   
) [inline, virtual]

If the OpenGL context is a widget this function sets its size.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

int vl::OpenGLContext::width (  ) const [inline]

Returns the width in pixels of an OpenGLContext.

int vl::OpenGLContext::height (  ) const [inline]

Returns the height in pixels of an OpenGLContext.

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 vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

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.

virtual void vl::OpenGLContext::setMousePosition ( int  ,
int   
) [inline, virtual]

If the OpenGL context is a widget this function sets the mouse position.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, vlGLUT::GLUTWindow, and vlSDL::SDLWindow.

virtual void vl::OpenGLContext::getFocus (  ) [inline, virtual]

If the OpenGL context is a widget this function requests the mouse focus on it.

Reimplemented in vlQt4::Qt4Widget, vlWX::vlWXGLCanvas, vlWin32::Win32Context, and vlGLUT::GLUTWindow.

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.

bool OpenGLContext::vsyncEnabled (  ) const

If the OpenGL context is a widget this function returns whether vsync is enabled or not.

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.

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.

void OpenGLContext::addEventListener ( UIEventListener el )

Adds an UIEventListener to be notified of OpenGLContext related events.

Note:
An UIEventListener can be associated only to one OpenGLContext at a time.
void OpenGLContext::removeEventListener ( UIEventListener el )

Removes an UIEventListener.

void OpenGLContext::eraseAllEventListeners (  )

Removes all UIEventListener previously registered.

const std::vector< ref<UIEventListener> >& vl::OpenGLContext::eventListeners (  ) const [inline]

The currently UIEventListener registered to be notified of OpenGLContext related events.

UIEventListener* vl::OpenGLContext::eventListener ( int  i ) const [inline]

Returns the i-th UIEventListener registered to an OpenGLContext.

int vl::OpenGLContext::eventListenerCount (  ) const [inline]

Returns the number of UIEventListener registered to an OpenGLContext.

const OpenGLContextFormat& vl::OpenGLContext::openglContextInfo (  ) const [inline]

Returns an OpenGLContextFormat structure describing an OpenGLContext.

void vl::OpenGLContext::setOpenGLContextInfo ( const OpenGLContextFormat info ) [inline]

Sets the OpenGLContextFormat associated to an OpenGLContext.

void vl::OpenGLContext::ignoreNextMouseMoveEvent (  ) [inline]

Requests not to dispatch the next mouse move event.

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

void vl::OpenGLContext::dispatchMouseMoveEvent ( int  x,
int  y 
) [inline]

Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchMouseUpEvent ( EMouseButton  button,
int  x,
int  y 
) [inline]

Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchMouseDownEvent ( EMouseButton  button,
int  x,
int  y 
) [inline]

Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchMouseWheelEvent ( int  n ) [inline]

Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchKeyPressEvent ( unsigned short  unicode_ch,
EKey  key 
) [inline]

Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchKeyReleaseEvent ( unsigned short  unicode_ch,
EKey  key 
) [inline]

Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchDestroyEvent (  ) [inline]

Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchRunEvent (  ) [inline]

Dispatches the UIEventListener::runEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchVisibilityEvent ( bool  visible ) [inline]

Dispatches the UIEventListener::visibilityEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchInitEvent (  ) [inline]

Dispatches the UIEventListener::initEvent() notification to the subscribed UIEventListener objects.

void vl::OpenGLContext::dispatchFileDroppedEvent ( const std::vector< String > &  files ) [inline]

Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener objects.

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]

Inserts the specified key in the set of currently active keys - For internal use only.

void vl::OpenGLContext::keyRelease ( EKey  key ) [inline]

Removes the specified key from the set of currently active keys - For internal use only.

bool vl::OpenGLContext::isInitialized (  ) const [inline]

Returns true if the OpenGLContext is in an initialized state.

int vl::OpenGLContext::textureUnitCount (  ) const [inline]

The number (clamped to VL_MAX_TEXTURE_UNITS) of texture units supported by the current hardware.

bool vl::OpenGLContext::hasDoubleBuffer (  ) const [inline]

Returns true if an OpenGLContext supports double buffering.

bool vl::OpenGLContext::isCompatible (  ) const [inline]

Returns true if an OpenGLContext provides backwards compatibility to previous OpenGL API versions.

int vl::OpenGLContext::openglVersionMajorNumber (  ) const [inline]

Returns the OpenGL's driver version's major number.

int vl::OpenGLContext::openglVersionMinorNumber (  ) const [inline]

Returns the OpenGL's driver version's minor number.

void OpenGLContext::bindVAS ( const IVertexAttribSet vas,
bool  use_vbo,
bool  force 
)

Activates the specified vertex attribute set - For internal use only.

Parameters:
vasThe 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_vboWhether vertex-buffer-objects should be used when activating the vertex attributes.
forceBinds vas even if it was the last to be activated (this is also valid for NULL).
void OpenGLContext::applyEnables ( const EnableSet prev,
const EnableSet cur 
)

Applies an EnableSet to an OpenGLContext - For internal use only.

void OpenGLContext::applyRenderStates ( const RenderStateSet prev,
const RenderStateSet cur,
const Camera camera 
)

Applies a RenderStateSet to an OpenGLContext - For internal use only.

void OpenGLContext::resetEnables (  )

Resets all the interanal enable-tables - For internal use only.

void OpenGLContext::resetRenderStates (  )

Resets all the interanal render-states-tables - For internal use only.

void OpenGLContext::resetContextStates (  )

Resets the OpenGL states necessary to begin and finish a rendering. - For internal use only.

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.

ETextureDimension vl::OpenGLContext::texUnitBinding ( int  unit_i ) const [inline]

Returnes the texture target currently active for the specified texture unit. - For internal use only.

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.

bool OpenGLContext::isCleanState ( bool  verbose ) [static]

Checks whether the OpenGL state is clean or not.

Clean state conditions:
  • All functionalities must be disabled, no GL_LIGHTING, GL_DEPTH_TEST, GL_LIGHTn, GL_CLIP_PLANEn etc. enabled, with the sole exception of GL_MULTISAMPLE.
  • All buffer objects targets such as GL_ARRAY_BUFFER, GL_ELEMENT_ARRAY_BUFFER etc. must be bound to buffer object #0.
  • Current texture unit and client texture unit must be #0.
  • All texture matrices must be set to identity.
  • All texture targets must be bound to texture #0.
  • All GL_TEXTURE_COORD_ARRAYs must be disabled.
  • All texture targets such as GL_TEXTURE_1D, GL_TEXTURE_2D etc. must be disabled.
  • All texture targets should be bound to texture #0.
  • All texture coordinate generation modes such as GL_TEXTURE_GEN_S/T/R/Q must be disable for all texture units.
  • All vertex arrays such as GL_COLOR_ARRAY, GL_NORMAL_ARRAY etc. must be disabled, including the ones enabled with glEnableVertexAttribArray()
  • NOTE: blending function must be set to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA).
  • Color write-mask should be glColorMask(GL_TRUE ,GL_TRUE, GL_TRUE, GL_TRUE).
  • Depth write-mask should be glDepthMask(GL_TRUE).
  • Polygon mode should be glPolygonMode(GL_FRONT_AND_BACK, GL_FILL).
  • In general all OpenGL render states should be set to their default values.

Member Data Documentation

std::set<EKey> vl::OpenGLContext::mKeyboard [protected]
int vl::OpenGLContext::mEnableTable[EN_EnableCount] [protected]
int vl::OpenGLContext::mRenderStateTable[RS_COUNT] [protected]
bool vl::OpenGLContext::mCurrentEnable[EN_EnableCount] [protected]
ETextureDimension vl::OpenGLContext::mTexUnitBinding[VL_MAX_TEXTURE_UNITS] [protected]
VertexArrayInfo vl::OpenGLContext::mTexCoordArray[VL_MAX_TEXTURE_UNITS] [protected]
VertexArrayInfo vl::OpenGLContext::mVertexAttrib[VL_MAX_GENERIC_VERTEX_ATTRIB] [protected]

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

Visualization Library v2010.11.1125 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Fri Nov 26 2010 10:33:50.
Permission is granted to use this page to write and publish articles regarding Visualization Library.