Time for action—building a fountain in the scene

We will demonstrate how to implement a basic particle fountain. The simulation of a fountain can be described as follows: firstly, the water emitted from a point rises with a certain initial speed; then the speed decreases due to gravity of the earth, until reaching the highest point; after that, the water drops fall down onto the ground or into the pool. To achieve this, an osgParticle::ParticleSystem node, along with an emitter and a program processor, should be created and added to the scene graph.

  1. Include the necessary headers:
    #include <osg/MatrixTransform> #include <osg/Point> #include <osg/PointSprite> #include <osg/Texture2D> #include <osg/BlendFunc> #include <osgDB/ReadFile> #include <osgGA/StateSetManipulator> ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.