Hi,

I was wondering if update callbacks are suppose to occur in between calls to glBegin and glEnd? I think this test code demonstrates that they do.

I'm using a glGet command (in this case glGetIntegerv) and checking for it's error code. From the open GL docs:

"GL_INVALID_OPERATION is generated if glGet is executed between the execution of glBegin and the corresponding execution of glEnd."

I'm making that call inside the update callback and getting that error, suggesting that the update callback occurs somewhere in between a glBegin and glEnd. Is this correct?

Thanks,
Brett

class TestUpdateCallback : public osg::NodeCallback
  {

  public:

     void operator()(osg::Node* node, osg::NodeVisitor* nv)
{ // Clear any previous error. GLenum eError = glGetError();
        // Make the call that will generate a new error.
        int maxUnits;
        glGetIntegerv(GL_MAX_TEXTURE_UNITS,&maxUnits);

        // Check the error
eError = glGetError(); if(eError == GL_INVALID_OPERATION)
        {
std::cout << "TestUpdateCallback: This update callback occurs in between glBegin and glEnd." << std::endl;
        }

        // Continue traverse.
        traverse(node,nv);
     }
  };

  main()
  {
     std::string modelPath = testDataDir();
     modelPath += "cow.osg";

osg::ref_ptr<osg::Node> modelNode = osgDB::readNodeFile(modelPath); modelNode->setUpdateCallback(new TestUpdateCallback);

     osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
     viewer->setUpViewOnSingleScreen(0);
     viewer->setSceneData(modelNode.get());
     viewer->setCameraManipulator(new osgGA::TrackballManipulator());
     viewer->run();
  }
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to