Hi Forum,

It has been a while and i did not get any feed-back over my last post. I 
realized that i was not clear enough in my explanation. Let me try again. 

I store the current graphics context and part of the code snippet shows that 
the current context is stored:


Code:

   void Context::operator() (osg::GraphicsContext *gc)
   {
      if(gc->getState() == NULL)
      {
         osg::notify(osg::FATAL) << __FUNCTION__ << ": "
                                 << "osg::GraphicsContext must have a valid 
state. "
                                 << std::endl;
         exit(EXIT_FAILURE);
      }

      //make this context current if not the current context
      if(!gc->isCurrent())
        gc->makeCurrent();

     .................................

    ..................................

      // Bind context to osgCompute::GLMemory
      if( osgCompute::GLMemory::getContext() == NULL )
         osgCompute::GLMemory::bindToContext( *gc );

     .................................

     .................................
   }




As you can see that inside the realize operation i store the current context 
for later reference.

Now i use this context reference id to create the buffer object as follows:


Code:


......................
......................
      //get or create a vertex buffer object from the geometry 
      osg::VertexBufferObject *vbo = 
_m_clGeomRef->getOrCreateVertexBufferObject();

      //make sure that we have the vertex buffer object
      //AND i checked the vbo creation is successful
      if(!vbo)
         return NULL;

     ......................................
     ......................................

         //get the buffer object 
         // I HAVE THE PROBLEM WITH THE FOLLOWING STATEMENT.
         // event though i get a valid pointer to glBO, i checked though the 
debugger that
         //glGenBuffers is generating a buffer id with 0 value 
         osg::GLBufferObject *glBO = 
vbo->getOrCreateGLBufferObject(osgCompute::GLMemory::getContext()->getState()->getContextID());

         //make sure that we have the buffer object
         if(!glBO)
            return NULL;






I have no idea why am i getting 0 value for the buffer id with glGenBuffers(..) 
call inside the constructor of GLBufferObject() - the class that came along 
with the repository.

I am using the context id that i have stored inside the realize operation.

Any hint on what might have went wrong ? Where should i look into ?

I shall be eagerly looking forward to your hint over this issue.

Thanks,
Sajjadul

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





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

Reply via email to