ofxOpenSceneGraph

Hi all,

I want to announce a new openframeworks-addon called ofxOpenSceneGraph, it helps embedding OpenFrameworks with OpenSceneGraph, so you can use the same open-gl-context for your output etc.

OpenSceneGraph is a open-source, cross-plattform scene-graph ontop of OpenGL, with a mature feature-set and a lot of im- and exporters. It’s not as easy to learn as OpenFrameworks, but definitely a nice piece of open-source-software. have a look at http://openscenegraph.org

Here’s a screenshot of one of the sample-apps:

Here you can get the add-on: https://github.com/stmh/ofxOpenSceneGraph. But be aware, that this code is in its early stages and not bulletproof.

cheers,
Stephan

Sweet!!!

Thanks for sharing! This is really a great add-on!!!

HI @sth ! I’m tryng to use your addon with Ubuntu 11.04 and OF007 . After putting the addons in the addons OF folder i have create a linux folder in ofxOpenSceneGraph/lib folder. Here i stored all the libs and the plugins of osg.
I would try the simpleviewerExample but i receive this error at line 19 of ofxOsgApp.h:

…/…/…/addons/ofxOpenSceneGraph/src/ofxOsgApp.h|19|error: ‘NULL’ was not declared in this scope|

How to fix it? or i miss something?

p.s.: i’m using codeblocks 10.05 and makefile

this http://stackoverflow.com/questions/462165/error-null-was-not-declared-in-this-scope help me for the NULL issue. Just place

#include

after the ofxOsgApp header #define . But now another issue maybe because i’m working with OF007 and not OF0062:

…/…/…/addons/ofxOpenSceneGraph/src/ofxAppOsgWindow.cpp: In member function ‘virtual void ofCameraPreDrawCallback::operator()(osg::RenderInfo&) const’:
…/…/…/addons/ofxOpenSceneGraph/src/ofxAppOsgWindow.cpp:238:38: error: ‘ofBgColorPtr’ was not declared in this scope
…/…/…/addons/ofxOpenSceneGraph/src/ofxAppOsgWindow.cpp:239:38: error: ‘ofbClearBg’ was not declared in this scope
…/…/…/addons/ofxOpenSceneGraph/src/ofxAppOsgWindow.cpp:256:27: error: ‘ofSetupScreen’ was not declared in this scope
make: *** [obj/i686Debug/addons/ofxOpenSceneGraph/src/ofxAppOsgWindow.o] Error 1

I have to check this, but suggestions are really appreciated…thanks!

OOOH yesss! Able to run OpenSceneGraph in Ubuntu 11.04 with OF 007!!

First, for who is intersted, add :

#include “ofMain.h”

in ofxAppOsgWindow.cpp at the beginning of all #include, and then pay attention to include in config.make -losg and -losgViewer . As soon as possible i will put the modified version on my github repo. I’m intersted in OpenSceneGraph because i discovered the plugins that handle terrains. You can use very big terrains and visualize them. It use a cache paging method and LOD mechanism. I’m searching a library that can do this and maybe i have found what i was searching. Anyway it is not sure that is possible to use osgTerrain with openframework… all a sort of issues could be happen, but i wll try it. At this time i have done a lot of research in the field of terrain visualizations. I ve found libMini http://stereofx.org/terrain.html and i ve begun to develop an addon for OF. But it’s not so easy i found some issues that i’ve no idea how to fix. In this days i will ask in the OF forum for this.
well, at the end, if someone have experience wih the ofxOpeneSceneGraph addons and want share experience and/ or just say what did with it, well , don’t esitate it is the right place and the right moment!

Hi kalwait,

Nice to hear you got it working on Linux. If you like, you can send me a pull request on github with your changes. I had no spare time to update the addon to of 007, but i’ll test your changes on my end, if you like.

osgterrain should work with ofxOpenSceneGraph. It’s pretty powerful and fast, i created a 1.8gb terrain out of the blue marble dataset, and it ran with 60fps. There’s also osgEarth to map openstreetmap, google earth or other data on the fly…

Hi stephan , I was able to run osgterrain inside OF! see the screenshot attached it is a big terrain (Puget Sound) from http://www.cc.gatech.edu/projects/large-models/ps.html . i have a little issues, see the different square coloured. maybe something wrong when i transfered the files from my external hard disk? in the example osgterrain i haven’t this issues.

Nice to hear you got it working on Linux. If you like, you can send me a pull request on github with your changes. I had no spare time to update the addon to of 007, but i’ll test your changes on my end, if you like.

yes i want put in the my forked repo all the changes and the some examples more and then i will send to you a pull request.

osgterrain should work with ofxOpenSceneGraph. It’s pretty powerful and fast, i created a 1.8gb terrain out of the blue marble dataset, and it ran with 60fps. There’s also osgEarth to map openstreetmap, google earth or other data on the fly…

there are many interesting features in osg that make me astonished…

I have uploaded the modified version on my github repo: https://github.com/kalwalt/ofxOpenSceneGraph
You can test the examples. I would be happy if someone take a look at the bugs in the example osgTerrain. Sure is due to the type of textures used and that for some reason is not handled properly in OF. I’m also doing some simple examples with sound and ofxOpenSceneGraph. For now I could use it with the basic sound of OF, but also ofxMidi and ofxPd. I think that we can also work with ofxOsc. I tried to use the basic graphics functionality of OF, but the discussion here is more problematic. For example you can not use ofCircle, ofLine, ofDrawBitmapString … You can import a ofImage but you can not use the draw() method. I wish I could use ofxOpenCv but first we must work out how to capture images and manipulate them with OSG. In short I would like to use OSG to render a terrain and Openframework for sound and OpenCV, (perhaps with kinect?). Soon there will be other examples, so if anyone wants to take a look and maybe a contribution …
Cheers

Walter

The bug with terrains are fixed, there are still problems with OF 007 and osg, as all drawing of OF007 is not visible. I’ll investigate further.

All code changes are done on a separate branch: https://github.com/stmh/ofxOpenSceneGraph/tree/pull-request-007-linux

cheers,
Stephan

that’s great! I take a look into the code right now!

The osgTerrain example works perfectly now! See the screenshot. i think this is a great addon. I will upload in this week end the other examples with the sound. I have also tried ofxOpenCv with ofxOpenSceneGraph, but i’have receive issues with Gstreamer. Maybe was related with the issue with the osgTerrain( i mean the OpenGL)? I will try again. I think if we can use ofxOpenCv inside will be great because i don’t find OpenCV plugins for OSG ( yes,of course you can begin your implementation…).
Apart from this I will not stop to thank Stephan for your work! Thanks a lot!

there is an updated version of the addon in my repo https://github.com/kalwalt/ofxOpenSceneGraph/tree/develop it works with the new changes in ofEvent . Tested in ubuntu 12.04, Windows 7 with VS2010 and OF 0074.