Hi Forum,

I am creating a buffer object as follows and i need to access the id of the 
buffer object for later references , but i am getting ZERO value:


Code:

.............................
............................
         osg::VertexBufferObject* vbo = 
_m_clGeomRef->getOrCreateVertexBufferObject();

         if(!vbo)
         {
            osg::notify(osg::FATAL)
               << __FUNCTION__ <<": " << __LINE__
               << _m_clGeomRef->getName() << ": no buffer object found."
               << std::endl;

            return false;
         } // END OF - !vbo

         unsigned int contextID = 
osgCompute::GLMemory::getContext()->getState()->getContextID();

         //compile vertex buffer
         osg::GLBufferObject *glBO = vbo->getOrCreateGLBufferObject( contextID 
);

         if( !glBO )
         {
            osg::notify(osg::FATAL)
               << __FUNCTION__ <<": " << __LINE__ << ": "
               << _m_clGeomRef->getName() << ": no GL buffer object found."
               << std::endl;

            return false;
         } // END OF - !glBO

         if( glBO->isDirty())
         {
            osg::GLBufferObject::Extensions* ext = 
osg::GLBufferObject::getExtensions( 
osgCompute::GLMemory::getContext()->getState()->getContextID(),true);

            if(!ext)
            {
               osg::notify(osg::FATAL)
                  << __FUNCTION__ <<": " << __FUNCTION__ << ": "
                  << _m_clGeomRef->getName() << ": cannot find required 
extensions to compile buffer object."
                  << std::endl;

               return false;
            }

            //the following function call the glBufferData()
            glBO->compileBuffer();

            //unbind the buffer objects
            ext->glBindBuffer(GL_ARRAY_BUFFER_ARB,0);
            ext->glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,0);

         } // END OF - glBO->isDirty()

         //avoid copy operation during osgCompute::MAP_HOST
         memory._m_clLastModifiedCount.clear();

         for( unsigned int d = 0; d < vbo->getNumBufferData(); ++d )
            memory._m_clLastModifiedCount.push_back( 
vbo->getBufferData(d)->getModifiedCount());

         GLuint objectid = glBO->getGLObjectID();
...........................
..........................





In debuffer i found that objectid is always zero.

Where should i look into to correct this issue ?

Thanks
Sajjadul

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





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

Reply via email to