SoGLCallback Class Reference
[Nodes]

Provides custom OpenGL behavior during rendering actions. More...

#include <Inventor/nodes/SoGLCallback.h>

Inheritance diagram for SoGLCallback:
SoCallback SoNode SoFieldContainer SoBase SoRefCounter SoTypedObject

List of all members.

Public Member Functions

virtual SoType getTypeId () const
 SoGLCallback ()

Static Public Member Functions

static SoType getClassTypeId ()

Detailed Description

Provides custom OpenGL behavior during rendering actions.

This node behaves exactly like an SoCallback except... the SoGLCallback node allows the application to make OpenGL calls during a render traversal. It is normally used to make OpenGL rendering calls (and any state setting calls needed for rendering).

SoGLCallback automatically calls glPushAttrib() to save the OpenGL state before executing the callback and then calls glPopAttrib() (restore) after executing the callback, ensuring that OpenGL state cannot leak outside the node.

Please note that this means an SoGLCallback node cannot modify the OpenGL state used for Open Inventor rendering. (This is a change since Open Inventor 10.0) You must use standard Open Inventor nodes to modify state for Open Inventor rendering. For example, use an SoViewport node to change the OpenGL viewport, use the SoDepthBuffer node to change the OpenGL depth buffer test and so on.

You can use this node to get values from the Open Inventor traversal state list using the SoElement classes. For example, SoLineWidthElement contains the current line width set by an SoDrawStyle node.

This node should not be used to do Open Inventor rendering. Open Inventor rendering calls should only be done using an SoCallBack node.

There is some "overhead" for rendering using SoGLCallback instead of Open Inventor nodes. Normal Open Inventor rendering is optimized in various ways to maximize GPU performance and to keep the GPU "busy". When an SoGLCallback node is traversed, Open Inventor must finish all current rendering, execute the application's OpenGL calls, then resume normal rendering.

Create the node:

   SoGLCallback* glCallbackNode = new SoGLCallback();
   glCallbackNode->setCallback( myGLCallback );
   root->addChild( glCallbackNode );

Create the Callback:

The callback function registered with the node will only be executed during SoGLRenderAction traversal, as calling OpenGL functions requires a current OpenGL context.

   void myCallback( void* data, SoAction* action )
   {
     // Safe to call OpenGL functions
   }

FILE FORMAT/DEFAULT

ACTION BEHAVIOR

SEE ALSO

SoAction, SoCallback, SoCallbackAction, SoEventCallback

NOTE: node available since Open Inventor 10.0


Constructor & Destructor Documentation

SoGLCallback::SoGLCallback (  ) 

Constructor.


Member Function Documentation

static SoType SoGLCallback::getClassTypeId (  )  [static]

Returns the type identifier for this class.

Reimplemented from SoCallback.

virtual SoType SoGLCallback::getTypeId (  )  const [virtual]

Returns the type identifier for this specific instance.

Reimplemented from SoCallback.


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

Open Inventor Toolkit reference manual, generated on 12 Sep 2019
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/