[osg-users] osg debugging question

Christian Sam osgforum at tevs.eu
Mon Mar 2 09:59:04 PST 2009


i wanted to debug an osg example (osgtessellate) to see how the number of primitives changes inside a "Geode" instance while tessellation is done. first of all, let me tell you that i'm not only new to osg, but also to debugging c++ applications, so if something seems strange the way i have done please let me know.

first, i changed the scope of the object i was interessed in to global scope:

osg::Group *makeTessellateExample (void) {
    osg::Group *grp=new osg::Group;
    osg::Geode gd=new osg::Geode;

extern osg::Geode *gd=0;
osg::Group *makeTessellateExample (void) {
    osg::Group *grp=new osg::Group;
    gd=new osg::Geode;

then i set a breakpoint inside a function of the applicationcode, which is also called once initalization is done.

bool KeyboardEventHandle::handle(...
	    if (_scene && ea.getKey()=='n')  <<< BREAKPOINT >>>

finally when i pressed 'n' during runtime i could inspect the Geode instance in debugmode.


my questions are:

* at first i had some problems to find a suited place for the breakpoint, to pause the debugger so i can inspect my object. if there wouldn't be the keyboard-event-handler function inside the osgtessellation example, nothing inside the applicationcode would be re-called once initialization is done. so whats the preferred place for a breakpoint if viewer.run() is used?

* if i don't set a breakpoint, than it seems there is another possibility to pause the debugger of my IDE (vs 8.0). it's called "BREAK ALL" and program flow is paused inside of an arbitrary OSG function (xutility, vector, etc.). but from there i dont' have access to my Geode instane (because it's out of scope?). so whats the best way to debug an osg application?

thanks in advance,

Read this topic online here:

More information about the osg-users mailing list