Open Inventor Reference
SoCacheContextElement Class Reference

Element that stores the cache context. More...

#include <Inventor/elements/SoGLCacheContextElement.h>


Detailed Description

There is a method on the render action to set this; if you are not rendering onto multiple displays, you will not need to set this (assuming that caches are shareable between different windows on the same display, which is true of GLX).

This element should be set before traversal starts, and must not be changed during traversal (you'll get a debug error if a node tries to set the cache context during traversal).

This method also has API for quickly finding out whether or not OpenGL extensions are supported. Code that uses extension "foo" should look something like: #ifdef GL_EXT_foo static int fooExtInt = -1; if (fooExtInt == -1) fooExtInt = SoGLCacheContextElement::getExtID("GL_EXT_foo"); if (SoGLCacheContextElement::extSupported(state, fooExtInt)) { glFoo(... make extension foo calls...); } else { #endif Extension not supported, make regular GL calls #ifdef GL_EXT_foo } #endif

Arranging the code that way ensures that it both compiles on systems that don't support the extension AND will run on any OpenGL-capable machine, even if the application displays on multiple displays (only some of which may support the extension).


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