Changeset 10600 for OpenSceneGraph/trunk/include/osg/State
- Timestamp:
- 10/01/09 22:19:42 (4 years ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osg/State (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osg/State
r10588 r10600 406 406 407 407 408 void setCurrentVertexBufferObject(osg:: VertexBufferObject* vbo) { _currentVBO = vbo; }409 const VertexBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }410 inline void bindVertexBufferObject( const osg::VertexBufferObject* vbo)408 void setCurrentVertexBufferObject(osg::GLBufferObject* vbo) { _currentVBO = vbo; } 409 const GLBufferObject* getCurrentVertexBufferObject() { return _currentVBO; } 410 inline void bindVertexBufferObject(osg::GLBufferObject* vbo) 411 411 { 412 412 if (vbo == _currentVBO) return; 413 if (vbo->isDirty( _contextID)) vbo->compileBuffer(*this);414 else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo-> buffer(_contextID));413 if (vbo->isDirty()) vbo->compileBuffer(); 414 else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo->getGLObjectID()); 415 415 _currentVBO = vbo; 416 416 } … … 423 423 } 424 424 425 void setCurrentElementBufferObject(osg:: ElementBufferObject* ebo) { _currentEBO = ebo; }426 const ElementBufferObject* getCurrentElementBufferObject() { return _currentEBO; }427 428 inline void bindElementBufferObject( const osg::ElementBufferObject* ebo)425 void setCurrentElementBufferObject(osg::GLBufferObject* ebo) { _currentEBO = ebo; } 426 const GLBufferObject* getCurrentElementBufferObject() { return _currentEBO; } 427 428 inline void bindElementBufferObject(osg::GLBufferObject* ebo) 429 429 { 430 430 if (ebo == _currentEBO) return; 431 if (ebo->isDirty( _contextID)) ebo->compileBuffer(*this);432 else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo-> buffer(_contextID));431 if (ebo->isDirty()) ebo->compileBuffer(); 432 else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo->getGLObjectID()); 433 433 _currentEBO = ebo; 434 434 } … … 441 441 } 442 442 443 void setCurrentPixelBufferObject(osg:: PixelBufferObject* pbo) { _currentPBO = pbo; }444 const PixelBufferObject* getCurrentPixelBufferObject() { return _currentPBO; }445 446 inline void bindPixelBufferObject( const osg::PixelBufferObject* pbo)443 void setCurrentPixelBufferObject(osg::GLBufferObject* pbo) { _currentPBO = pbo; } 444 const GLBufferObject* getCurrentPixelBufferObject() { return _currentPBO; } 445 446 inline void bindPixelBufferObject(osg::GLBufferObject* pbo) 447 447 { 448 448 if (pbo == _currentPBO) return; 449 449 450 if (pbo->isDirty( _contextID)) pbo->compileBuffer(*this);451 else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo-> buffer(_contextID));450 if (pbo->isDirty()) pbo->compileBuffer(); 451 else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo->getGLObjectID()); 452 452 453 453 _currentPBO = pbo; … … 486 486 if (array) 487 487 { 488 const VertexBufferObject* vbo = array->getVertexBufferObject();488 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 489 489 if (vbo) 490 490 { 491 491 bindVertexBufferObject(vbo); 492 setVertexPointer(array->getDataSize(),array->getDataType(),0, array->getVertexBufferObjectOffset());492 setVertexPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 493 493 } 494 494 else … … 543 543 if (array) 544 544 { 545 const VertexBufferObject* vbo = array->getVertexBufferObject();545 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 546 546 if (vbo) 547 547 { 548 548 bindVertexBufferObject(vbo); 549 setNormalPointer(array->getDataType(),0,array->getVertexBufferObjectOffset());549 setNormalPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 550 550 } 551 551 else … … 599 599 if (array) 600 600 { 601 const VertexBufferObject* vbo = array->getVertexBufferObject();601 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 602 602 if (vbo) 603 603 { 604 604 bindVertexBufferObject(vbo); 605 setColorPointer(array->getDataSize(),array->getDataType(),0, array->getVertexBufferObjectOffset());605 setColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 606 606 } 607 607 else … … 660 660 if (array) 661 661 { 662 const VertexBufferObject* vbo = array->getVertexBufferObject();662 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 663 663 if (vbo) 664 664 { 665 665 bindVertexBufferObject(vbo); 666 #if 0 667 setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex())); 668 #else 669 setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset()); 670 #endif 666 setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 671 667 } 672 668 else … … 746 742 if (array) 747 743 { 748 const VertexBufferObject* vbo = array->getVertexBufferObject();744 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 749 745 if (vbo) 750 746 { 751 747 bindVertexBufferObject(vbo); 752 #if 0 753 setFogCoordPointer(array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex())); 754 #else 755 setFogCoordPointer(array->getDataType(),0,array->getVertexBufferObjectOffset()); 756 #endif 748 setFogCoordPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 757 749 } 758 750 else … … 795 787 if (array) 796 788 { 797 const VertexBufferObject* vbo = array->getVertexBufferObject();789 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 798 790 if (vbo) 799 791 { 800 792 bindVertexBufferObject(vbo); 801 #if 0 802 setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex())); 803 #else 804 setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset()); 805 #endif 793 setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0, (const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 806 794 } 807 795 else … … 917 905 if (array) 918 906 { 919 const VertexBufferObject* vbo = array->getVertexBufferObject();907 GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID); 920 908 if (vbo) 921 909 { 922 910 bindVertexBufferObject(vbo); 923 #if 0 924 setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,vbo->getOffset(array->getVertexBufferObjectIndex())); 925 #else 926 setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,array->getVertexBufferObjectOffset()); 927 #endif 911 setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex()))); 928 912 } 929 913 else … … 1280 1264 unsigned int _currentActiveTextureUnit; 1281 1265 unsigned int _currentClientActiveTextureUnit; 1282 const VertexBufferObject*_currentVBO;1283 const ElementBufferObject*_currentEBO;1284 const PixelBufferObject*_currentPBO;1266 GLBufferObject* _currentVBO; 1267 GLBufferObject* _currentEBO; 1268 GLBufferObject* _currentPBO; 1285 1269 1286 1270
