-
Book Overview & Buying
-
Table Of Contents
OpenSceneGraph 3.0: Beginner's Guide
We already had experience of making a scene object translucent using osg::BlendFunc class and rendering orders. The fourth component of the color vector, called the alpha value, will do the trick for us. But what will happen if we have a continuously-changing alpha? The object will be completely transparent (invisible) when alpha is 0, and completely opaque when it is 1.0. The animating process from 0.0 to 1.0 will therefore cause the object to gradually appear to viewers, that is, the fade-in effect.
The update callback can be used in this task. It is no problem to create an osg::NodeCallback based class and set it to the node that will be fading in. But the state attribute callback, osg::StateAttributeCallback, is also available in this case.
The osg::Material class is used here to provide the alpha bit of each geometry vertex, instead of just setting a color array.
Include the necessary headers:
#include <osg/Geode> #include <osg/Geometry> #include...
Change the font size
Change margin width
Change background colour