Hi all,

Sorry to bring up yet another question about 
osg::View::setLightingMode(NO_LIGHT), but I'm having trouble understanding some 
lighting behavior.

Suppose I have a simple scene with no explicitly-specified StateSets ... e.g. 
I'm not setting lights or enabling GL_LIGHTING or anything like that. If I do 
viewer.setLightingMode(NO_LIGHT), then as expected the viewer doesn't set up 
any light and doesn't enable GL_LIGHTING. If I add a slave camera, then that 
slave camera also has no lighting, also as expected.

Now suppose I disable the main camera using 
viewer.getCamera()->setGraphicsContext(NULL). Suddenly, the slave camera goes 
back to the default headlight! I've searched around and looked through the code 
for Renderer and SceneView, but am not able to make sense of this. Can anyone 
please explain it?

BTW I'm on the OpenSceneGraph-3.5.6 Git tag.

Thanks!
Ravi

Here's the minimal example code to duplicate this behavior.


Code:
using namespace osg;
int main()
{
  // Standard OSG sphere
  ShapeDrawable* sphereSD = new ShapeDrawable(new Sphere());
  Geode *sphereGeode = new Geode();
  sphereGeode->addDrawable(sphereSD);
  
  // Viewer with no light
  osgViewer::Viewer viewer;
  viewer.setSceneData(sphereGeode);
  viewer.setUpViewInWindow(30, 30, 640, 480);
  viewer.setLightingMode(View::NO_LIGHT);
  
  // Slave camera
  Camera* slaveCam = new Camera();
  slaveCam->setViewport(viewer.getCamera()->getViewport());
  slaveCam->setGraphicsContext(viewer.getCamera()->getGraphicsContext());
  viewer.addSlave(slaveCam);

  // Disable main camera
  // This causes slaveCam to have default HEADLIGHT: why??
  viewer.getCamera()->setGraphicsContext(NULL);
  
  return viewer.run();
}



------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72683#72683





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to