VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
8.5 - Making OpenGL Calls from OSG Drawables

Table of Contents

It is possible to call OpenGL directly from an OSG drawable.

It is very easy to corrupt the scene rendering when you do this. OSG maintains a copy of the OpenGL state in its own state object osg::State. If this state object and the actual OpenGL state are not synchronized, then the rendering will not be correct. If you must call OpenGL directly, you must undo any changes to the OpenGL state that you make. After your code is executed, the OpenGL state must be returned to the values it had before your code was executed. This will ensure that the OSG and OpenGL states are synchronized.

The following pseudo-code is an example of what must happen for all OpenGL states:

//For all states you want, check the existing OSG state.
If(osg_state != desired_state)
{
OPENGL_setState(desired_state);
}
//Call render commands
OPENGL_renderCommands();
//For all states you changed, restore back to the OSG state.
If(osg_state != desired_state)
{
OPENGL_setState(osg_state);
}

8.5.1 Debugging OpenGL

OpenGL has a callback that sends debug messages to the console. To enable this callback, set the VRV_GL_DEBUG environment variable to any value. (The value does not matter. The environment variable just needs to exist.)

[<< Cockpit Display Updaters] [Home] [Transforming Nodes Programmatically >>]


Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)