Hi Oliver,

On Wed, 2005-09-07 at 21:30 +0200, Oliver Kutter wrote:
> 
> Sure, very interested.

here you go. It's pretty simple.

Hope it helps

        Dirk

// registerGLObject: shows how to reserve OpenGL IDs that OpenSG will not use.
// Useful for integrating other OpenGL code into an OpenSG program.

#include <OpenSG/OSGGLUT.h>
#include <OpenSG/OSGConfig.h>
#include <OpenSG/OSGWindow.h>

OSG_USING_NAMESPACE

// A dummy function to be registered as a callback.
// This is necessary on older versions of OpenSG. Current versions can use
// NULL instead, see below.
void dummy(Window*, UInt32)
{
}

// Initialize GLUT & OpenSG and set up the scene
int main(int argc, char **argv)
{
    osgInit(argc,argv);

    // Register a dummy callbak that is never called
    // Necessary on older versions (before 1.6)
    UInt32 id = Window::registerGLObject(osgTypedFunctionVoidFunctor2Ptr<Window, 
                                                          UInt32>(dummy), 1);

    std::cout << "Reserved 1 id: " << id << std::endl;

    // Use NULL as the callback. It's never called anyway.    
    id = Window::registerGLObject(osgTypedFunctionVoidFunctor2Ptr<Window, 
                                                          UInt32>(NULL), 5);

    std::cout << "Reserved 5 ids starting at: " << id << std::endl;
 
    osgExit();
    return 0;
}

Reply via email to