Show
Ignore:
Timestamp:
10/01/09 22:19:42 (5 years ago)
Author:
robert
Message:

Introduced new BufferObject? design + implementation in preperation of implementing a pool system for buffer objects

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/PrimitiveSet.cpp

    r9796 r10600  
    127127    if (useVertexBufferObjects) 
    128128    { 
    129         const ElementBufferObject* ebo = getElementBufferObject(); 
     129        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID()); 
    130130        state.bindElementBufferObject(ebo); 
    131131        if (ebo) 
    132132        { 
    133             if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset(), _numInstances); 
    134             else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset()); 
     133            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances); 
     134            else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex()))); 
    135135        } 
    136136        else 
     
    177177    if (useVertexBufferObjects) 
    178178    { 
    179         const ElementBufferObject* ebo = getElementBufferObject(); 
     179        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID()); 
    180180        state.bindElementBufferObject(ebo); 
    181181        if (ebo) 
    182182        { 
    183             if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset(), _numInstances); 
    184             else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset()); 
     183            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances); 
     184            else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex()))); 
    185185        } 
    186186        else 
     
    227227    if (useVertexBufferObjects) 
    228228    { 
    229         const ElementBufferObject* ebo = getElementBufferObject(); 
     229        GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID()); 
    230230        state.bindElementBufferObject(ebo); 
    231231        if (ebo) 
    232232        { 
    233             if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset(), _numInstances); 
    234             else glDrawElements(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset()); 
     233            if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances); 
     234            else glDrawElements(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex()))); 
    235235        } 
    236236        else