Quantcast
Channel: Programming and Technology » 2.9.6
Viewing all articles
Browse latest Browse all 3

osgART 2.0 RC3 with OpenSceneGraph 2.9.7 or later (including 3.0.0)

$
0
0

Long time ago I had problems using osgART 2.0 RC3 with OpenSceneGraph 2.9.7 or later, I couldn’t get the video feed from the webcam on the background so I only used OpenSceneGraph 2.9.6. Today I found out that my osgART program could work with OpenSceneGraph 2.9.7 or later (current version 3.0.0 works too!), but as I always used 2.9.6 I didn’t know I have founded the solution to this problem!

NOTE: If you want to install OpenSceneGraph 3.0.0 in Ubuntu 11.10 or Ubuntu 12.04 you’ll have to use the patches I’ve created and uploaded to my github repository.

The key of the problem is that when you configure the video backgrounds osgART::VideoGeode you can use TEXTURE_2D or TEXTURE_RECTANGLE. If you use TEXTURE_RECTANGLE it will work on newer versions of OpenSceneGraph. You can look at line 40 of “examples/osgartsimple/osgartsimple.cpp” in osgART 2.0 RC3 source code folder:

osg::Group* createImageBackground(osg::Image* video) {
        osgART::VideoLayer* _layer = new osgART::VideoLayer();
        _layer->setSize(*video);
        osgART::VideoGeode* _geode = new osgART::VideoGeode(osgART::VideoGeode::USE_TEXTURE_2D, video);
        addTexturedQuad(*_geode,video->s(),video->t());
        _layer->addChild(_geode);
        return _layer;
}

If you installed OpenSceneGraph 2.9.7 or later and compiled osgART 2.0 RC3 as it comes in the original code, when you execute this example from “/usr/local/bin/osgartsimple” you will get this as you show the “Hiro” pattern to the camera:

If you change previous code this way:

osg::Group* createImageBackground(osg::Image* video) {
        osgART::VideoLayer* _layer = new osgART::VideoLayer();
        _layer->setSize(*video);
        osgART::VideoGeode* _geode = new osgART::VideoGeode(osgART::VideoGeode::USE_TEXTURE_RECTANGLE, video);
        addTexturedQuad(*_geode,video->s(),video->t());
        _layer->addChild(_geode);
        return _layer;
}

Then compile and install osgART 2.0 RC3 again, “/usr/local/bin/osgartsimple” will work OK.


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images