Hi Juan,

Only textures need to be bound during rendering, not texture buffers. Right 
now, with your code, I am getting the following OpenGL calls during rendering:


Code:
// Primitive 1
glBindTexture(GL_TEXTURE_BUFFER, id);
glTextureBufferEXT(GL_TEXTURE_BUFFER, format, buffer_id);
glCallList(list_id);
// Primitive 2
glBindTexture(GL_TEXTURE_BUFFER, id2);
glTextureBufferEXT(GL_TEXTURE_BUFFER, format, buffer_id2);
glCallList(list_id2);
and so on...




The call to glTextureBufferEXT, during the rendering, is not needed. It is only 
needed when you prepare the Texture Buffer, but not during the display.

Does it make sense to you if I comment out the following line of code below 
(see // COMMENTED OUT, below):


Code:

void TextureBuffer::apply(osg::State& state) const
{
    const unsigned int contextID = state.getContextID();

    TextureObject* to = getTextureObject(contextID);
    TextureBufferObject *tbo = _textureBufferObjectsBuffer[contextID].get();

    if (to != 0) {
        if (_image.valid() &&
            _modifiedCount[contextID] != _image->getModifiedCount()) {
            /* Update the texture buffer */
            tbo->bindBuffer(contextID);
            glBufferSubData(GL_TEXTURE_BUFFER_EXT, 0,
                            _bufferSize, _image->data());
            glBindBuffer(GL_TEXTURE_BUFFER_EXT, 0);
            /* Update the modified tag to show that it is up to date. */
            _modifiedCount[contextID] = _image->getModifiedCount();
        } else if (_readPBuffer.valid()) {
            std::cerr << "Unsupported operation" << std::endl;
        }

        /* Binding the texture and its texture buffer object as texture
           storage. */
        to->bind();

        // COMMENTED OUT
        //tbo->bindTextureBuffer(state, _internalFormat);
    } else if (_image.valid() && _image->data()) {

   [...]





Cheers,
Fred

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





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

Reply via email to