Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
OpenGLContext.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef OpenGLContext_INCLUDE_ONCE
33 #define OpenGLContext_INCLUDE_ONCE
34 
35 #include <vlCore/Object.hpp>
40 #include <vlGraphics/GLSL.hpp>
41 #include <vector>
42 #include <set>
43 
44 namespace vl
45 {
46  class EnableSet;
47  class RenderStateSet;
48  class UniformSet;
49  class IVertexAttribSet;
50  class ArrayAbstract;
51 
52  //-----------------------------------------------------------------------------
53  // OpenGLContextFormat
54  //-----------------------------------------------------------------------------
57  {
58  public:
60  mRGBABits(ivec4(8,8,8,0)),
61  mAccumRGBABits(ivec4(0,0,0,0)),
62  mZBufferBits(24),
66  mMajVersion(0),
67  mMinVersion(0),
68  mHasDoubleBuffer(true),
69  mHasMultisample(false),
70  mStereo(false),
71  mFullscreen(false),
72  mVSync(false),
74 
75  void setRGBABits(int r, int g, int b, int a) { mRGBABits = ivec4(r,g,b,a); }
76  void setAccumRGBABits(int r, int g, int b, int a) { mAccumRGBABits = ivec4(r,g,b,a); }
77  void setDoubleBuffer(bool double_buffer_on) { mHasDoubleBuffer = double_buffer_on; }
78  void setDepthBufferBits(int bits) { mZBufferBits = bits; }
79  void setStencilBufferBits(int bits) { mStencilBufferBits = bits; }
80  void setMultisample(bool multisample_on) { mHasMultisample = multisample_on; }
81  void setMultisampleSamples(int samples) { mMultisampleSamples = samples; }
82  void setStereo(bool stereo_on) { mStereo = stereo_on; }
83  void setFullscreen(bool fullscreent) { mFullscreen = fullscreent; }
84  void setVSync(bool vsync_on) { mVSync = vsync_on; }
86  void setContextClientVersion(int version) { mContextClientVersion = version; }
87 
88  const ivec4& rgbaBits() const { return mRGBABits; }
89  const ivec4& accumRGBABits() const { return mAccumRGBABits; }
90  bool doubleBuffer() const { return mHasDoubleBuffer; }
91  int depthBufferBits() const { return mZBufferBits; }
92  int stencilBufferBits() const { return mStencilBufferBits; }
93  bool multisample() const { return mHasMultisample; }
94  int multisampleSamples() const { return mMultisampleSamples; }
95  bool stereo() const { return mStereo; }
96  bool fullscreen() const { return mFullscreen; }
97  bool vSync() const { return mVSync; }
100 
102  int bitsPerPixel() const { return rgbaBits().r() + rgbaBits().g() + rgbaBits().b() + rgbaBits().a(); }
103 
108 
110  void setVersion( int majv, int minv ) { mMajVersion = majv; mMinVersion = minv; }
111  int majVersion() const { return mMajVersion; }
112  int minVersion() const { return mMinVersion; }
113 
114  protected:
125  bool mStereo;
127  bool mVSync;
129  };
130  //-----------------------------------------------------------------------------
131  // OpenGLContext
132  //-----------------------------------------------------------------------------
145  {
147  friend class VertexAttrib;
148  friend class Color;
149  friend class SecondaryColor;
150  friend class Normal;
151 
152  public:
154  OpenGLContext(int w=0, int h=0);
155 
157  ~OpenGLContext();
158 
160  virtual void swapBuffers() = 0;
161 
163  virtual void makeCurrent() = 0;
164 
166  bool initGLContext(bool log=true);
167 
169  void logOpenGLInfo();
170 
172  const std::string& extensions() const { return mExtensions; }
173 
176  bool isExtensionSupported(const char* ext_name);
177 
179  void* getProcAddress(const char* function_name);
180 
184  FramebufferObject* leftFramebuffer() { return mLeftFramebuffer.get(); }
185 
189  const FramebufferObject* leftFramebuffer() const { return mLeftFramebuffer.get(); }
190 
194  FramebufferObject* rightFramebuffer() { return mRightFramebuffer.get(); }
195 
199  const FramebufferObject* rightFramebuffer() const { return mRightFramebuffer.get(); }
200 
203  FramebufferObject* framebuffer() { return leftFramebuffer(); }
204 
207  const FramebufferObject* framebuffer() const { return leftFramebuffer(); }
208 
211 
214  FramebufferObject* createFramebufferObject(
215  int width,
216  int height,
219 
221  void destroyFramebufferObject(FramebufferObject* fbort);
222 
224  void destroyAllFramebufferObjects();
225 
227  void destroyAllOpenGLResources();
228 
230  virtual void quitApplication() {}
231 
233  virtual void update() = 0;
234 
236  virtual void setWindowTitle(const String&) {}
237 
239  virtual bool setFullscreen(bool) { mFullscreen = false; return false; }
240 
242  virtual bool fullscreen() const { return mFullscreen; }
243 
245  virtual void show() {}
246 
248  virtual void hide() {}
249 
251  virtual void setPosition(int /*x*/, int /*y*/) {}
252 
254  virtual ivec2 position() const { return ivec2(); }
255 
257  virtual void setSize(int /*w*/, int /*h*/) {}
258 
260  int width() const { return framebuffer()->width(); }
261 
263  int height() const { return framebuffer()->height(); }
264 
266  virtual void setMouseVisible(bool) { mMouseVisible=false; }
267 
269  virtual bool mouseVisible() const { return mMouseVisible; }
270 
272  virtual void setMousePosition(int /*x*/, int /*y*/) {}
273 
275  virtual void getFocus() {}
276 
278  void setVSyncEnabled(bool enable);
279 
281  bool vsyncEnabled() const;
282 
284  virtual void setContinuousUpdate(bool continuous) { mContinuousUpdate = continuous; }
285 
287  bool continuousUpdate() const { return mContinuousUpdate; }
288 
292  void addEventListener(UIEventListener* el);
293 
295  void removeEventListener(UIEventListener* el);
296 
298  void eraseAllEventListeners();
299 
301  const std::vector< ref<UIEventListener> >& eventListeners() const { return mEventListeners; }
302 
304  const UIEventListener* eventListener(int i) const { return mEventListeners[i].get(); }
305 
307  UIEventListener* eventListener(int i) { return mEventListeners[i].get(); }
308 
310  int eventListenerCount() const { return (int)mEventListeners.size(); }
311 
313  const OpenGLContextFormat& openglContextInfo() const { return mGLContextInfo; }
314 
316  void setOpenGLContextInfo(const OpenGLContextFormat& info) { mGLContextInfo = info; }
317 
319  void ignoreNextMouseMoveEvent() { mIgnoreNextMouseMoveEvent = true; }
320 
323  void dispatchResizeEvent(int w, int h)
324  {
325  makeCurrent();
326  leftFramebuffer()->setWidth(w);
327  leftFramebuffer()->setHeight(h);
328  rightFramebuffer()->setWidth(w);
329  rightFramebuffer()->setHeight(h);
330 
331  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
332  for( unsigned i=0; i<temp_clients.size(); ++i )
333  if ( temp_clients[i]->isEnabled() )
334  temp_clients[i]->resizeEvent( w, h );
335  }
336 
338  void dispatchMouseMoveEvent(int x, int y)
339  {
340  makeCurrent();
341  if (mIgnoreNextMouseMoveEvent)
342  mIgnoreNextMouseMoveEvent = false;
343  else
344  {
345  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
346  for( unsigned i=0; i<temp_clients.size(); ++i )
347  if ( temp_clients[i]->isEnabled() )
348  temp_clients[i]->mouseMoveEvent(x, y);
349  }
350  }
351 
353  void dispatchMouseUpEvent(EMouseButton button, int x, int y)
354  {
355  makeCurrent();
356  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
357  for( unsigned i=0; i<temp_clients.size(); ++i )
358  if ( temp_clients[i]->isEnabled() )
359  temp_clients[i]->mouseUpEvent(button, x, y);
360  }
361 
363  void dispatchMouseDownEvent(EMouseButton button, int x, int y)
364  {
365  makeCurrent();
366  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
367  for( unsigned i=0; i<temp_clients.size(); ++i )
368  if ( temp_clients[i]->isEnabled() )
369  temp_clients[i]->mouseDownEvent(button, x, y);
370  }
371 
374  {
375  makeCurrent();
376  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
377  for( unsigned i=0; i<temp_clients.size(); ++i )
378  if ( temp_clients[i]->isEnabled() )
379  temp_clients[i]->mouseWheelEvent(n);
380  }
381 
383  void dispatchKeyPressEvent(unsigned short unicode_ch, EKey key)
384  {
385  makeCurrent();
386  keyPress(key);
387  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
388  for( unsigned i=0; i<temp_clients.size(); ++i )
389  if ( temp_clients[i]->isEnabled() )
390  temp_clients[i]->keyPressEvent(unicode_ch, key);
391  }
392 
394  void dispatchKeyReleaseEvent(unsigned short unicode_ch, EKey key)
395  {
396  makeCurrent();
397  keyRelease(key);
398  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
399  for( unsigned i=0; i<temp_clients.size(); ++i )
400  if ( temp_clients[i]->isEnabled() )
401  temp_clients[i]->keyReleaseEvent(unicode_ch, key);
402  }
403 
408  {
409  makeCurrent();
410  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
411  for( unsigned i=0; i<temp_clients.size(); ++i )
412  if ( temp_clients[i]->isEnabled() )
413  temp_clients[i]->destroyEvent();
414  destroyAllOpenGLResources();
415  eraseAllEventListeners();
416  }
417 
420  {
421  makeCurrent();
422  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
423  for( unsigned i=0; i<temp_clients.size(); ++i )
424  if ( temp_clients[i]->isEnabled() )
425  temp_clients[i]->updateEvent();
426  }
427 
429  void dispatchVisibilityEvent(bool visible)
430  {
431  makeCurrent();
432  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
433  for( unsigned i=0; i<temp_clients.size(); ++i )
434  if ( temp_clients[i]->isEnabled() )
435  temp_clients[i]->visibilityEvent(visible);
436  }
437 
439  // - called as soon as the OpenGL context is available but before the first resize event
440  // - when initEvent() is called all the supported OpenGL extensions are already available
441  // - when initEvent() is called the window has already acquired its width and height
442  // - only the enabled event listeners receive this message
444  {
445  makeCurrent();
446  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
447  for( unsigned i=0; i<temp_clients.size(); ++i )
448  if ( temp_clients[i]->isEnabled() )
449  temp_clients[i]->initEvent();
450  }
451 
453  void dispatchFileDroppedEvent(const std::vector<String>& files)
454  {
455  makeCurrent();
456  std::vector< ref<UIEventListener> > temp_clients = eventListeners();
457  for( unsigned i=0; i<temp_clients.size(); ++i )
458  if ( temp_clients[i]->isEnabled() )
459  temp_clients[i]->fileDroppedEvent(files);
460  }
461 
463  const std::set<EKey>& keyboard() const { return mKeyboard; }
464 
466  bool isKeyPressed(EKey key) const { return mKeyboard.find(key) != mKeyboard.end(); }
467 
469  void keyPress(EKey key) { mKeyboard.insert(key); }
470 
472  void keyRelease(EKey key) { mKeyboard.erase(key); }
473 
475  bool isInitialized() const { return mIsInitialized; }
476 
478  int vertexAttribCount() const { return mVertexAttribCount; }
479 
481  int textureImageUnitCount() const { return mTextureImageUnitCount; }
482 
485  int textureCoordCount() const { return mTextureCoordCount; }
486 
488  bool hasDoubleBuffer() const { return mHasDoubleBuffer; }
489 
490  // --- render states management ---
491 
493  void useGLSLProgram(const GLSLProgram* glsl);
494 
500  void bindVAS(const IVertexAttribSet* vas, bool use_vbo, bool force);
501  void bindVAS_Attribs(const IVertexAttribSet* vas, bool use_vbo);
502  void bindVAS_Fixed(const IVertexAttribSet* vas, bool use_vbo);
503  void bindVAS_Reset();
504 
506  void applyEnables( const EnableSet* cur );
507 
509  void applyRenderStates( const RenderStateSet* cur, const Camera* camera );
510 
512  void resetEnables();
513 
515  void resetRenderStates();
516 
519  {
520  mDefaultRenderStates[rs_slot.type()] = rs_slot;
521  // if we are in the default render state then apply it immediately
522  if (!mCurrentRenderStateSet->hasKey(rs_slot.type()))
523  {
524  mDefaultRenderStates[rs_slot.type()].apply(NULL, this); VL_CHECK_OGL();
525  }
526  }
527 
529  const RenderStateSlot& defaultRenderState(ERenderState rs) { return mDefaultRenderStates[rs]; }
530 
532  void resetContextStates(EResetContextStates start_or_finish);
533 
535  void setTexUnitBinding(int unit_i, ETextureDimension target)
536  {
537  VL_CHECK(unit_i <= VL_MAX_TEXTURE_IMAGE_UNITS);
538  mTexUnitBinding[unit_i] = target;
539  }
540 
543  {
544  VL_CHECK(unit_i <= VL_MAX_TEXTURE_IMAGE_UNITS);
545  return mTexUnitBinding[unit_i];
546  }
547 
548  const GLSLProgram* glslProgram() const { return mGLSLProgram.get(); }
549  GLSLProgram* glslProgram() { return mGLSLProgram.get(); }
550 
551 
553  static bool areUniformsColliding(const UniformSet* u1, const UniformSet* u2);
554 
573  bool isCleanState(bool verbose);
574 
575  public:
576  // constant color
577  const fvec3& normal() const { return mNormal; }
578  const fvec4& color() const { return mColor; }
579  const fvec3& secondaryColor() const { return mSecondaryColor; }
580  const fvec4& vertexAttribValue(int i) const { VL_CHECK(i<VA_MaxAttribCount); return mVertexAttribValue[i]; }
581 
582  protected:
585  std::vector< ref<FramebufferObject> > mFramebufferObject;
586  std::vector< ref<UIEventListener> > mEventListeners;
587  std::set<EKey> mKeyboard;
598  std::string mExtensions;
599 
600  // --- Render States ---
601 
602  // default render states
603  RenderStateSlot mDefaultRenderStates[RS_RenderStateCount];
604 
605  // applyEnables()
608 
609  // applyRenderStates()
612 
613  // for each texture unit tells which target has been bound last.
614  ETextureDimension mTexUnitBinding[VL_MAX_TEXTURE_IMAGE_UNITS];
615 
616  // current GLSL
619 
620  private:
621  struct VertexArrayInfo
622  {
623  VertexArrayInfo(): mBufferObject(0), mPtr(0), mEnabled(false) {}
624  int mBufferObject;
625  const unsigned char* mPtr;
626  bool mEnabled;
627  };
628 
629  protected:
630  // --- VertexAttribSet Management ---
632  VertexArrayInfo mVertexArray;
633  VertexArrayInfo mNormalArray;
634  VertexArrayInfo mColorArray;
635  VertexArrayInfo mSecondaryColorArray;
636  VertexArrayInfo mFogArray;
637  VertexArrayInfo mTexCoordArray[VA_MaxTexCoordCount];
638  VertexArrayInfo mVertexAttrib[VA_MaxAttribCount];
639 
640  // save and restore constant attributes
644  fvec4 mVertexAttribValue[VA_MaxAttribCount];
645  GLuint mDefaultVAO;
646 
647  private:
648  void setupDefaultRenderStates();
649  };
650  // ----------------------------------------------------------------------------
651 }
652 
653 #endif
virtual void setWindowTitle(const String &)
If the OpenGL context is a top window this function sets its title.
const fvec4 & color() const
const IVertexAttribSet * mCurVAS
int vertexAttribCount() const
The number (clamped to VA_MaxAttribCount) of generic vertex attributes as returned by glGet(GL_MAX_VE...
void dispatchKeyReleaseEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyReleaseEvent() notification to the subscribed UIEventListener obje...
const fvec3 & secondaryColor() const
Vector2< int > ivec2
A 2 components vector with int precision.
Definition: Vector2.hpp:279
void dispatchInitEvent()
Dispatches the UIEventListener::initEvent() notification to the subscribed UIEventListener objects...
Abstract interface to manipulate OpenGL&#39;s vertex attribute arrays.
void keyRelease(EKey key)
Removes the specified key from the set of currently active keys - For internal use only...
void setAccumRGBABits(int r, int g, int b, int a)
bool isInitialized() const
Returns true if the OpenGLContext is in an initialized state.
VertexArrayInfo mSecondaryColorArray
ERenderState
void setDoubleBuffer(bool double_buffer_on)
void dispatchMouseDownEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseDownEvent() notification to the subscribed UIEventListener objec...
The UIEventListener class listens to the events emitted by an OpenGLContext.
std::vector< ref< UIEventListener > > mEventListeners
void ignoreNextMouseMoveEvent()
Requests not to dispatch the next mouse move event.
RenderState wrapping the OpenGL function glNormal(), see also http://www.opengl.org/sdk/docs/man/xhtm...
Definition: Shader.hpp:162
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
VertexArrayInfo mFogArray
int multisampleSamples() const
const FramebufferObject * framebuffer() const
The default render target (always returns leftFramebuffer()).
const T_Scalar & r() const
Definition: Vector4.hpp:112
ETextureDimension texUnitBinding(int unit_i) const
Returnes the texture target currently active for the specified texture unit. - For internal use only...
void setDepthBufferBits(int bits)
int bitsPerPixel() const
Returns rgbaBits().r() + rgbaBits().g() + rgbaBits().b() + rgbaBits().a()
virtual void hide()
If the OpenGL context is a widget this function makes it invisible to the user.
int textureImageUnitCount() const
The number (clamped to VL_MAX_TEXTURE_IMAGE_UNITS) of texture image units supported by the current ha...
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
STL namespace.
UIEventListener * eventListener(int i)
Returns the i-th UIEventListener registered to an OpenGLContext.
const std::set< EKey > & keyboard() const
Returns the std::set containing the currently pressed keys.
ref< NaryQuickMap< ERenderState, RenderStateSlot, RS_RenderStateCount > > mCurrentRenderStateSet
EOpenGLProfile
virtual void setPosition(int, int)
If the OpenGL context is a widget this function sets its position.
virtual bool fullscreen() const
If the OpenGL context is a widget this function returns whether it has been maximized to fullscreen...
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
Definition: GLSL.hpp:233
void dispatchVisibilityEvent(bool visible)
Dispatches the UIEventListener::visibilityEvent() notification to the subscribed UIEventListener obje...
void setContextClientVersion(int version)
Used by EGLWindow to initialize either GLES 1.x or GLES 2.x contexts.
VertexArrayInfo mVertexArray
ref< NaryQuickMap< EEnable, EEnable, EN_EnableCount > > mNewEnableSet
void setDefaultRenderState(const RenderStateSlot &rs_slot)
Defines the default render state slot to be used by the opengl context.
void dispatchKeyPressEvent(unsigned short unicode_ch, EKey key)
Dispatches the UIEventListener::keyPressEvent() notification to the subscribed UIEventListener object...
void dispatchResizeEvent(int w, int h)
Dispatches the UIEventListener::resizeEvent() notification to the subscribed UIEventListener objects...
virtual void quitApplication()
Asks to the windowing system that is managing the OpenGLContext to quit the application.
std::string mExtensions
FramebufferObject * framebuffer()
The default render target (always returns leftFramebuffer()).
EResetContextStates
void keyPress(EKey key)
Inserts the specified key in the set of currently active keys - For internal use only.
T log(T a)
Definition: glsl_math.hpp:486
void setFullscreen(bool fullscreent)
RenderState wrapping the OpenGL function glColor(), see also http://www.opengl.org/sdk/docs/man/xhtml...
Definition: Shader.hpp:94
const std::vector< ref< UIEventListener > > & eventListeners() const
The currently UIEventListener registered to be notified of OpenGLContext related events.
const fvec3 & normal() const
EReadDrawBuffer
Visualization Library main namespace.
const FramebufferObject * rightFramebuffer() const
The render target representing the default right framebuffer (if a stereo OpenGL context is present)...
int eventListenerCount() const
Returns the number of UIEventListener registered to an OpenGLContext.
virtual void show()
If the OpenGL context is a widget this function makes it visible to the user.
const OpenGLContextFormat & openglContextInfo() const
Returns an OpenGLContextFormat structure describing an OpenGLContext.
virtual void setSize(int, int)
If the OpenGL context is a widget this function sets its size.
const T_Scalar & g() const
Definition: Vector4.hpp:113
bool continuousUpdate() const
If the OpenGL context is a widget this function returns whether its area is continuously updated at e...
FramebufferObject * createFramebufferObject()
Equivalent to "createFramebufferObject(0,0);".
void setRGBABits(int r, int g, int b, int a)
void dispatchUpdateEvent()
Dispatches the UIEventListener::updateEvent() notification to the subscribed UIEventListener objects...
The OpenGLContextFormat class encapsulates the settings of an OpenGL rendering context.
virtual void setContinuousUpdate(bool continuous)
If the OpenGL context is a widget this function sets whether its area is continuously updated at each...
const ivec4 & rgbaBits() const
void setOpenGLContextInfo(const OpenGLContextFormat &info)
Sets the OpenGLContextFormat associated to an OpenGLContext.
Vector4< int > ivec4
A 4 components vector with int precision.
Definition: Vector4.hpp:276
RenderState wrapping the OpenGL function glVertexAttrib(), see also http://www.opengl.org/sdk/docs/man3/xhtml/glVertexAttrib.xml for more information.
Definition: Shader.hpp:60
int height() const
Returns the height in pixels of an OpenGLContext.
The base class for all the reference counted objects.
Definition: Object.hpp:158
ref< FramebufferObject > mRightFramebuffer
GLSLProgram * glslProgram()
std::set< EKey > mKeyboard
virtual ivec2 position() const
If the OpenGL context is a widget this function returns its position.
const GLSLProgram * glslProgram() const
const ivec4 & accumRGBABits() const
virtual void setMousePosition(int, int)
If the OpenGL context is a widget this function sets the mouse position.
int width() const
Returns the width in pixels of an OpenGLContext.
VertexArrayInfo mColorArray
int textureCoordCount() const
The number (clamped to VL_MAX_LEGACY_TEXTURE_UNITS) of fixed function pipeline texture units supporte...
virtual void apply(const Camera *camera, OpenGLContext *ctx) const
EMouseButton
const fvec4 & vertexAttribValue(int i) const
VertexArrayInfo mNormalArray
const T_Scalar & b() const
Definition: Vector4.hpp:114
void dispatchMouseWheelEvent(int n)
Dispatches the UIEventListener::mouseWheelEvent() notification to the subscribed UIEventListener obje...
int contextClientVersion() const
Used by EGLWindow to initialize either GLES 1.x or GLES 2.x contexts.
#define NULL
Definition: OpenGLDefs.hpp:81
const UIEventListener * eventListener(int i) const
Returns the i-th UIEventListener registered to an OpenGLContext.
A set of RenderState objects managed by a Shader.
EOpenGLProfile openGLProfile() const
virtual bool mouseVisible() const
If the OpenGL context is a widget this function returns whether the mouse is visible over it or not...
ref< FramebufferObject > mLeftFramebuffer
bool isKeyPressed(EKey key) const
Returns true if the given key is pressed.
ETextureDimension
void setVersion(int majv, int minv)
Sets the OpenGL version you want to access when using vl::GLP_Compatibility or vl::GLP_Core profiles ...
void dispatchDestroyEvent()
Dispatches the UIEventListener::destroyEvent() notification to the subscribed UIEventListener(s), calls destroyAllOpenGLResources() and eraseAllEventListeners() This event must be issued just before the actual GL context is destroyed.
void setOpenGLProfile(EOpenGLProfile p)
The OpenGL profile you&#39;d like to access.
void dispatchFileDroppedEvent(const std::vector< String > &files)
Dispatches the UIEventListener::fileDroppedEvent() notification to the subscribed UIEventListener obj...
#define VL_CHECK_OGL()
Definition: OpenGL.hpp:156
#define VL_INSTRUMENT_ABSTRACT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:145
Implements a framebuffer object to be used as a rendering target as specified by the ARB_framebuffer_...
bool hasDoubleBuffer() const
Returns true if an OpenGLContext supports double buffering.
ref< GLSLProgram > mGLSLProgram
void dispatchMouseMoveEvent(int x, int y)
Dispatches the UIEventListener::mouseMoveEvent() notification to the subscribed UIEventListener objec...
void setVSync(bool vsync_on)
OpenGLContextFormat mGLContextInfo
ERenderState type() const
void setMultisampleSamples(int samples)
A set of Uniform objects managed by a Shader.
Definition: UniformSet.hpp:50
void setStereo(bool stereo_on)
const FramebufferObject * leftFramebuffer() const
The render target representing the default left framebuffer.
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.
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
void setMultisample(bool multisample_on)
FramebufferObject * leftFramebuffer()
The render target representing the default left framebuffer.
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
Definition: Camera.hpp:49
virtual void setMouseVisible(bool)
If the OpenGL context is a widget this function sets whether the mouse is visible over it or not...
virtual void getFocus()
If the OpenGL context is a widget this function requests the mouse focus on it.
FramebufferObject * rightFramebuffer()
The render target representing the default right framebuffer (if a stereo OpenGL context is present)...
#define VL_CHECK(expr)
Definition: checks.hpp:73
ref< NaryQuickMap< EEnable, EEnable, EN_EnableCount > > mCurrentEnableSet
std::vector< ref< FramebufferObject > > mFramebufferObject
ref< NaryQuickMap< ERenderState, RenderStateSlot, RS_RenderStateCount > > mNewRenderStateSet
const RenderStateSlot & defaultRenderState(ERenderState rs)
Returns the default render state slot used by VL when a specific render state type is left undefined...
void setStencilBufferBits(int bits)
RenderState wrapping the OpenGL function glSecondaryColor(), see also http://www.opengl.org/sdk/docs/man/xhtml/glSecondaryColor.xml for more information.
Definition: Shader.hpp:128
const T_Scalar & a() const
Definition: Vector4.hpp:115
virtual bool setFullscreen(bool)
If the OpenGL context is a widget this function requests a maximization to fullscreen.
A set of enables managed by Shader.
Definition: EnableSet.hpp:47
void dispatchMouseUpEvent(EMouseButton button, int x, int y)
Dispatches the UIEventListener::mouseUpEvent() notification to the subscribed UIEventListener objects...