Further perfomrmance optimizations and clean up on new VBO/EBO/PBO API.

This commit is contained in:
Robert Osfield
2007-05-01 18:03:32 +00:00
parent fe85a439fb
commit 859bcf3c4b
16 changed files with 306 additions and 461 deletions

View File

@@ -101,10 +101,15 @@ BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
BufferObject::~BufferObject()
{
releaseBuffer(0);
releaseGLObjects(0);
}
void BufferObject::releaseBuffer(State* state) const
void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
{
_bufferObjectList.resize(maxSize);
}
void BufferObject::releaseGLObjects(State* state) const
{
if (state)
{
@@ -313,6 +318,18 @@ unsigned int VertexBufferObject::addArray(osg::Array* array)
return i;
}
void VertexBufferObject::removeArray(osg::Array* array)
{
BufferEntryArrayPairs::iterator itr;
for(itr = _bufferEntryArrayPairs.begin();
itr != _bufferEntryArrayPairs.end();
++itr)
{
if (itr->second == array) break;
}
if (itr != _bufferEntryArrayPairs.end()) _bufferEntryArrayPairs.erase(itr);
}
void VertexBufferObject::setArray(unsigned int i, Array* array)
{
if (i+1>=_bufferEntryArrayPairs.size()) _bufferEntryArrayPairs.resize(i+1);
@@ -323,41 +340,7 @@ void VertexBufferObject::setArray(unsigned int i, Array* array)
dirty();
}
bool VertexBufferObject::needsCompile(unsigned int contextID) const
{
if (isDirty(contextID)) return true;
unsigned int numValidArray = 0;
for(BufferEntryArrayPairs::const_iterator itr = _bufferEntryArrayPairs.begin();
itr != _bufferEntryArrayPairs.end();
++itr)
{
const BufferEntryArrayPair& bep = *itr;
if (bep.second)
{
++numValidArray;
if (bep.first.modifiedCount[contextID] != bep.second->getModifiedCount())
{
return true;
}
if (bep.first.dataSize != bep.second->getTotalDataSize())
{
return true;
}
}
}
if (numValidArray==0) return false;
if (_bufferObjectList[contextID]==0) return true;
return false;
}
void VertexBufferObject::compileBufferImplementation(State& state) const
void VertexBufferObject::compileBuffer(State& state) const
{
unsigned int contextID = state.getContextID();
@@ -365,7 +348,7 @@ void VertexBufferObject::compileBufferImplementation(State& state) const
Extensions* extensions = getExtensions(contextID,true);
osg::notify(osg::NOTICE)<<"VertexBufferObject::compileBuffer frameNumber="<<state.getFrameStamp()->getFrameNumber()<<std::endl;
// osg::notify(osg::NOTICE)<<"VertexBufferObject::compileBuffer frameNumber="<<state.getFrameStamp()->getFrameNumber()<<std::endl;
unsigned int totalSizeRequired = 0;
unsigned int numModified = 0;
@@ -440,6 +423,7 @@ void VertexBufferObject::compileBufferImplementation(State& state) const
if (copyAll)
{
bep.first.offset = offset;
de->setVertexBufferObjectOffset((GLvoid*)offset);
offset += bep.first.dataSize;
}
@@ -462,6 +446,18 @@ void VertexBufferObject::compileBufferImplementation(State& state) const
// osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
}
void VertexBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
{
BufferObject::resizeGLObjectBuffers(maxSize);
for(BufferEntryArrayPairs::iterator itr = _bufferEntryArrayPairs.begin();
itr != _bufferEntryArrayPairs.end();
++itr)
{
itr->first.modifiedCount.resize(maxSize);
}
}
//////////////////////////////////////////////////////////////////////////////////
//
// ElementBufferObject
@@ -492,6 +488,18 @@ unsigned int ElementBufferObject::addDrawElements(osg::DrawElements* drawElement
return i;
}
void ElementBufferObject::removeDrawElements(osg::DrawElements* drawElements)
{
BufferEntryDrawElementsPairs::iterator itr;
for(itr = _bufferEntryDrawElementsPairs.begin();
itr != _bufferEntryDrawElementsPairs.end();
++itr)
{
if (itr->second == drawElements) break;
}
if (itr != _bufferEntryDrawElementsPairs.end()) _bufferEntryDrawElementsPairs.erase(itr);
}
void ElementBufferObject::setDrawElements(unsigned int i, DrawElements* drawElements)
{
if (i+1>=_bufferEntryDrawElementsPairs.size()) _bufferEntryDrawElementsPairs.resize(i+1);
@@ -501,48 +509,13 @@ void ElementBufferObject::setDrawElements(unsigned int i, DrawElements* drawElem
_bufferEntryDrawElementsPairs[i].first.dataSize = 0;
}
bool ElementBufferObject::needsCompile(unsigned int contextID) const
{
if (isDirty(contextID)) return true;
#if 1
unsigned int numValidDrawElements = 0;
for(BufferEntryDrawElementsPairs::const_iterator itr = _bufferEntryDrawElementsPairs.begin();
itr != _bufferEntryDrawElementsPairs.end();
++itr)
{
const BufferEntryDrawElementstPair& bep = *itr;
if (bep.second)
{
++numValidDrawElements;
if (bep.first.modifiedCount[contextID] != bep.second->getModifiedCount())
{
return true;
}
if (bep.first.dataSize != bep.second->getTotalDataSize())
{
return true;
}
}
}
if (numValidDrawElements==0) return false;
#endif
if (_bufferObjectList[contextID]==0) return true;
return false;
}
void ElementBufferObject::compileBufferImplementation(State& state) const
void ElementBufferObject::compileBuffer(State& state) const
{
unsigned int contextID = state.getContextID();
_compiledList[contextID] = 1;
osg::notify(osg::NOTICE)<<"ElementBufferObject::compile"<<std::endl;
// osg::notify(osg::NOTICE)<<"ElementBufferObject::compile"<<std::endl;
Extensions* extensions = getExtensions(contextID,true);
@@ -619,6 +592,7 @@ void ElementBufferObject::compileBufferImplementation(State& state) const
if (copyAll)
{
bep.first.offset = offset;
de->setElementBufferObjectOffset((GLvoid*)offset);
offset += bep.first.dataSize;
}
@@ -639,6 +613,18 @@ void ElementBufferObject::compileBufferImplementation(State& state) const
// osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
}
void ElementBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
{
BufferObject::resizeGLObjectBuffers(maxSize);
for(BufferEntryDrawElementsPairs::iterator itr = _bufferEntryDrawElementsPairs.begin();
itr != _bufferEntryDrawElementsPairs.end();
++itr)
{
itr->first.modifiedCount.resize(maxSize);
}
}
//////////////////////////////////////////////////////////////////////////////////
//
// PixelBufferObject
@@ -670,23 +656,7 @@ void PixelBufferObject::setImage(osg::Image* image)
dirty();
}
bool PixelBufferObject::needsCompile(unsigned int contextID) const
{
if (isDirty(contextID)) return true;
if (!_bufferEntryImagePair.second)
return false;
if (_bufferEntryImagePair.first.modifiedCount[contextID]!=_bufferEntryImagePair.second->getModifiedCount())
return true;
if (_bufferObjectList[contextID]==0) return true;
return false;
}
void PixelBufferObject::compileBufferImplementation(State& state) const
void PixelBufferObject::compileBuffer(State& state) const
{
unsigned int contextID = state.getContextID();
@@ -742,3 +712,10 @@ void PixelBufferObject::compileBufferImplementation(State& state) const
// osg::notify(osg::NOTICE)<<"pbo _totalSize="<<_totalSize<<std::endl;
// osg::notify(osg::NOTICE)<<"pbo "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
}
void PixelBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
{
BufferObject::resizeGLObjectBuffers(maxSize);
_bufferEntryImagePair.first.modifiedCount.resize(maxSize);
}

View File

@@ -632,15 +632,6 @@ void Drawable::dirtyDisplayList()
_globjList[i] = 0;
}
}
for(i=0;i<_vboList.size();++i)
{
if (_vboList[i] != 0)
{
Drawable::deleteVertexBufferObject(i,_vboList[i]);
_vboList[i] = 0;
}
}
}

View File

@@ -358,8 +358,7 @@ Geometry::ArrayData::ArrayData(const ArrayData& data,const CopyOp& copyop):
array(copyop(data.array.get())),
indices(dynamic_cast<osg::IndexArray*>(copyop(data.indices.get()))),
binding(data.binding),
normalize(data.normalize),
offset(data.offset)
normalize(data.normalize)
{
}
@@ -367,8 +366,7 @@ Geometry::Vec3ArrayData::Vec3ArrayData(const Vec3ArrayData& data,const CopyOp& c
array(dynamic_cast<osg::Vec3Array*>(copyop(data.array.get()))),
indices(dynamic_cast<osg::IndexArray*>(copyop(data.indices.get()))),
binding(data.binding),
normalize(data.normalize),
offset(data.offset)
normalize(data.normalize)
{
}
@@ -981,7 +979,7 @@ unsigned int Geometry::getGLObjectSizeHint() const
return totalSize;
}
bool Geometry::getArrayList(ArrayList& arrayList)
bool Geometry::getArrayList(ArrayList& arrayList) const
{
unsigned int startSize = arrayList.size();
@@ -1006,11 +1004,11 @@ bool Geometry::getArrayList(ArrayList& arrayList)
return arrayList.size()!=startSize;
}
bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList)
bool Geometry::getDrawElementsList(DrawElementsList& drawElementsList) const
{
unsigned int startSize = drawElementsList.size();
for(PrimitiveSetList::iterator itr = _primitives.begin();
for(PrimitiveSetList::const_iterator itr = _primitives.begin();
itr != _primitives.end();
++itr)
{
@@ -1088,7 +1086,7 @@ osg::ElementBufferObject* Geometry::getOrCreateElementBufferObject()
void Geometry::setUseVertexBufferObjects(bool flag)
{
flag = true;
// flag = true;
// osg::notify(osg::NOTICE)<<"Geometry::setUseVertexBufferObjects("<<flag<<")"<<std::endl;
@@ -1185,89 +1183,60 @@ void Geometry::dirtyDisplayList()
Drawable::dirtyDisplayList();
}
void Geometry::resizeGLObjectBuffers(unsigned int maxSize)
{
Drawable::resizeGLObjectBuffers(maxSize);
#define SETARRAYPOINTER(vertexData, setVertexPointer, disableVertexPointer) \
if( vertexData.array.valid() ) \
{ \
new_vbo = vertexData.array.valid() ? vertexData.array->getVertexBufferObject() : 0; \
if (new_vbo) \
{ \
if (new_vbo!=prev_vbo) new_vbo->bindBuffer(contextID); \
prev_vbo = new_vbo; \
setVertexPointer(vertexData.array->getDataSize(),vertexData.array->getDataType(),0,new_vbo->getOffset(vertexData.array->getVertexBufferObjectIndex())); \
} \
else \
{ \
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0); \
prev_vbo = 0; \
setVertexPointer(vertexData.array->getDataSize(),vertexData.array->getDataType(),0,vertexData.array->getDataPointer()); \
} \
} \
else \
disableVertexPointer();
ArrayList arrays;
if (getArrayList(arrays))
{
for(ArrayList::iterator itr = arrays.begin();
itr != arrays.end();
++itr)
{
(*itr)->resizeGLObjectBuffers(maxSize);
}
}
#define SETNORMALPOINTER_IFPERVERTEXBINDING(vertexData, setVertexPointer, disableVertexPointer) \
if( vertexData.array.valid() && vertexData.binding==BIND_PER_VERTEX) \
{ \
new_vbo = vertexData.array.valid() ? vertexData.array->getVertexBufferObject() : 0; \
if (new_vbo) \
{ \
if (new_vbo!=prev_vbo) new_vbo->bindBuffer(contextID); \
prev_vbo = new_vbo; \
setVertexPointer(vertexData.array->getDataType(),0,new_vbo->getOffset(vertexData.array->getVertexBufferObjectIndex())); \
} \
else \
{ \
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0); \
prev_vbo = 0; \
setVertexPointer(vertexData.array->getDataType(),0,vertexData.array->getDataPointer()); \
} \
} \
else \
disableVertexPointer();
DrawElementsList drawElements;
if (getDrawElementsList(drawElements))
{
for(DrawElementsList::iterator itr = drawElements.begin();
itr != drawElements.end();
++itr)
{
(*itr)->resizeGLObjectBuffers(maxSize);
}
}
}
void Geometry::releaseGLObjects(State* state) const
{
Drawable::releaseGLObjects(state);
#define SETARRAYPOINTER_IFPERVERTEXBINDING(vertexData, setVertexPointer, disableVertexPointer) \
if( vertexData.array.valid() && vertexData.binding==BIND_PER_VERTEX) \
{ \
new_vbo = vertexData.array.valid() ? vertexData.array->getVertexBufferObject() : 0; \
if (new_vbo) \
{ \
if (new_vbo!=prev_vbo) new_vbo->bindBuffer(contextID); \
prev_vbo = new_vbo; \
setVertexPointer(vertexData.array->getDataSize(),vertexData.array->getDataType(),0,new_vbo->getOffset(vertexData.array->getVertexBufferObjectIndex())); \
} \
else \
{ \
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0); \
prev_vbo = 0; \
setVertexPointer(vertexData.array->getDataSize(),vertexData.array->getDataType(),0,vertexData.array->getDataPointer()); \
} \
} \
else \
disableVertexPointer();
ArrayList arrays;
if (getArrayList(arrays))
{
for(ArrayList::iterator itr = arrays.begin();
itr != arrays.end();
++itr)
{
(*itr)->releaseGLObjects(state);
}
}
DrawElementsList drawElements;
if (getDrawElementsList(drawElements))
{
for(DrawElementsList::iterator itr = drawElements.begin();
itr != drawElements.end();
++itr)
{
(*itr)->releaseGLObjects(state);
}
}
#define SETARRAYUNITPOINTER_IFPERVERTEXBINDING(vertexData, unit, setVertexPointer, disableVertexPointer) \
if( vertexData.array.valid() && vertexData.binding==BIND_PER_VERTEX) \
{ \
new_vbo = vertexData.array.valid() ? vertexData.array->getVertexBufferObject() : 0; \
if (new_vbo) \
{ \
if (new_vbo!=prev_vbo) new_vbo->bindBuffer(contextID); \
prev_vbo = new_vbo; \
setVertexPointer(unit, vertexData.array->getDataSize(),vertexData.array->getDataType(),0,new_vbo->getOffset(vertexData.array->getVertexBufferObjectIndex())); \
} \
else \
{ \
extensions->glBindBuffer(GL_ARRAY_BUFFER_ARB,0); \
prev_vbo = 0; \
setVertexPointer(unit, vertexData.array->getDataSize(),vertexData.array->getDataType(),0,vertexData.array->getDataPointer()); \
} \
} \
else \
disableVertexPointer();
}
void Geometry::drawImplementation(RenderInfo& renderInfo) const
{

View File

@@ -121,35 +121,6 @@ DrawElementsUByte::~DrawElementsUByte()
releaseGLObjects();
}
void DrawElementsUByte::resizeGLObjectBuffers(unsigned int maxSize)
{
_vboList.resize(maxSize);
}
void DrawElementsUByte::releaseGLObjects(State* state) const
{
if (state)
{
unsigned int contextID = state->getContextID();
if (_vboList[contextID]._objectID != 0)
{
BufferObject::deleteBufferObject(contextID,_vboList[contextID]._objectID);
_vboList[contextID]._objectID = 0;
}
}
else
{
for(unsigned int i=0;i<_vboList.size();++i)
{
if (_vboList[i]._objectID != 0)
{
BufferObject::deleteBufferObject(i,_vboList[i]._objectID);
_vboList[i]._objectID = 0;
}
}
}
}
void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
{
if (useVertexBufferObjects)
@@ -158,7 +129,7 @@ void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
state.bindElementBufferObject(ebo);
if (ebo)
{
glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, ebo->getOffset(getElementBufferObjectIndex()));
glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset());
}
else
{
@@ -197,35 +168,6 @@ DrawElementsUShort::~DrawElementsUShort()
releaseGLObjects();
}
void DrawElementsUShort::resizeGLObjectBuffers(unsigned int maxSize)
{
_vboList.resize(maxSize);
}
void DrawElementsUShort::releaseGLObjects(State* state) const
{
if (state)
{
unsigned int contextID = state->getContextID();
if (_vboList[contextID]._objectID != 0)
{
BufferObject::deleteBufferObject(contextID,_vboList[contextID]._objectID);
_vboList[contextID]._objectID = 0;
}
}
else
{
for(unsigned int i=0;i<_vboList.size();++i)
{
if (_vboList[i]._objectID != 0)
{
BufferObject::deleteBufferObject(i,_vboList[i]._objectID);
_vboList[i]._objectID = 0;
}
}
}
}
void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
{
if (useVertexBufferObjects)
@@ -234,7 +176,7 @@ void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
state.bindElementBufferObject(ebo);
if (ebo)
{
glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, ebo->getOffset(getElementBufferObjectIndex()));
glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset());
}
else
{
@@ -273,35 +215,6 @@ DrawElementsUInt::~DrawElementsUInt()
releaseGLObjects();
}
void DrawElementsUInt::resizeGLObjectBuffers(unsigned int maxSize)
{
_vboList.resize(maxSize);
}
void DrawElementsUInt::releaseGLObjects(State* state) const
{
if (state)
{
unsigned int contextID = state->getContextID();
if (_vboList[contextID]._objectID != 0)
{
BufferObject::deleteBufferObject(contextID,_vboList[contextID]._objectID);
_vboList[contextID]._objectID = 0;
}
}
else
{
for(unsigned int i=0;i<_vboList.size();++i)
{
if (_vboList[i]._objectID != 0)
{
BufferObject::deleteBufferObject(i,_vboList[i]._objectID);
_vboList[i]._objectID = 0;
}
}
}
}
void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
{
if (useVertexBufferObjects)
@@ -310,7 +223,7 @@ void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
state.bindElementBufferObject(ebo);
if (ebo)
{
glDrawElements(_mode, size(), GL_UNSIGNED_INT, ebo->getOffset(getElementBufferObjectIndex()));
glDrawElements(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset());
}
else
{

View File

@@ -907,8 +907,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale)
{
pbo->compileBuffer(contextID, state);
pbo->bindBuffer(contextID);
state.bindPixelBufferObject(pbo);
dataMinusOffset = data;
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
#ifdef DO_TIMING
@@ -1043,8 +1042,9 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
if (pbo)
{
pbo->unbindBuffer(contextID);
state.unbindPixelBufferObject();
}
#ifdef DO_TIMING
static double s_total_time = 0.0;
double delta_time = osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick());
@@ -1159,8 +1159,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale)
{
pbo->compileBuffer(contextID, state);
pbo->bindBuffer(contextID);
state.bindPixelBufferObject(pbo);
dataMinusOffset = data;
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
#ifdef DO_TIMING
@@ -1277,7 +1276,7 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
if (pbo)
{
pbo->unbindBuffer(contextID);
state.unbindPixelBufferObject();
}
#ifdef DO_TIMING
osg::notify(osg::NOTICE)<<"glTexSubImage2D "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;

View File

@@ -285,8 +285,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isPBOSupported(contextID))
{
pbo->compileBuffer(contextID, state);
pbo->bindBuffer(contextID);
state.bindPixelBufferObject(pbo);
dataMinusOffset = image->data();
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
}
@@ -305,7 +304,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
if (pbo)
{
pbo->unbindBuffer(contextID);
state.unbindPixelBufferObject();
}
inwidth = image->s();
@@ -352,8 +351,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
const PixelBufferObject* pbo = image->getPixelBufferObject();
if (pbo && pbo->isPBOSupported(contextID))
{
pbo->compileBuffer(contextID, state);
pbo->bindBuffer(contextID);
state.bindPixelBufferObject(pbo);
dataMinusOffset = image->data();
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); // -dataMinusOffset+dataPlusOffset
@@ -378,7 +376,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
if (pbo)
{
pbo->unbindBuffer(contextID);
state.unbindPixelBufferObject();
}
#ifdef DO_TIMING

View File

@@ -169,15 +169,15 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
__C5_osg_VertexBufferObject_P1__getVertexBufferObject,
"Get the const VertexBufferObject. ",
"If no VBO is assigned returns NULL ");
I_Method1(void, setVertexBufferObjectIndex, IN, unsigned int, index,
I_Method1(void, setVertexBufferObjectOffset, IN, const GLvoid *, offset,
Properties::NON_VIRTUAL,
__void__setVertexBufferObjectIndex__unsigned_int,
"Set the index into the VertexBufferObject, if used. ",
__void__setVertexBufferObjectOffset__C5_GLvoid_P1,
"Set the offset into the VertexBufferObject, if used. ",
"");
I_Method0(unsigned int, getVertexBufferObjectIndex,
I_Method0(const GLvoid *, getVertexBufferObjectOffset,
Properties::NON_VIRTUAL,
__unsigned_int__getVertexBufferObjectIndex,
"Get the index into the VertexBufferObject, if used. ",
__C5_GLvoid_P1__getVertexBufferObjectOffset,
"Get the offset into the VertexBufferObject, if used. ",
"");
I_SimpleProperty(const GLvoid *, DataPointer,
__C5_GLvoid_P1__getDataPointer,
@@ -200,9 +200,9 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
I_SimpleProperty(osg::VertexBufferObject *, VertexBufferObject,
__osg_VertexBufferObject_P1__getVertexBufferObject,
__void__setVertexBufferObject__osg_VertexBufferObject_P1);
I_SimpleProperty(unsigned int, VertexBufferObjectIndex,
__unsigned_int__getVertexBufferObjectIndex,
__void__setVertexBufferObjectIndex__unsigned_int);
I_SimpleProperty(const GLvoid *, VertexBufferObjectOffset,
__C5_GLvoid_P1__getVertexBufferObjectOffset,
__void__setVertexBufferObjectOffset__C5_GLvoid_P1);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ArrayVisitor)

View File

@@ -85,26 +85,21 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
__bool__isDirty__unsigned_int,
"",
"");
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
I_Method1(void, compileBuffer, IN, osg::State &, state,
Properties::PURE_VIRTUAL,
__bool__needsCompile__unsigned_int,
__void__compileBuffer__State_R1,
"",
"");
I_Method2(void, compileBuffer, IN, unsigned int, contextID, IN, osg::State &, state,
Properties::NON_VIRTUAL,
__void__compileBuffer__unsigned_int__State_R1,
"",
"");
I_Method1(void, compileBufferImplementation, IN, osg::State &, state,
Properties::PURE_VIRTUAL,
__void__compileBufferImplementation__State_R1,
"",
"");
I_Method1(void, releaseBuffer, IN, osg::State *, state,
Properties::NON_VIRTUAL,
__void__releaseBuffer__State_P1,
"",
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_StaticMethod2(void, deleteBufferObject, IN, unsigned int, contextID, IN, GLuint, globj,
__void__deleteBufferObject__unsigned_int__GLuint_S,
"Use deleteVertexBufferObject instead of glDeleteBuffers to allow OpenGL buffer objects to be cached until they can be deleted by the OpenGL context in which they were created, specified by contextID. ",
@@ -279,6 +274,11 @@ BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
__unsigned_int__addDrawElements__osg_DrawElements_P1,
"",
"");
I_Method1(void, removeDrawElements, IN, osg::DrawElements *, PrimitiveSet,
Properties::NON_VIRTUAL,
__void__removeDrawElements__osg_DrawElements_P1,
"",
"");
I_Method2(void, setDrawElements, IN, unsigned int, i, IN, osg::DrawElements *, PrimitiveSet,
Properties::NON_VIRTUAL,
__void__setDrawElements__unsigned_int__DrawElements_P1,
@@ -299,15 +299,15 @@ BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
__C5_GLvoid_P1__getOffset__unsigned_int,
"",
"");
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
I_Method1(void, compileBuffer, IN, osg::State &, state,
Properties::VIRTUAL,
__bool__needsCompile__unsigned_int,
__void__compileBuffer__State_R1,
"",
"");
I_Method1(void, compileBufferImplementation, IN, osg::State &, state,
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__compileBufferImplementation__State_R1,
"",
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_IndexedProperty(osg::DrawElements *, DrawElements,
__DrawElements_P1__getDrawElements__unsigned_int,
@@ -373,15 +373,15 @@ BEGIN_OBJECT_REFLECTOR(osg::PixelBufferObject)
__unsigned_int__offset,
"",
"");
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
I_Method1(void, compileBuffer, IN, osg::State &, state,
Properties::VIRTUAL,
__bool__needsCompile__unsigned_int,
__void__compileBuffer__State_R1,
"",
"");
I_Method1(void, compileBufferImplementation, IN, osg::State &, state,
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__compileBufferImplementation__State_R1,
"",
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_SimpleProperty(osg::Image *, Image,
__Image_P1__getImage,
@@ -431,6 +431,11 @@ BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
__unsigned_int__addArray__osg_Array_P1,
"",
"");
I_Method1(void, removeArray, IN, osg::Array *, array,
Properties::NON_VIRTUAL,
__void__removeArray__osg_Array_P1,
"",
"");
I_Method2(void, setArray, IN, unsigned int, i, IN, osg::Array *, array,
Properties::NON_VIRTUAL,
__void__setArray__unsigned_int__Array_P1,
@@ -451,15 +456,15 @@ BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
__C5_GLvoid_P1__getOffset__unsigned_int,
"",
"");
I_Method1(bool, needsCompile, IN, unsigned int, contextID,
I_Method1(void, compileBuffer, IN, osg::State &, state,
Properties::VIRTUAL,
__bool__needsCompile__unsigned_int,
__void__compileBuffer__State_R1,
"",
"");
I_Method1(void, compileBufferImplementation, IN, osg::State &, state,
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__compileBufferImplementation__State_R1,
"",
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_IndexedProperty(osg::Array *, Array,
__Array_P1__getArray__unsigned_int,

View File

@@ -18,6 +18,7 @@
#include <osg/Object>
#include <osg/PrimitiveSet>
#include <osg/RenderInfo>
#include <osg/State>
// Must undefine IN and OUT macros defined in Windows headers
#ifdef IN
@@ -562,6 +563,16 @@ BEGIN_OBJECT_REFLECTOR(osg::Geometry)
__void__dirtyDisplayList,
"Force a recompile on next draw() of any OpenGL display list associated with this geoset. ",
"");
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_Method1(bool, getArrayList, IN, osg::Geometry::ArrayList &, arrayList,
Properties::NON_VIRTUAL,
__bool__getArrayList__ArrayList_R1,
@@ -901,7 +912,6 @@ BEGIN_VALUE_REFLECTOR(osg::Geometry::ArrayData)
I_PublicMemberProperty(osg::ref_ptr< osg::IndexArray >, indices);
I_PublicMemberProperty(osg::Geometry::AttributeBinding, binding);
I_PublicMemberProperty(GLboolean, normalize);
I_PublicMemberProperty(unsigned long, offset);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::Geometry::Vec3ArrayData)
@@ -929,7 +939,6 @@ BEGIN_VALUE_REFLECTOR(osg::Geometry::Vec3ArrayData)
I_PublicMemberProperty(osg::ref_ptr< osg::IndexArray >, indices);
I_PublicMemberProperty(osg::Geometry::AttributeBinding, binding);
I_PublicMemberProperty(GLboolean, normalize);
I_PublicMemberProperty(unsigned long, offset);
END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osg::PrimitiveSet >)

View File

@@ -271,25 +271,35 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements)
__C5_osg_ElementBufferObject_P1__getElementBufferObject,
"Get the const ElementBufferObject. ",
"If no EBO is assigned returns NULL ");
I_Method1(void, setElementBufferObjectIndex, IN, unsigned int, index,
I_Method1(void, setElementBufferObjectOffset, IN, const GLvoid *, offset,
Properties::NON_VIRTUAL,
__void__setElementBufferObjectIndex__unsigned_int,
"Set the index into the ElementBufferObject, if used. ",
__void__setElementBufferObjectOffset__C5_GLvoid_P1,
"Set the offset into the ElementBufferObject, if used. ",
"");
I_Method0(unsigned int, getElementBufferObjectIndex,
I_Method0(const GLvoid *, getElementBufferObjectOffset,
Properties::NON_VIRTUAL,
__unsigned_int__getElementBufferObjectIndex,
"Get the index into the ElementBufferObject, if used. ",
__C5_GLvoid_P1__getElementBufferObjectOffset,
"Get the offset into the ElementBufferOffset, if used. ",
"");
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_SimpleProperty(osg::DrawElements *, DrawElements,
__DrawElements_P1__getDrawElements,
0);
I_SimpleProperty(osg::ElementBufferObject *, ElementBufferObject,
__osg_ElementBufferObject_P1__getElementBufferObject,
__void__setElementBufferObject__osg_ElementBufferObject_P1);
I_SimpleProperty(unsigned int, ElementBufferObjectIndex,
__unsigned_int__getElementBufferObjectIndex,
__void__setElementBufferObjectIndex__unsigned_int);
I_SimpleProperty(const GLvoid *, ElementBufferObjectOffset,
__C5_GLvoid_P1__getElementBufferObjectOffset,
__void__setElementBufferObjectOffset__C5_GLvoid_P1);
END_REFLECTOR
TYPE_NAME_ALIAS(osg::VectorGLubyte, osg::DrawElementsUByte::vector_type)
@@ -384,16 +394,6 @@ BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUByte)
__void__offsetIndices__int,
"",
"");
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_Method0(void, computeRange,
Properties::VIRTUAL,
__void__computeRange,
@@ -499,16 +499,6 @@ BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUInt)
__void__offsetIndices__int,
"",
"");
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_Method0(void, computeRange,
Properties::VIRTUAL,
__void__computeRange,
@@ -614,16 +604,6 @@ BEGIN_OBJECT_REFLECTOR(osg::DrawElementsUShort)
__void__offsetIndices__int,
"",
"");
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
Properties::VIRTUAL,
__void__resizeGLObjectBuffers__unsigned_int,
"Resize any per context GLObject buffers to specified size. ",
"");
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, state, 0,
Properties::VIRTUAL,
__void__releaseGLObjects__State_P1,
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objexts for all graphics contexts. ");
I_Method0(void, computeRange,
Properties::VIRTUAL,
__void__computeRange,