OK, that makes sense. The error is saying it's invalid to call glGetInt in between a glbegin and glend. I took this for face value and thought it was weird because I shouldn't be inside glbegin and glend in the update traversal. But what the error means is really, the graphics context isn't current so you can't make these calls. That makes sense. Too bad the error message isn't very helpful.

Thanks guys.

Tomlinson, Gordon wrote:
Hi

I think the GL error is because your doing a GL call in the update
process/thread and not the draw process/threads (You need a valid GL
context which is typically owned by the draw process/threads)


Gordon

__________________________________________________________
Gordon Tomlinson
Email  : gtomlinson @ overwatch.textron.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
brettwiesner
Sent: Thursday, August 21, 2008 10:01 AM
To: OpenSceneGraph Users
Cc: [EMAIL PROTECTED]
Subject: [osg-users] Update callbacks occur in between calls to glBegin
andglEnd?

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.or
g
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to