Hello Evan,

The default viewer camera position is at (0,0,0), which turns out to be inside your sphere. So you just see the inside of your sphere (not a very interesting view point to be sure! :-) ).

You have used the while(!viewer.done()) viewer.frame() method of coding the main loop, and so no camera manipulator is created automatically by the viewer, and you don't add any camera manipulator yourself, so you will need to set the viewer camera's view matrix yourself to be able to see the object.

Add viewer.getCamera()->setViewMatrixAsLookAt(osg::Vec3(0,-10,0), osg::Vec3(0,0,0), osg::Vec3(0,0,1)); just before your frame loop to see the object. You can also call this method at different times inside the frame loop (or in callbacks) if you want to animate the camera's position.

You could also opt to add a camera manipulator, then you would add viewer.setCameraManipulator(new osgGA::TrackballManipulator); before your frame loop, for example. The camera manipulator will center on your scene's bounds on the first frame, so you will see the whole scene and will be able to move/rotate the camera around.

With either of these changes I can see the sphere just fine (and with the correct yellowish lighting as you've set in your light source's diffuse light color). Of course without a camera manipulator you won't be able to rotate the camera with the mouse (unless you code that yourself in an event handler that sets the camera's view matrix, for example).

As for your OpenGL messages, I don't get any of those when running your code. They could be related to your driver. These messages are sometimes false positives, meaning they may be shown even if nothing is wrong. I would recommend checking if there is an updated driver for your video card and see if they go away.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to