Skylark wrote:
> Hello Evan,
>
> We will not be able to help much if you don't show your code, because
> what you describe is very simple and should work (at least as far as we
> can see from your description). If we see the code we might be able to
> tell you what's wrong.
>
> Also, have you looked at the OSG examples and the Getting Started Guide
> to make sure you're doing things right?
>
> J-S
> --
> ------------------
> Post generated by Mail2Forum
Hello,
Yes, I followed the startup guide to get OSG working on my computer. This is
the simple code that I was trying:
Code:
#include <osg/Group>
#include <osg/LightSource>
#include <osg/ShapeDrawable>
#include <osgViewer/Viewer>
using namespace osg;
// main function
int main()
{
// create the root node of the scene graph
ref_ptr<Group> root = new Group;
// create a node to the geometry of a spherical object
ref_ptr<Geode> ballNode = new Geode;
ballNode->addDrawable(new ShapeDrawable(new Sphere));
// create a "distant" light, with 0 for the homogeneous coord
Vec4 lightDirection(1, -1, 1, 0);
ref_ptr<LightSource> ls = new LightSource;
ls->getLight()->setPosition(lightDirection);
// set the intensity properties for the light
ls->getLight()->setAmbient(Vec4(0.2, 0.2, 0.2, 1.0));
ls->getLight()->setDiffuse(Vec4(1.0, 1.0, 0.7, 1.0));
ls->getLight()->setSpecular(Vec4(1.0, 0, 0, 1.0));
// assemble the node hierarchy
root->addChild(ls.get());
root->addChild(ballNode.get());
// create the viewer helper object
osgViewer::Viewer viewer;
viewer.setSceneData(root.get());
viewer.realize();
while( !viewer.done() )
{
viewer.frame();
}
return 0;
}
Thanks in advance for your help.
~Evan
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=35003#35003
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org