Skip to content
xarray edited this page Mar 5, 2014 · 15 revisions

Welcome to the osgRecipes wiki!

The project is managed by Wang Rui

Cookbook

This project is the source code repository of Rui Wang & Xuelei Qian's book OpenSceneGraph 3.0 Cookbook, Packt Publishing, 2012. You may read more details or order this book at: http://www.packtpub.com/openscenegrap-3-for-advanced-3d-programming-using-api-cookbook/book

Integrations

This section will show you how to integrate OSG with different kinds of libraries and SDKs. These libraries can add extra functionalities like special effects, visual components and interaction methods to your OSG scene and greatly improve the performance of the applications. These libraries must be free for downloading and for non-commercial purpose of use. The license of the example code may vary according to the license of the third- party library if it does not fit the public domain.

GUI components

AGG

Use AGG (Anti-Grain Geometry) - the high fidelity 2D graphics library with OSG.

http://www.antigrain.com/

AGG example

Setup & use: just run the program, copying font file to valid directory.

Future plan: none.

AntTweakBar

A light and intuitive GUI framework.

http://www.antisphere.com/Wiki/tools:anttweakbar

AntTweakBar example

Setup & use: just operate on the embedded GUI window.

Future plan: none.

Awesomium

A web-browser framework for in-app browsing and HTML UIs.

http://awesomium.com/

Awesomium example

Setup & use: load websites (including HTML5 and Flash) to OSG images.

Future plan: load native files, execute JavaScript programs, and improve the efficiency.

MyGUI

A fast, flexible and simple GUI.

http://mygui.info/

MyGUI example

Setup & use: copy MyGUI media files and default resource XMLs to correct locations and then run the demo.

Future plan: support IMEs.

VLC

A cross-platform multimedia player and framework.

http://www.videolan.org/vlc/

VLC example

Setup & use: put the executable into VLC path, then load movies to OSG images using the command:

./osgvlc movie_file_or_stream

Future plan: improve the efficiency.

Visual effects

Microsoft DirectWrite

A text-layout and glyph-rendering API. You may find it in the Windows SDK.

DirectWrite example

Setup & use: draw texts on a quad and render it in the scene.

Future plan: Finish the custom text renderer to support all kinds of layouts.

Spark

A crossplatform particle engine.

http://spark.developpez.com/

Spark example

Setup & use: copy integrations/data to executable path, then run with any of the following argument:

./osgspark [--simple/--explosion/--fire/--rain/--smoke]

Future plan: add more effects, and add support for particle callbacks.

ngPlant

A plant modeling software suite.

The source code is already included in the source code. You may also visit http://ngplant.sourceforge.net for updates.

ngPlant example

Setup & use: copy integrations/data to executable path, then view the loaded tree model.

Future plan: use GLSL to improve the rendering, and consider some more effects on plants.

Interactions

libGizmo

Gizmo control library for 3D object manipulation.

https://github.com/CedricGuillemet/LibGizmo

libGizmo example

Setup & use: direct drag the gizmo to manipulate, scroll mouse to change gizmo types, and use CTRL and mouse to navigate scene as usual.

Future plan: none.

Microsoft Kinect SDK

http://www.microsoft.com/en-us/kinectforwindows/develop/developer-downloads.aspx

Microsoft Kinect example

Setup & use: install the XBox Kinect device, and act in front of it.

Future plan: use Kinect to control real human skeletons.

OpenNI

A natural interaction devices middleware, including Kinect.

http://www.openni.org/

Setup & use: install the XBox Kinect device (with OpenNI/NITE driver), and act in front of it.

Future plan: use Kinect to control real human skeletons.

TUIO

A common API for tangible multitouch surfaces.

The source code is already included in the source code. You may also visit http://www.tuio.org/ for updates.

TUIO example

Setup & use: install a TUIO server on some other device (e.g., TUIOpad on iPad, and TUIOdroid on Android), setup the server to connect to correct IP and port (3333), and control the scene with multi-touch gestures.

Future plan: none.

Physics components

Box2D

A 2D physics engine for games.

http://box2d.org/

Box2D example

Setup & use: Press Left/Right/Up/Down keys on the keyboard to fire disks to hit the boxes.

Future plan: add more physics features (joints, ropes and vehicles).

Bullet

A professional free 3D game multiphysics library.

http://bulletphysics.org/wordpress/

Setup & use: simulate the scene and fire sphere objects to the box wall with Enter key.

Future plan: add more physics features (joints, cloth, soft bodies and characters).

NVIDIA PhysX version 3.2

A well-rounded physics engine.

http://developer.nvidia.com/physx-downloads

PhysX 3.x example

Setup & use: --rigid: simulate the scene and fire sphere objects to the box wall with Enter key.

--cloth: see a sample cloth fall onto a set of sticks

Future plan: add more physics features (joints, soft bodies and characters).

Misc

MicroPather

A path finder and A* solver.

The source code is already included in the source code. You may also visit http://www.grinninglizard.com/MicroPather/ for updates.

MicroPather example

Setup & use: just see the result in any customized maze.

Future plan: none.

RVO2

Reciprocal collision avoidance for realtime multi-agent simulation. Thanks Christian Buchner for the original osgrvo2 example on osg-submissions.

http://gamma.cs.unc.edu/RVO2/

RVO2 example

Setup & use: double click to make spheres move from one place to another, automatically avoiding obstacles.

Future plan: add billboard person animation from Christian Buchner, add 3D support.

Reader/writers

AssImp

A library to import various well-known 3D model formats.

http://assimp.sourceforge.net/

Setup & use: load model files (3ds, obj, dae, etc.) with the .assimp extension:

./osgviewer your_model.dae.assimp

Future plan: import skeleton data, and add more material support.

FreeImage

A library supporting popular image formats.

http://freeimage.sourceforge.net/

Setup & use: load image files (dds, jpg, png, psd, etc.) with the .freeimage extension:

./osgviewer your_image.dds.freeimage

Future plan: add writing functions, and add more options.

OTL

Oracle, Odbc and DB2-CLI template library.

The source code is already included in the source code. You may also visit http://otl.sourceforge.net/ for updates.

Setup & use: load/save data in ODBC databases with the .otl extension (tested with Sqlite3):

Create new table and save first node: ./osgotl --new-table --src cow.osg --output usr/pwd@DSN:table_name:cow.osg.otl Save the second node: ./osgotl --src cessna.osg --output usr/pwd@DSN:table_name:cessna.osg.otl Read one of the nodes: ./osgotl --input usr/pwd@DSN:table_name:cessna.osg.otl

Future plan: tests and fixes for more databases.

SilverLining SDK Triton SDK

The Weather/Cloud library and Ocean library from SunDog: http://www.sundog-soft.com/

The example here is easier to integrate and can render ocean on arbitrary meshes.

SilverLining example Triton example

Setup & use: Start the program and see the source code

Future plan: add ocean and clouds on earth