Hi everybody,
I'm attempting to add shadows to a scene with the following code using a 
ShadowMapViewport & a PassiveWindow.

ShadowMapViewportPtr svp = ShadowMapViewport::create();
GradientBackgroundPtr gbg = GradientBackground::create();
beginEditCP(gbg);
        gbg->addLine(Color3f(0.7, 0.7, 0.8), 0);
        gbg->addLine(Color3f(0.0, 0.1, 0.3), 1);
endEditCP(gbg);

TransformPtr point1_trans;
PointLightPtr _point1_core;
NodePtr point1 = makeCoredNode<PointLight>(&_point1_core);

// Shadow viewport
beginEditCP(svp);
svp->setBackground(gbg);
svp->setRoot(m_Mgr->getRoot());
svp->setSize(0,0,1,1);
svp->setOffFactor(5.4);
svp->setOffBias(10);
svp->setShadowColor(Color4f(0.2, 0.2, 0.2, 1.0));
svp->setMapSize(1024);
// you can add the light sources here, as default all light source in
// the scenegraph are used.
svp->getLightNodes().push_back(point1);
endEditCP(svp);

    beginEditCP(m_Pwin);//Window
                m_Pwin->replacePort(0, svp);
    endEditCP(m_Pwin);

        beginEditCP(svp);//Viewport
        svp->setCamera(m_Mgr->getCamera());
    endEditCP(svp);

        m_Mgr->turnHeadlightOff();
        NodePtr point1_beacon = makeCoredNode<Transform>(&point1_trans);
        beginEditCP(point1_trans);
                point1_trans->getMatrix().setTranslate(-150.0, 50.0, 0.0);
        endEditCP(point1_trans);

        beginEditCP(_point1_core);
                _point1_core->setAmbient(0.45,0.45,0.45,1);
                _point1_core->setDiffuse(0.5,0.5,0.5,1);
                _point1_core->setSpecular(0.0,0.0,0.0,1);
                _point1_core->setBeacon(point1_beacon);
                _point1_core->setOn(true);
        endEditCP(_point1_core);

        NodePtr n=m_Mgr->getRoot();
        beginEditCP(point1);
                point1->addChild(n);  // was point2
        endEditCP(point1);

    m_Mgr->setRoot(point1);

-------------------------------
now, first problem: when I launch the program, I set a simple root geometry and 
then add the shadowviewport, but the object is always black.
second problem: when I click on the passivewindow the program crashes in an 
OpenSG dll.
Where are the bugs?

thanks!
Davide.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to