[osg-users] Simple Loading Tutorial

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Mon Nov 30 06:13:31 PST 2009

Hello Sam,

> When I run the code to load a simple object (that you supplied above) with a direct path, I get no errors but osgviewer seems to load nothing, just the default blue background with no model. Ive tried different .osg and .obj files but no luck.

If you're on Windows, make sure you specify the full path with slashes 
("/") instead of backslashes, or escape the backslashes by doubling them 
("\\"). In a string, a backslash starts an escape sequence (like \n for 
newline, etc.) so if you specify a path like C:\models\bob.obj the 
compiler will not be able to find it because it will interpret \m and \b 
as escape sequences. But using C:/models/bob.obj or C:\\models\\bob.obj 
will work.

Also, make sure you have the plugin to read your model's file format. 
Set the notify level higher (set OSG_NOTIFY_LEVEL=DEBUG) to see what's 
going on - OSG will print out whether it can find and open the plugin to 
read your model, and then whether it can read the model itself, in the 
console (stdout and stderr).

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list