Introduced new BufferObject design + implementation in preperation of implementing a pool system for buffer objects
This commit is contained in:
parent
cfac6a7809
commit
f75013d534
@ -106,7 +106,7 @@ class UniformVarying : public osg::Uniform::Callback
|
||||
}
|
||||
};
|
||||
|
||||
osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool vbo)
|
||||
osg::Node* createModel(const std::string& shader, const std::string& textureFileName, const std::string& terrainFileName, bool dynamic, bool useVBO)
|
||||
{
|
||||
osg::Geode* geode = new osg::Geode;
|
||||
|
||||
@ -238,10 +238,10 @@ osg::Node* createModel(const std::string& shader, const std::string& textureFile
|
||||
|
||||
geom->setVertexArray(vertices);
|
||||
|
||||
osg::VertexBufferObject* vbObject = new osg::VertexBufferObject;
|
||||
vertices->setVertexBufferObject(vbObject);
|
||||
osg::VertexBufferObject* vbo = useVBO ? new osg::VertexBufferObject : 0;
|
||||
if (vbo) vertices->setVertexBufferObject(vbo);
|
||||
|
||||
osg::ElementBufferObject* ebo = new osg::ElementBufferObject;
|
||||
osg::ElementBufferObject* ebo = useVBO ? new osg::ElementBufferObject : 0;
|
||||
|
||||
for(iy=0; iy<num_y-1; ++iy)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||
|
||||
void read()
|
||||
{
|
||||
osg::BufferObject::Extensions* ext = osg::BufferObject::getExtensions(_gc->getState()->getContextID(),true);
|
||||
osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions(_gc->getState()->getContextID(),true);
|
||||
|
||||
if (ext->isPBOSupported() && !_pboBuffer.empty())
|
||||
{
|
||||
@ -158,9 +158,9 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||
|
||||
void readPixels();
|
||||
|
||||
void singlePBO(osg::BufferObject::Extensions* ext);
|
||||
void singlePBO(osg::GLBufferObject::Extensions* ext);
|
||||
|
||||
void multiPBO(osg::BufferObject::Extensions* ext);
|
||||
void multiPBO(osg::GLBufferObject::Extensions* ext);
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::Image> > ImageBuffer;
|
||||
typedef std::vector< GLuint > PBOBuffer;
|
||||
@ -325,7 +325,7 @@ void WindowCaptureCallback::ContextData::readPixels()
|
||||
_currentPboIndex = nextPboIndex;
|
||||
}
|
||||
|
||||
void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions* ext)
|
||||
void WindowCaptureCallback::ContextData::singlePBO(osg::GLBufferObject::Extensions* ext)
|
||||
{
|
||||
// std::cout<<"singelPBO( "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
|
||||
|
||||
@ -402,7 +402,7 @@ void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions
|
||||
_currentImageIndex = nextImageIndex;
|
||||
}
|
||||
|
||||
void WindowCaptureCallback::ContextData::multiPBO(osg::BufferObject::Extensions* ext)
|
||||
void WindowCaptureCallback::ContextData::multiPBO(osg::GLBufferObject::Extensions* ext)
|
||||
{
|
||||
// std::cout<<"multiPBO( "<<_fileName<<" image "<<_currentImageIndex<<" "<<_currentPboIndex<<std::endl;
|
||||
unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();
|
||||
|
@ -43,7 +43,7 @@ class ConstArrayVisitor;
|
||||
class ValueVisitor;
|
||||
class ConstValueVisitor;
|
||||
|
||||
class OSG_EXPORT Array : public Object
|
||||
class OSG_EXPORT Array : public BufferData
|
||||
{
|
||||
|
||||
public:
|
||||
@ -77,17 +77,13 @@ class OSG_EXPORT Array : public Object
|
||||
Array(Type arrayType=ArrayType,GLint dataSize=0,GLenum dataType=0):
|
||||
_arrayType(arrayType),
|
||||
_dataSize(dataSize),
|
||||
_dataType(dataType),
|
||||
_modifiedCount(0),
|
||||
_vboOffset(0) {}
|
||||
_dataType(dataType) {}
|
||||
|
||||
Array(const Array& array,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Object(array,copyop),
|
||||
BufferData(array,copyop),
|
||||
_arrayType(array._arrayType),
|
||||
_dataSize(array._dataSize),
|
||||
_dataType(array._dataType),
|
||||
_modifiedCount(0),
|
||||
_vboOffset(0) {}
|
||||
_dataType(array._dataType) {}
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const Array*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
@ -113,61 +109,22 @@ class OSG_EXPORT Array : public Object
|
||||
/** Frees unused space on this vector - i.e. the difference between size() and max_size() of the underlying vector.*/
|
||||
virtual void trim() {}
|
||||
|
||||
/** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
|
||||
inline void dirty() { ++_modifiedCount; if (_vbo.valid()) _vbo->dirty(); }
|
||||
|
||||
/** Set the modified count value.*/
|
||||
inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
|
||||
|
||||
/** Get modified count value.*/
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
/** Set the VertexBufferObject.*/
|
||||
inline void setVertexBufferObject(osg::VertexBufferObject* vbo)
|
||||
{
|
||||
if (_vbo == vbo) return;
|
||||
|
||||
if (_vbo.valid())
|
||||
{
|
||||
_vbo->removeArray(this);
|
||||
}
|
||||
|
||||
_vbo = vbo;
|
||||
|
||||
if (_vbo.valid())
|
||||
{
|
||||
_vbo->addArray(this);
|
||||
}
|
||||
}
|
||||
inline void setVertexBufferObject(osg::VertexBufferObject* vbo) { setBufferObject(vbo); }
|
||||
|
||||
/** Get the VertexBufferObject. If no VBO is assigned returns NULL*/
|
||||
inline osg::VertexBufferObject* getVertexBufferObject() { return _vbo.get(); }
|
||||
inline osg::VertexBufferObject* getVertexBufferObject() { return dynamic_cast<osg::VertexBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
/** Get the const VertexBufferObject. If no VBO is assigned returns NULL*/
|
||||
inline const osg::VertexBufferObject* getVertexBufferObject() const { return _vbo.get(); }
|
||||
|
||||
/** Set the offset into the VertexBufferObject, if used.*/
|
||||
void setVertexBufferObjectOffset(const GLvoid* offset ) const { _vboOffset = offset; }
|
||||
|
||||
/** Get the offset into the VertexBufferObject, if used.*/
|
||||
const GLvoid* getVertexBufferObjectOffset() const { return _vboOffset; }
|
||||
inline const osg::VertexBufferObject* getVertexBufferObject() const { return dynamic_cast<const osg::VertexBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Array()
|
||||
{
|
||||
if (_vbo.valid())
|
||||
{
|
||||
_vbo->removeArray(this);
|
||||
}
|
||||
}
|
||||
virtual ~Array() {}
|
||||
|
||||
Type _arrayType;
|
||||
GLint _dataSize;
|
||||
GLenum _dataType;
|
||||
unsigned int _modifiedCount;
|
||||
osg::ref_ptr<osg::VertexBufferObject> _vbo;
|
||||
mutable const GLvoid* _vboOffset;
|
||||
};
|
||||
|
||||
template<typename T, Array::Type ARRAYTYPE, int DataSize, int DataType>
|
||||
|
@ -99,72 +99,75 @@ namespace osg
|
||||
{
|
||||
|
||||
class State;
|
||||
class BufferData;
|
||||
class BufferObject;
|
||||
|
||||
class OSG_EXPORT BufferObject : public Object
|
||||
class OSG_EXPORT GLBufferObject : public Referenced
|
||||
{
|
||||
public:
|
||||
|
||||
BufferObject();
|
||||
GLBufferObject(unsigned int contextID, BufferObject* bufferObject=0);
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
BufferObject(const BufferObject& bo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferObject*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "BufferObject"; }
|
||||
|
||||
/** Set what type of usage the buffer object will have. Options are:
|
||||
* GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY,
|
||||
* GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY,
|
||||
* GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
|
||||
*/
|
||||
void setUsage(GLenum usage) { _usage = usage; }
|
||||
|
||||
/** Get the type of usage the buffer object has been set up for.*/
|
||||
GLenum getUsage() const { return _usage; }
|
||||
void setBufferObject(BufferObject* bufferObject);
|
||||
BufferObject* getBufferObject() { return _bufferObject; }
|
||||
|
||||
struct BufferEntry
|
||||
{
|
||||
BufferEntry(): dataSize(0),offset(0) {}
|
||||
BufferEntry(const BufferEntry& be): modifiedCount(be.modifiedCount),dataSize(be.dataSize),offset(be.offset) {}
|
||||
BufferEntry(): modifiedCount(0),dataSize(0),offset(0),dataSource(0) {}
|
||||
|
||||
BufferEntry& operator = (const BufferEntry& be) { modifiedCount=be.modifiedCount; dataSize=be.dataSize; offset=be.offset; return *this; }
|
||||
BufferEntry(const BufferEntry& rhs):
|
||||
modifiedCount(rhs.modifiedCount),
|
||||
dataSize(rhs.dataSize),
|
||||
offset(rhs.offset),
|
||||
dataSource(rhs.dataSource) {}
|
||||
|
||||
mutable buffered_value<unsigned int> modifiedCount;
|
||||
mutable unsigned int dataSize;
|
||||
mutable unsigned int offset;
|
||||
BufferEntry& operator = (const BufferEntry& rhs)
|
||||
{
|
||||
if (&rhs==this) return *this;
|
||||
modifiedCount = rhs.modifiedCount;
|
||||
dataSize = rhs.dataSize;
|
||||
offset = rhs.offset;
|
||||
dataSource = rhs.dataSource;
|
||||
return *this;
|
||||
}
|
||||
|
||||
unsigned int modifiedCount;
|
||||
GLsizeiptrARB dataSize;
|
||||
GLsizeiptrARB offset;
|
||||
BufferData* dataSource;
|
||||
};
|
||||
|
||||
inline bool isBufferObjectSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isBufferObjectSupported(); }
|
||||
inline bool isPBOSupported(unsigned int contextID) const { return getExtensions(contextID,true)->isPBOSupported(); }
|
||||
inline unsigned int getContextID() const { return _contextID; }
|
||||
|
||||
inline GLuint& buffer(unsigned int contextID) const { return _bufferObjectList[contextID]; }
|
||||
inline GLuint& getGLObjectID() { return _glObjectID; }
|
||||
inline GLuint getGLObjectID() const { return _glObjectID; }
|
||||
inline GLsizeiptrARB getOffset(unsigned int i) const { return _bufferEntries[i].offset; }
|
||||
|
||||
inline void bindBuffer(unsigned int contextID) const
|
||||
inline void bindBuffer() const
|
||||
{
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
extensions->glBindBuffer(_target,_bufferObjectList[contextID]);
|
||||
_extensions->glBindBuffer(_target,_glObjectID);
|
||||
}
|
||||
|
||||
virtual void unbindBuffer(unsigned int contextID) const
|
||||
inline void unbindBuffer() const
|
||||
{
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
extensions->glBindBuffer(_target,0);
|
||||
_extensions->glBindBuffer(_target,0);
|
||||
}
|
||||
|
||||
inline void dirty() { _compiledList.setAllElementsTo(0); }
|
||||
inline bool isDirty() const { return _dirty; }
|
||||
|
||||
bool isDirty(unsigned int contextID) const { return _compiledList[contextID]==0; }
|
||||
void dirty() { _dirty = true; }
|
||||
|
||||
virtual void compileBuffer(State& state) const = 0;
|
||||
void clear();
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
void compileBuffer();
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
void releaseGLObjects(State* state=0) const;
|
||||
void deleteGLObject();
|
||||
|
||||
void assign(BufferObject* bufferObject);
|
||||
|
||||
bool isPBOSupported() const { return _extensions->isPBOSupported(); }
|
||||
|
||||
static GLBufferObject* createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject);
|
||||
|
||||
|
||||
/** Use deleteVertexBufferObject instead of glDeleteBuffers to allow
|
||||
@ -256,19 +259,148 @@ class OSG_EXPORT BufferObject : public Object
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~BufferObject();
|
||||
virtual ~GLBufferObject();
|
||||
|
||||
typedef osg::buffered_value<GLuint> GLObjectList;
|
||||
typedef osg::buffered_value<unsigned int> CompiledList;
|
||||
|
||||
mutable GLObjectList _bufferObjectList;
|
||||
mutable CompiledList _compiledList;
|
||||
unsigned int _contextID;
|
||||
GLuint _glObjectID;
|
||||
|
||||
GLenum _target;
|
||||
GLenum _usage;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
mutable unsigned int _totalSize;
|
||||
|
||||
typedef std::vector<BufferEntry> BufferEntries;
|
||||
BufferEntries _bufferEntries;
|
||||
|
||||
BufferObject* _bufferObject;
|
||||
|
||||
public:
|
||||
Extensions* _extensions;
|
||||
|
||||
};
|
||||
|
||||
class OSG_EXPORT BufferObject : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
BufferObject();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
BufferObject(const BufferObject& bo,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferObject*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "BufferObject"; }
|
||||
|
||||
void setTarget(GLenum target) { _target = target; }
|
||||
GLenum getTarget() const { return _target; }
|
||||
|
||||
/** Set what type of usage the buffer object will have. Options are:
|
||||
* GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY,
|
||||
* GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY,
|
||||
* GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
|
||||
*/
|
||||
void setUsage(GLenum usage) { _usage = usage; }
|
||||
|
||||
/** Get the type of usage the buffer object has been set up for.*/
|
||||
GLenum getUsage() const { return _usage; }
|
||||
|
||||
void dirty();
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
void releaseGLObjects(State* state=0) const;
|
||||
|
||||
unsigned int addBufferData(BufferData* bd);
|
||||
void removeBufferData(unsigned int index);
|
||||
void removeBufferData(BufferData* bd);
|
||||
|
||||
void setBufferData(unsigned int index, BufferData* bd);
|
||||
BufferData* getBufferData(unsigned int index) { return _bufferDataList[index]; }
|
||||
const BufferData* getBufferData(unsigned int index) const { return _bufferDataList[index]; }
|
||||
|
||||
unsigned int getNumBufferData() const { return _bufferDataList.size(); }
|
||||
|
||||
GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _glBufferObjects[contextID].get(); }
|
||||
|
||||
GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const
|
||||
{
|
||||
if (!_glBufferObjects[contextID]) _glBufferObjects[contextID] = GLBufferObject::createGLBufferObject(contextID, this);
|
||||
return _glBufferObjects[contextID].get();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
~BufferObject();
|
||||
|
||||
typedef std::vector< BufferData* > BufferDataList;
|
||||
typedef osg::buffered_object< osg::ref_ptr<GLBufferObject> > GLBufferObjects;
|
||||
|
||||
GLenum _target;
|
||||
GLenum _usage;
|
||||
BufferDataList _bufferDataList;
|
||||
|
||||
mutable GLBufferObjects _glBufferObjects;
|
||||
};
|
||||
|
||||
class BufferData : public Object
|
||||
{
|
||||
public:
|
||||
|
||||
BufferData():
|
||||
Object(true),
|
||||
_modifiedCount(0),
|
||||
_bufferIndex(0) {}
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
BufferData(const BufferData& bd,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
osg::Object(bd,copyop),
|
||||
_modifiedCount(0),
|
||||
_bufferIndex(0) {}
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const BufferData*>(obj)!=NULL; }
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "BufferData"; }
|
||||
|
||||
virtual const GLvoid* getDataPointer() const = 0;
|
||||
virtual unsigned int getTotalDataSize() const = 0;
|
||||
|
||||
void setBufferObject(BufferObject* bufferObject);
|
||||
BufferObject* getBufferObject() { return _bufferObject.get(); }
|
||||
const BufferObject* getBufferObject() const { return _bufferObject.get(); }
|
||||
|
||||
void setBufferIndex(unsigned int index) { _bufferIndex = index; }
|
||||
unsigned int getBufferIndex() const { return _bufferIndex; }
|
||||
|
||||
GLBufferObject* getGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getGLBufferObject(contextID) : 0; }
|
||||
GLBufferObject* getOrCreateGLBufferObject(unsigned int contextID) const { return _bufferObject.valid() ? _bufferObject->getOrCreateGLBufferObject(contextID) : 0; }
|
||||
|
||||
/** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
|
||||
inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }
|
||||
|
||||
/** Set the modified count value.*/
|
||||
inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
|
||||
|
||||
/** Get modified count value.*/
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~BufferData();
|
||||
|
||||
unsigned int _modifiedCount;
|
||||
|
||||
unsigned int _bufferIndex;
|
||||
osg::ref_ptr<BufferObject> _bufferObject;
|
||||
};
|
||||
|
||||
|
||||
class Array;
|
||||
class OSG_EXPORT VertexBufferObject : public BufferObject
|
||||
{
|
||||
@ -281,28 +413,15 @@ class OSG_EXPORT VertexBufferObject : public BufferObject
|
||||
|
||||
META_Object(osg,VertexBufferObject);
|
||||
|
||||
typedef std::pair< BufferEntry, Array* > BufferEntryArrayPair;
|
||||
typedef std::vector< BufferEntryArrayPair > BufferEntryArrayPairs;
|
||||
|
||||
unsigned int addArray(osg::Array* array);
|
||||
void removeArray(osg::Array* array);
|
||||
|
||||
void setArray(unsigned int i, Array* array);
|
||||
Array* getArray(unsigned int i) { return _bufferEntryArrayPairs[i].second; }
|
||||
const Array* getArray(unsigned int i) const { return _bufferEntryArrayPairs[i].second; }
|
||||
|
||||
const GLvoid* getOffset(unsigned int i) const { return (const GLvoid*)(((char *)0)+(_bufferEntryArrayPairs[i].first.offset)); }
|
||||
|
||||
virtual void compileBuffer(State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
Array* getArray(unsigned int i);
|
||||
const Array* getArray(unsigned int i) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~VertexBufferObject();
|
||||
|
||||
BufferEntryArrayPairs _bufferEntryArrayPairs;
|
||||
};
|
||||
|
||||
class DrawElements;
|
||||
@ -317,28 +436,16 @@ class OSG_EXPORT ElementBufferObject : public BufferObject
|
||||
|
||||
META_Object(osg,ElementBufferObject);
|
||||
|
||||
typedef std::pair< BufferEntry, DrawElements* > BufferEntryDrawElementsPair;
|
||||
typedef std::vector< BufferEntryDrawElementsPair > BufferEntryDrawElementsPairs;
|
||||
|
||||
unsigned int addDrawElements(osg::DrawElements* PrimitiveSet);
|
||||
void removeDrawElements(osg::DrawElements* PrimitiveSet);
|
||||
|
||||
void setDrawElements(unsigned int i, DrawElements* PrimitiveSet);
|
||||
DrawElements* getDrawElements(unsigned int i) { return _bufferEntryDrawElementsPairs[i].second; }
|
||||
const DrawElements* getDrawElements(unsigned int i) const { return _bufferEntryDrawElementsPairs[i].second; }
|
||||
|
||||
const GLvoid* getOffset(unsigned int i) const { return (const GLvoid*)(((char *)0)+(_bufferEntryDrawElementsPairs[i].first.offset)); }
|
||||
|
||||
virtual void compileBuffer(State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
DrawElements* getDrawElements(unsigned int i);
|
||||
const DrawElements* getDrawElements(unsigned int i) const;
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ElementBufferObject();
|
||||
|
||||
BufferEntryDrawElementsPairs _bufferEntryDrawElementsPairs;
|
||||
};
|
||||
|
||||
class Image;
|
||||
@ -353,25 +460,16 @@ class OSG_EXPORT PixelBufferObject : public BufferObject
|
||||
|
||||
META_Object(osg,PixelBufferObject);
|
||||
|
||||
typedef std::pair< BufferEntry, Image* > BufferEntryImagePair;
|
||||
|
||||
void setImage(osg::Image* image);
|
||||
|
||||
Image* getImage() { return _bufferEntryImagePair.second; }
|
||||
const Image* getImage() const { return _bufferEntryImagePair.second; }
|
||||
Image* getImage();
|
||||
const Image* getImage() const;
|
||||
|
||||
unsigned int offset() const { return _bufferEntryImagePair.first.offset; }
|
||||
|
||||
virtual void compileBuffer(State& state) const;
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize);
|
||||
bool isPBOSupported(unsigned int contextID) const { return _glBufferObjects[contextID]->isPBOSupported(); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~PixelBufferObject();
|
||||
|
||||
BufferEntryImagePair _bufferEntryImagePair;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -389,10 +487,10 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
|
||||
META_Object(osg, PixelDataBufferObject);
|
||||
|
||||
//! Set new size of the buffer object. This will reallocate the memory on the next compile
|
||||
inline void setDataSize(unsigned int size) { _bufferData.dataSize = size; dirty(); }
|
||||
inline void setDataSize(unsigned int size) { _dataSize = size; dirty(); }
|
||||
|
||||
//! Get data size of the used buffer
|
||||
inline unsigned int getDataSize() { return _bufferData.dataSize; }
|
||||
inline unsigned int getDataSize() const { return _dataSize; }
|
||||
|
||||
//! Compile the buffer (reallocate the memory if buffer is dirty)
|
||||
virtual void compileBuffer(State& state) const;
|
||||
@ -427,7 +525,7 @@ class OSG_EXPORT PixelDataBufferObject : public BufferObject
|
||||
|
||||
virtual ~PixelDataBufferObject();
|
||||
|
||||
BufferEntry _bufferData;
|
||||
unsigned int _dataSize;
|
||||
|
||||
typedef osg::buffered_value<unsigned int> ModeList;
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace osg {
|
||||
class NodeVisitor;
|
||||
|
||||
/** Image class for encapsulating the storage texture image data. */
|
||||
class OSG_EXPORT Image : public Object
|
||||
class OSG_EXPORT Image : public BufferData
|
||||
{
|
||||
|
||||
public :
|
||||
@ -77,6 +77,9 @@ class OSG_EXPORT Image : public Object
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
virtual const char* className() const { return "Image"; }
|
||||
|
||||
virtual const GLvoid* getDataPointer() const { return data(); }
|
||||
virtual unsigned int getTotalDataSize() const { return getTotalSizeInBytesIncludingMipmaps(); }
|
||||
|
||||
/** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
|
||||
virtual int compare(const Image& rhs) const;
|
||||
|
||||
@ -253,16 +256,6 @@ class OSG_EXPORT Image : public Object
|
||||
*/
|
||||
void ensureValidSizeForTexturing(GLint maxTextureSize);
|
||||
|
||||
/** Dirty the image, which increments the modified count, to force osg::Texture to reload the image. */
|
||||
inline void dirty() { ++_modifiedCount; if (_bufferObject.valid()) _bufferObject->dirty(); }
|
||||
|
||||
/** Set the modified count value. Used by osg::Texture when using texture subloading. */
|
||||
inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
|
||||
|
||||
/** Get modified count value. Used by osg::Texture when using texture subloading. */
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
|
||||
static bool isPackedType(GLenum type);
|
||||
static GLenum computePixelFormat(GLenum pixelFormat);
|
||||
static GLenum computeFormatDataType(GLenum pixelFormat);
|
||||
@ -316,13 +309,13 @@ class OSG_EXPORT Image : public Object
|
||||
virtual bool isImageTranslucent() const;
|
||||
|
||||
/** Set the optional PixelBufferObject used to map the image memory efficiently to graphics memory. */
|
||||
void setPixelBufferObject(PixelBufferObject* buffer) { _bufferObject = buffer; if (_bufferObject.valid()) _bufferObject->setImage(this); }
|
||||
void setPixelBufferObject(PixelBufferObject* buffer) { setBufferObject(buffer); }
|
||||
|
||||
/** Get the PixelBufferObject.*/
|
||||
PixelBufferObject* getPixelBufferObject() { return _bufferObject.get(); }
|
||||
PixelBufferObject* getPixelBufferObject() { return dynamic_cast<PixelBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
/** Get the const PixelBufferObject.*/
|
||||
const PixelBufferObject* getPixelBufferObject() const { return _bufferObject.get(); }
|
||||
const PixelBufferObject* getPixelBufferObject() const { return dynamic_cast<const PixelBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
virtual void update(NodeVisitor* /*nv*/) {}
|
||||
|
||||
@ -361,8 +354,6 @@ class OSG_EXPORT Image : public Object
|
||||
|
||||
void setData(unsigned char* data,AllocationMode allocationMode);
|
||||
|
||||
unsigned int _modifiedCount;
|
||||
|
||||
MipmapDataType _mipmapData;
|
||||
|
||||
ref_ptr<PixelBufferObject> _bufferObject;
|
||||
|
@ -147,7 +147,7 @@ public:
|
||||
|
||||
class DrawElements;
|
||||
|
||||
class OSG_EXPORT PrimitiveSet : public Object
|
||||
class OSG_EXPORT PrimitiveSet : public BufferData
|
||||
{
|
||||
public:
|
||||
|
||||
@ -179,15 +179,13 @@ class OSG_EXPORT PrimitiveSet : public Object
|
||||
_primitiveType(primType),
|
||||
_numInstances(numInstances),
|
||||
_mode(mode),
|
||||
_modifiedCount(0),
|
||||
_rangeModifiedCount(0) {}
|
||||
|
||||
PrimitiveSet(const PrimitiveSet& prim,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
Object(prim,copyop),
|
||||
BufferData(prim,copyop),
|
||||
_primitiveType(prim._primitiveType),
|
||||
_numInstances(prim._numInstances),
|
||||
_mode(prim._mode),
|
||||
_modifiedCount(0),
|
||||
_rangeModifiedCount(0) {}
|
||||
|
||||
virtual bool isSameKindAs(const Object* obj) const { return dynamic_cast<const PrimitiveSet*>(obj)!=NULL; }
|
||||
@ -219,23 +217,6 @@ class OSG_EXPORT PrimitiveSet : public Object
|
||||
|
||||
virtual unsigned int getNumPrimitives() const;
|
||||
|
||||
/** Dirty the primitive, which increments the modified count, to force buffer objects to update. */
|
||||
virtual void dirty() { ++_modifiedCount; }
|
||||
|
||||
/** Set the modified count value.*/
|
||||
inline void setModifiedCount(unsigned int value) { _modifiedCount=value; }
|
||||
|
||||
/** Get modified count value.*/
|
||||
inline unsigned int getModifiedCount() const { return _modifiedCount; }
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(State* /*state*/=0) const {}
|
||||
|
||||
virtual void computeRange() const {}
|
||||
|
||||
protected:
|
||||
@ -245,31 +226,7 @@ class OSG_EXPORT PrimitiveSet : public Object
|
||||
Type _primitiveType;
|
||||
int _numInstances;
|
||||
GLenum _mode;
|
||||
unsigned int _modifiedCount;
|
||||
mutable unsigned int _rangeModifiedCount;
|
||||
|
||||
struct ObjectIDModifiedCountPair
|
||||
{
|
||||
ObjectIDModifiedCountPair():
|
||||
_objectID(0),
|
||||
_modifiedCount(0) {}
|
||||
|
||||
ObjectIDModifiedCountPair(const ObjectIDModifiedCountPair& obj):
|
||||
_objectID(obj._objectID),
|
||||
_modifiedCount(obj._modifiedCount) {}
|
||||
|
||||
ObjectIDModifiedCountPair& operator = (const ObjectIDModifiedCountPair& obj)
|
||||
{
|
||||
_objectID = obj._objectID;
|
||||
_modifiedCount = obj._modifiedCount;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLuint _objectID;
|
||||
unsigned int _modifiedCount;
|
||||
};
|
||||
|
||||
typedef osg::buffered_object<ObjectIDModifiedCountPair> GLObjectList;
|
||||
};
|
||||
|
||||
class OSG_EXPORT DrawArrays : public PrimitiveSet
|
||||
@ -392,64 +349,23 @@ class DrawElements : public PrimitiveSet
|
||||
public:
|
||||
|
||||
DrawElements(Type primType=PrimitiveType, GLenum mode=0, int numInstances=0):
|
||||
PrimitiveSet(primType,mode, numInstances),
|
||||
_eboOffset(0) {}
|
||||
PrimitiveSet(primType,mode, numInstances) {}
|
||||
|
||||
DrawElements(const DrawElements& copy,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
|
||||
PrimitiveSet(copy,copyop),
|
||||
_eboOffset(0) {}
|
||||
PrimitiveSet(copy,copyop) {}
|
||||
|
||||
|
||||
virtual DrawElements* getDrawElements() { return this; }
|
||||
virtual const DrawElements* getDrawElements() const { return this; }
|
||||
|
||||
virtual void dirty() { ++_modifiedCount; if (_ebo.valid()) _ebo->dirty(); }
|
||||
|
||||
/** Set the ElementBufferObject.*/
|
||||
inline void setElementBufferObject(osg::ElementBufferObject* ebo)
|
||||
{
|
||||
if (_ebo == ebo) return;
|
||||
|
||||
if (_ebo.valid())
|
||||
{
|
||||
_ebo->removeDrawElements(this);
|
||||
}
|
||||
|
||||
_ebo = ebo;
|
||||
|
||||
if (_ebo.valid())
|
||||
{
|
||||
_ebo->addDrawElements(this);
|
||||
}
|
||||
}
|
||||
inline void setElementBufferObject(osg::ElementBufferObject* ebo) { setBufferObject(ebo); }
|
||||
|
||||
/** Get the ElementBufferObject. If no EBO is assigned returns NULL*/
|
||||
inline osg::ElementBufferObject* getElementBufferObject() { return _ebo.get(); }
|
||||
inline osg::ElementBufferObject* getElementBufferObject() { return dynamic_cast<osg::ElementBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
/** Get the const ElementBufferObject. If no EBO is assigned returns NULL*/
|
||||
inline const osg::ElementBufferObject* getElementBufferObject() const { return _ebo.get(); }
|
||||
|
||||
/** Set the offset into the ElementBufferObject, if used.*/
|
||||
inline void setElementBufferObjectOffset(const GLvoid* offset) const { _eboOffset = offset; }
|
||||
|
||||
/** Get the offset into the ElementBufferOffset, if used.*/
|
||||
inline const GLvoid* getElementBufferObjectOffset() const { return _eboOffset; }
|
||||
|
||||
|
||||
/** Resize any per context GLObject buffers to specified size. */
|
||||
virtual void resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
if (_ebo.valid()) _ebo->resizeGLObjectBuffers(maxSize);
|
||||
}
|
||||
|
||||
/** If State is non-zero, this function releases OpenGL objects for
|
||||
* the specified graphics context. Otherwise, releases OpenGL objects
|
||||
* for all graphics contexts. */
|
||||
virtual void releaseGLObjects(State* state=0) const
|
||||
{
|
||||
if (_ebo.valid()) _ebo->releaseGLObjects(state);
|
||||
}
|
||||
|
||||
inline const osg::ElementBufferObject* getElementBufferObject() const { return dynamic_cast<const osg::ElementBufferObject*>(_bufferObject.get()); }
|
||||
|
||||
virtual void reserveElements(unsigned int numIndices) = 0;
|
||||
virtual void setElement(unsigned int, unsigned int) = 0;
|
||||
@ -458,17 +374,7 @@ class DrawElements : public PrimitiveSet
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~DrawElements()
|
||||
{
|
||||
if (_ebo.valid())
|
||||
{
|
||||
_ebo->removeDrawElements(this);
|
||||
}
|
||||
}
|
||||
|
||||
osg::ref_ptr<ElementBufferObject> _ebo;
|
||||
mutable const GLvoid* _eboOffset;
|
||||
|
||||
virtual ~DrawElements() {}
|
||||
};
|
||||
|
||||
class OSG_EXPORT DrawElementsUByte : public DrawElements, public VectorGLubyte
|
||||
|
@ -405,13 +405,13 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
void dirtyAllVertexArrays();
|
||||
|
||||
|
||||
void setCurrentVertexBufferObject(osg::VertexBufferObject* vbo) { _currentVBO = vbo; }
|
||||
const VertexBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
|
||||
inline void bindVertexBufferObject(const osg::VertexBufferObject* vbo)
|
||||
void setCurrentVertexBufferObject(osg::GLBufferObject* vbo) { _currentVBO = vbo; }
|
||||
const GLBufferObject* getCurrentVertexBufferObject() { return _currentVBO; }
|
||||
inline void bindVertexBufferObject(osg::GLBufferObject* vbo)
|
||||
{
|
||||
if (vbo == _currentVBO) return;
|
||||
if (vbo->isDirty(_contextID)) vbo->compileBuffer(*this);
|
||||
else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo->buffer(_contextID));
|
||||
if (vbo->isDirty()) vbo->compileBuffer();
|
||||
else _glBindBuffer(GL_ARRAY_BUFFER_ARB,vbo->getGLObjectID());
|
||||
_currentVBO = vbo;
|
||||
}
|
||||
|
||||
@ -422,14 +422,14 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
_currentVBO = 0;
|
||||
}
|
||||
|
||||
void setCurrentElementBufferObject(osg::ElementBufferObject* ebo) { _currentEBO = ebo; }
|
||||
const ElementBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
|
||||
void setCurrentElementBufferObject(osg::GLBufferObject* ebo) { _currentEBO = ebo; }
|
||||
const GLBufferObject* getCurrentElementBufferObject() { return _currentEBO; }
|
||||
|
||||
inline void bindElementBufferObject(const osg::ElementBufferObject* ebo)
|
||||
inline void bindElementBufferObject(osg::GLBufferObject* ebo)
|
||||
{
|
||||
if (ebo == _currentEBO) return;
|
||||
if (ebo->isDirty(_contextID)) ebo->compileBuffer(*this);
|
||||
else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo->buffer(_contextID));
|
||||
if (ebo->isDirty()) ebo->compileBuffer();
|
||||
else _glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB,ebo->getGLObjectID());
|
||||
_currentEBO = ebo;
|
||||
}
|
||||
|
||||
@ -440,15 +440,15 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
_currentEBO = 0;
|
||||
}
|
||||
|
||||
void setCurrentPixelBufferObject(osg::PixelBufferObject* pbo) { _currentPBO = pbo; }
|
||||
const PixelBufferObject* getCurrentPixelBufferObject() { return _currentPBO; }
|
||||
void setCurrentPixelBufferObject(osg::GLBufferObject* pbo) { _currentPBO = pbo; }
|
||||
const GLBufferObject* getCurrentPixelBufferObject() { return _currentPBO; }
|
||||
|
||||
inline void bindPixelBufferObject(const osg::PixelBufferObject* pbo)
|
||||
inline void bindPixelBufferObject(osg::GLBufferObject* pbo)
|
||||
{
|
||||
if (pbo == _currentPBO) return;
|
||||
|
||||
if (pbo->isDirty(_contextID)) pbo->compileBuffer(*this);
|
||||
else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo->buffer(_contextID));
|
||||
if (pbo->isDirty()) pbo->compileBuffer();
|
||||
else _glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,pbo->getGLObjectID());
|
||||
|
||||
_currentPBO = pbo;
|
||||
}
|
||||
@ -485,11 +485,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
setVertexPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
setVertexPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -542,11 +542,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
setNormalPointer(array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
setNormalPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -598,11 +598,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
setColorPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
setColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -659,15 +659,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
#if 0
|
||||
setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
|
||||
#else
|
||||
setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
#endif
|
||||
setSecondaryColorPointer(array->getDataSize(),array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -745,15 +741,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
#if 0
|
||||
setFogCoordPointer(array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
|
||||
#else
|
||||
setFogCoordPointer(array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
#endif
|
||||
setFogCoordPointer(array->getDataType(),0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -794,15 +786,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
#if 0
|
||||
setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,vbo->getOffset(array->getVertexBufferObjectIndex()));
|
||||
#else
|
||||
setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0,array->getVertexBufferObjectOffset());
|
||||
#endif
|
||||
setTexCoordPointer(unit, array->getDataSize(),array->getDataType(),0, (const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -916,15 +904,11 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
{
|
||||
if (array)
|
||||
{
|
||||
const VertexBufferObject* vbo = array->getVertexBufferObject();
|
||||
GLBufferObject* vbo = array->getOrCreateGLBufferObject(_contextID);
|
||||
if (vbo)
|
||||
{
|
||||
bindVertexBufferObject(vbo);
|
||||
#if 0
|
||||
setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,vbo->getOffset(array->getVertexBufferObjectIndex()));
|
||||
#else
|
||||
setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,array->getVertexBufferObjectOffset());
|
||||
#endif
|
||||
setVertexAttribPointer(unit, array->getDataSize(),array->getDataType(),normalized,0,(const GLvoid *)(vbo->getOffset(array->getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1279,9 +1263,9 @@ class OSG_EXPORT State : public Referenced, public Observer
|
||||
|
||||
unsigned int _currentActiveTextureUnit;
|
||||
unsigned int _currentClientActiveTextureUnit;
|
||||
const VertexBufferObject* _currentVBO;
|
||||
const ElementBufferObject* _currentEBO;
|
||||
const PixelBufferObject* _currentPBO;
|
||||
GLBufferObject* _currentVBO;
|
||||
GLBufferObject* _currentEBO;
|
||||
GLBufferObject* _currentPBO;
|
||||
|
||||
|
||||
inline ModeMap& getOrCreateTextureModeMap(unsigned int unit)
|
||||
|
@ -37,7 +37,185 @@ typedef osg::buffered_object<BufferObjectMap> DeletedBufferObjectCache;
|
||||
static OpenThreads::Mutex s_mutex_deletedBufferObjectCache;
|
||||
static DeletedBufferObjectCache s_deletedBufferObjectCache;
|
||||
|
||||
void BufferObject::deleteBufferObject(unsigned int contextID,GLuint globj)
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// GLBufferObject
|
||||
//
|
||||
GLBufferObject::GLBufferObject(unsigned int contextID, BufferObject* bufferObject):
|
||||
_contextID(contextID),
|
||||
_glObjectID(0),
|
||||
_target(0),
|
||||
_usage(0),
|
||||
_dirty(true),
|
||||
_totalSize(0),
|
||||
_bufferObject(0),
|
||||
_extensions(0)
|
||||
{
|
||||
assign(bufferObject);
|
||||
_extensions = GLBufferObject::getExtensions(contextID, true);
|
||||
_extensions->glGenBuffers(1, &_glObjectID);
|
||||
}
|
||||
|
||||
GLBufferObject::~GLBufferObject()
|
||||
{
|
||||
if (_glObjectID!=0) GLBufferObject::deleteBufferObject(_contextID, _glObjectID);
|
||||
|
||||
}
|
||||
|
||||
void GLBufferObject::assign(BufferObject* bufferObject)
|
||||
{
|
||||
_bufferObject = bufferObject;
|
||||
|
||||
if (_bufferObject)
|
||||
{
|
||||
_target = bufferObject->getTarget();
|
||||
_usage = bufferObject->getUsage();
|
||||
|
||||
_totalSize = 0;
|
||||
|
||||
_dirty = true;
|
||||
|
||||
_bufferEntries.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
_target = 0;
|
||||
_usage = 0;
|
||||
|
||||
_totalSize = 0;
|
||||
|
||||
// clear all previous entries;
|
||||
_bufferEntries.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void GLBufferObject::clear()
|
||||
{
|
||||
_bufferEntries.clear();
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
void GLBufferObject::compileBuffer()
|
||||
{
|
||||
_dirty = false;
|
||||
|
||||
_bufferEntries.reserve(_bufferObject->getNumBufferData());
|
||||
|
||||
_totalSize = 0;
|
||||
|
||||
bool compileAll = false;
|
||||
bool offsetChanged = false;
|
||||
|
||||
GLsizeiptrARB newTotalSize = 0;
|
||||
unsigned int i=0;
|
||||
for(; i<_bufferObject->getNumBufferData(); ++i)
|
||||
{
|
||||
BufferData* bd = _bufferObject->getBufferData(i);
|
||||
if (i<_bufferEntries.size())
|
||||
{
|
||||
BufferEntry& entry = _bufferEntries[i];
|
||||
if (offsetChanged ||
|
||||
entry.dataSource != bd ||
|
||||
entry.dataSize != bd->getTotalDataSize())
|
||||
{
|
||||
GLsizeiptrARB previousEndOfBufferDataMarker = GLsizeiptrARB(entry.offset) + entry.dataSize;
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"GLBufferObject::compileBuffer(..) updating BufferEntry"<<std::endl;
|
||||
|
||||
|
||||
entry.offset = newTotalSize;
|
||||
entry.modifiedCount = 0xffffff;
|
||||
entry.dataSize = bd->getTotalDataSize();
|
||||
entry.dataSource = bd;
|
||||
|
||||
newTotalSize += entry.dataSize;
|
||||
if (previousEndOfBufferDataMarker==newTotalSize)
|
||||
{
|
||||
offsetChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BufferEntry entry;
|
||||
entry.offset = newTotalSize;
|
||||
entry.modifiedCount = 0xffffff;
|
||||
entry.dataSize = bd->getTotalDataSize();
|
||||
entry.dataSource = bd;
|
||||
#if 0
|
||||
osg::notify(osg::NOTICE)<<"entry"<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" offset "<<entry.offset<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" dataSize "<<entry.dataSize<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" dataSource "<<entry.dataSource<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<" modifiedCount "<<entry.modifiedCount<<std::endl;
|
||||
#endif
|
||||
newTotalSize += entry.dataSize;
|
||||
|
||||
_bufferEntries.push_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
if (i<_bufferEntries.size())
|
||||
{
|
||||
// triming end of bufferEntries as the source data is has less entries than the originally held.
|
||||
_bufferEntries.erase(_bufferEntries.begin()+i, _bufferEntries.end());
|
||||
}
|
||||
|
||||
_extensions->glBindBuffer(_target, _glObjectID);
|
||||
|
||||
if (newTotalSize != _totalSize)
|
||||
{
|
||||
_totalSize = newTotalSize;
|
||||
_extensions->glBufferData(_target, _totalSize, NULL, _usage);
|
||||
}
|
||||
|
||||
char* vboMemory = 0;
|
||||
|
||||
#if 0
|
||||
vboMemory = extensions->glMapBuffer(_target, GL_WRITE_ONLY_ARB);
|
||||
#endif
|
||||
|
||||
for(BufferEntries::iterator itr = _bufferEntries.begin();
|
||||
itr != _bufferEntries.end();
|
||||
++itr)
|
||||
{
|
||||
BufferEntry& entry = *itr;
|
||||
if (compileAll || entry.modifiedCount != entry.dataSource->getModifiedCount())
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"GLBufferObject::compileBuffer(..) downloading BufferEntry "<<&entry<<std::endl;
|
||||
entry.modifiedCount = entry.dataSource->getModifiedCount();
|
||||
|
||||
if (vboMemory)
|
||||
memcpy(vboMemory + (GLsizeiptrARB)entry.offset, entry.dataSource->getDataPointer(), entry.dataSize);
|
||||
else
|
||||
_extensions->glBufferSubData(_target, (GLintptrARB)entry.offset, (GLsizeiptrARB)entry.dataSize, entry.dataSource->getDataPointer());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Unmap the texture image buffer
|
||||
if (vboMemory) _extensions->glUnmapBuffer(_target);
|
||||
}
|
||||
|
||||
GLBufferObject* GLBufferObject::createGLBufferObject(unsigned int contextID, const BufferObject* bufferObject)
|
||||
{
|
||||
return new GLBufferObject(contextID, const_cast<BufferObject*>(bufferObject));
|
||||
}
|
||||
|
||||
void GLBufferObject::deleteGLObject()
|
||||
{
|
||||
if (_glObjectID!=0)
|
||||
{
|
||||
_extensions->glDeleteBuffers(1, &_glObjectID);
|
||||
_glObjectID = 0;
|
||||
|
||||
_totalSize = 0;
|
||||
_bufferEntries.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GLBufferObject::deleteBufferObject(unsigned int contextID,GLuint globj)
|
||||
{
|
||||
if (globj!=0)
|
||||
{
|
||||
@ -48,7 +226,7 @@ void BufferObject::deleteBufferObject(unsigned int contextID,GLuint globj)
|
||||
}
|
||||
}
|
||||
|
||||
void BufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime)
|
||||
void GLBufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*currentTime*/, double& availableTime)
|
||||
{
|
||||
// if no time available don't try to flush objects.
|
||||
if (availableTime<=0.0) return;
|
||||
@ -84,85 +262,38 @@ void BufferObject::flushDeletedBufferObjects(unsigned int contextID,double /*cur
|
||||
availableTime -= elapsedTime;
|
||||
}
|
||||
|
||||
void BufferObject::discardDeletedBufferObjects(unsigned int contextID)
|
||||
void GLBufferObject::discardDeletedBufferObjects(unsigned int contextID)
|
||||
{
|
||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_deletedBufferObjectCache);
|
||||
BufferObjectMap& dll = s_deletedBufferObjectCache[contextID];
|
||||
dll.clear();
|
||||
}
|
||||
|
||||
|
||||
BufferObject::BufferObject():
|
||||
_target(0),
|
||||
_usage(0),
|
||||
_totalSize(0)
|
||||
{
|
||||
}
|
||||
|
||||
BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
|
||||
Object(bo,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
BufferObject::~BufferObject()
|
||||
{
|
||||
releaseGLObjects(0);
|
||||
}
|
||||
|
||||
void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_bufferObjectList.resize(maxSize);
|
||||
}
|
||||
|
||||
void BufferObject::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
unsigned int contextID = state->getContextID();
|
||||
if (_bufferObjectList[contextID])
|
||||
{
|
||||
deleteBufferObject(contextID,_bufferObjectList[contextID]);
|
||||
_bufferObjectList[contextID] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(unsigned int contextID=0;contextID<_bufferObjectList.size();++contextID)
|
||||
{
|
||||
if (_bufferObjectList[contextID])
|
||||
{
|
||||
deleteBufferObject(contextID,_bufferObjectList[contextID]);
|
||||
_bufferObjectList[contextID] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Extension support
|
||||
//
|
||||
|
||||
typedef buffered_value< ref_ptr<BufferObject::Extensions> > BufferedExtensions;
|
||||
typedef buffered_value< ref_ptr<GLBufferObject::Extensions> > BufferedExtensions;
|
||||
static BufferedExtensions s_extensions;
|
||||
|
||||
BufferObject::Extensions* BufferObject::getExtensions(unsigned int contextID,bool createIfNotInitalized)
|
||||
GLBufferObject::Extensions* GLBufferObject::getExtensions(unsigned int contextID,bool createIfNotInitalized)
|
||||
{
|
||||
if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new BufferObject::Extensions(contextID);
|
||||
if (!s_extensions[contextID] && createIfNotInitalized) s_extensions[contextID] = new GLBufferObject::Extensions(contextID);
|
||||
return s_extensions[contextID].get();
|
||||
}
|
||||
|
||||
void BufferObject::setExtensions(unsigned int contextID,Extensions* extensions)
|
||||
void GLBufferObject::setExtensions(unsigned int contextID,Extensions* extensions)
|
||||
{
|
||||
s_extensions[contextID] = extensions;
|
||||
}
|
||||
|
||||
BufferObject::Extensions::Extensions(unsigned int contextID)
|
||||
GLBufferObject::Extensions::Extensions(unsigned int contextID)
|
||||
{
|
||||
setupGLExtensions(contextID);
|
||||
}
|
||||
|
||||
BufferObject::Extensions::Extensions(const Extensions& rhs):
|
||||
GLBufferObject::Extensions::Extensions(const Extensions& rhs):
|
||||
Referenced()
|
||||
{
|
||||
_glGenBuffers = rhs._glGenBuffers;
|
||||
@ -179,7 +310,7 @@ BufferObject::Extensions::Extensions(const Extensions& rhs):
|
||||
}
|
||||
|
||||
|
||||
void BufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
void GLBufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
{
|
||||
if (!rhs._glGenBuffers) _glGenBuffers = rhs._glGenBuffers;
|
||||
if (!rhs._glBindBuffer) _glBindBuffer = rhs._glBindBuffer;
|
||||
@ -194,7 +325,7 @@ void BufferObject::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
if (!rhs._glGetBufferParameteriv) _glGetBufferPointerv = rhs._glGetBufferPointerv;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::setupGLExtensions(unsigned int contextID)
|
||||
void GLBufferObject::Extensions::setupGLExtensions(unsigned int contextID)
|
||||
{
|
||||
setGLExtensionFuncPtr(_glGenBuffers, "glGenBuffers","glGenBuffersARB");
|
||||
setGLExtensionFuncPtr(_glBindBuffer, "glBindBuffer","glBindBufferARB");
|
||||
@ -210,37 +341,37 @@ void BufferObject::Extensions::setupGLExtensions(unsigned int contextID)
|
||||
_isPBOSupported = osg::isGLExtensionSupported(contextID,"GL_ARB_pixel_buffer_object");
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
|
||||
void GLBufferObject::Extensions::glGenBuffers(GLsizei n, GLuint *buffers) const
|
||||
{
|
||||
if (_glGenBuffers) _glGenBuffers(n, buffers);
|
||||
else notify(WARN)<<"Error: glGenBuffers not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glBindBuffer(GLenum target, GLuint buffer) const
|
||||
void GLBufferObject::Extensions::glBindBuffer(GLenum target, GLuint buffer) const
|
||||
{
|
||||
if (_glBindBuffer) _glBindBuffer(target, buffer);
|
||||
else notify(WARN)<<"Error: glBindBuffer not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glBufferData(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const
|
||||
void GLBufferObject::Extensions::glBufferData(GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage) const
|
||||
{
|
||||
if (_glBufferData) _glBufferData(target, size, data, usage);
|
||||
else notify(WARN)<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const
|
||||
void GLBufferObject::Extensions::glBufferSubData(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data) const
|
||||
{
|
||||
if (_glBufferSubData) _glBufferSubData(target, offset, size, data);
|
||||
else notify(WARN)<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glDeleteBuffers(GLsizei n, const GLuint *buffers) const
|
||||
void GLBufferObject::Extensions::glDeleteBuffers(GLsizei n, const GLuint *buffers) const
|
||||
{
|
||||
if (_glDeleteBuffers) _glDeleteBuffers(n, buffers);
|
||||
else notify(WARN)<<"Error: glBufferData not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
GLboolean BufferObject::Extensions::glIsBuffer (GLuint buffer) const
|
||||
GLboolean GLBufferObject::Extensions::glIsBuffer (GLuint buffer) const
|
||||
{
|
||||
if (_glIsBuffer) return _glIsBuffer(buffer);
|
||||
else
|
||||
@ -250,13 +381,13 @@ GLboolean BufferObject::Extensions::glIsBuffer (GLuint buffer) const
|
||||
}
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const
|
||||
void GLBufferObject::Extensions::glGetBufferSubData (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data) const
|
||||
{
|
||||
if (_glGetBufferSubData) _glGetBufferSubData(target,offset,size,data);
|
||||
else notify(WARN)<<"Error: glGetBufferSubData not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
GLvoid* BufferObject::Extensions::glMapBuffer (GLenum target, GLenum access) const
|
||||
GLvoid* GLBufferObject::Extensions::glMapBuffer (GLenum target, GLenum access) const
|
||||
{
|
||||
if (_glMapBuffer) return _glMapBuffer(target,access);
|
||||
else
|
||||
@ -266,7 +397,7 @@ GLvoid* BufferObject::Extensions::glMapBuffer (GLenum target, GLenum access) con
|
||||
}
|
||||
}
|
||||
|
||||
GLboolean BufferObject::Extensions::glUnmapBuffer (GLenum target) const
|
||||
GLboolean GLBufferObject::Extensions::glUnmapBuffer (GLenum target) const
|
||||
{
|
||||
if (_glUnmapBuffer) return _glUnmapBuffer(target);
|
||||
else
|
||||
@ -276,18 +407,149 @@ GLboolean BufferObject::Extensions::glUnmapBuffer (GLenum target) const
|
||||
}
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const
|
||||
void GLBufferObject::Extensions::glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params) const
|
||||
{
|
||||
if (_glGetBufferParameteriv) _glGetBufferParameteriv(target,pname,params);
|
||||
else notify(WARN)<<"Error: glGetBufferParameteriv not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
void BufferObject::Extensions::glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const
|
||||
void GLBufferObject::Extensions::glGetBufferPointerv (GLenum target, GLenum pname, GLvoid* *params) const
|
||||
{
|
||||
if (_glGetBufferPointerv) _glGetBufferPointerv(target,pname,params);
|
||||
else notify(WARN)<<"Error: glGetBufferPointerv not supported by OpenGL driver"<<std::endl;
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BufferObject
|
||||
//
|
||||
BufferObject::BufferObject():
|
||||
_target(0),
|
||||
_usage(0)
|
||||
{
|
||||
}
|
||||
|
||||
BufferObject::BufferObject(const BufferObject& bo,const CopyOp& copyop):
|
||||
Object(bo,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
BufferObject::~BufferObject()
|
||||
{
|
||||
releaseGLObjects(0);
|
||||
}
|
||||
|
||||
void BufferObject::setBufferData(unsigned int index, BufferData* bd)
|
||||
{
|
||||
if (index>=_bufferDataList.size()) _bufferDataList.resize(index+1);
|
||||
_bufferDataList[index] = bd;
|
||||
}
|
||||
|
||||
void BufferObject::dirty()
|
||||
{
|
||||
for(unsigned int i=0; i<_glBufferObjects.size(); ++i)
|
||||
{
|
||||
if (_glBufferObjects[i].valid()) _glBufferObjects[i]->dirty();
|
||||
}
|
||||
}
|
||||
|
||||
void BufferObject::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
_glBufferObjects.resize(maxSize);
|
||||
}
|
||||
|
||||
void BufferObject::releaseGLObjects(State* state) const
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
_glBufferObjects[state->getContextID()] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
_glBufferObjects.clear();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int BufferObject::addBufferData(BufferData* bd)
|
||||
{
|
||||
if (!bd) return 0;
|
||||
|
||||
// check to see if bd exists in BufferObject already, is so return without doing anything
|
||||
for(BufferDataList::iterator itr = _bufferDataList.begin();
|
||||
itr != _bufferDataList.end();
|
||||
++itr)
|
||||
{
|
||||
if (*itr == bd) return bd->getBufferIndex();
|
||||
}
|
||||
|
||||
// bd->setBufferIndex(_bufferDataList.size());
|
||||
|
||||
_bufferDataList.push_back(bd);
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"BufferObject "<<this<<":"<<className()<<"::addBufferData("<<bd<<"), bufferIndex= "<<_bufferDataList.size()-1<<std::endl;
|
||||
|
||||
return _bufferDataList.size()-1;
|
||||
}
|
||||
|
||||
void BufferObject::removeBufferData(unsigned int index)
|
||||
{
|
||||
if (index>=_bufferDataList.size())
|
||||
{
|
||||
osg::notify(osg::WARN)<<"Error "<<className()<<"::removeBufferData("<<index<<") out of range."<<std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"BufferObject::"<<this<<":"<<className()<<"::removeBufferData("<<index<<"), size= "<<_bufferDataList.size()<<std::endl;
|
||||
|
||||
// alter the indices of the BufferData after the entry to be removed so their indices are correctly placed.
|
||||
for(unsigned int i=index+1; i<_bufferDataList.size(); ++i)
|
||||
{
|
||||
_bufferDataList[i]->setBufferIndex(i-1);
|
||||
}
|
||||
|
||||
// remove the entry
|
||||
_bufferDataList.erase(_bufferDataList.begin() + index);
|
||||
|
||||
for(unsigned int i=0; i<_glBufferObjects.size(); ++i)
|
||||
{
|
||||
if (_glBufferObjects[i].valid()) _glBufferObjects[i]->clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BufferObject::removeBufferData(BufferData* bd)
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"BufferObject::"<<this<<":"<<className()<<"::removeBufferData("<<bd<<"), index="<<bd->getBufferIndex()<<" size= "<<_bufferDataList.size()<<std::endl;
|
||||
|
||||
if (!bd || bd->getBufferObject()!=this) return;
|
||||
|
||||
removeBufferData(bd->getBufferIndex());
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BufferData
|
||||
//
|
||||
BufferData::~BufferData()
|
||||
{
|
||||
setBufferObject(0);
|
||||
}
|
||||
|
||||
void BufferData::setBufferObject(BufferObject* bufferObject)
|
||||
{
|
||||
if (_bufferObject==bufferObject) return;
|
||||
|
||||
if (_bufferObject.valid())
|
||||
{
|
||||
_bufferObject->removeBufferData(_bufferIndex);
|
||||
}
|
||||
|
||||
_bufferObject = bufferObject;
|
||||
_bufferIndex = _bufferObject.valid() ? _bufferObject->addBufferData(this) : 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// VertexBufferObject
|
||||
@ -311,40 +573,29 @@ VertexBufferObject::~VertexBufferObject()
|
||||
|
||||
unsigned int VertexBufferObject::addArray(osg::Array* array)
|
||||
{
|
||||
unsigned int i = _bufferEntryArrayPairs.size();
|
||||
|
||||
_bufferEntryArrayPairs.resize(i+1);
|
||||
_bufferEntryArrayPairs[i].second = array;
|
||||
_bufferEntryArrayPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
|
||||
_bufferEntryArrayPairs[i].first.offset = 0;
|
||||
|
||||
dirty();
|
||||
|
||||
return i;
|
||||
return addBufferData(array);
|
||||
}
|
||||
|
||||
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);
|
||||
removeBufferData(array);
|
||||
}
|
||||
|
||||
void VertexBufferObject::setArray(unsigned int i, Array* array)
|
||||
{
|
||||
if (i+1>=_bufferEntryArrayPairs.size()) _bufferEntryArrayPairs.resize(i+1);
|
||||
|
||||
_bufferEntryArrayPairs[i].second = array;
|
||||
_bufferEntryArrayPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
|
||||
_bufferEntryArrayPairs[i].first.offset = 0;
|
||||
|
||||
dirty();
|
||||
setBufferData(i,array);
|
||||
}
|
||||
|
||||
Array* VertexBufferObject::getArray(unsigned int i)
|
||||
{
|
||||
return dynamic_cast<osg::Array*>(getBufferData(i));
|
||||
}
|
||||
|
||||
const Array* VertexBufferObject::getArray(unsigned int i) const
|
||||
{
|
||||
return dynamic_cast<const osg::Array*>(getBufferData(i));
|
||||
}
|
||||
#if 0
|
||||
void VertexBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
@ -514,18 +765,7 @@ void VertexBufferObject::compileBuffer(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 VertexBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
BufferObject::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
for(BufferEntryArrayPairs::iterator itr = _bufferEntryArrayPairs.begin();
|
||||
itr != _bufferEntryArrayPairs.end();
|
||||
++itr)
|
||||
{
|
||||
itr->first.modifiedCount.resize(maxSize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -548,36 +788,31 @@ ElementBufferObject::~ElementBufferObject()
|
||||
|
||||
unsigned int ElementBufferObject::addDrawElements(osg::DrawElements* drawElements)
|
||||
{
|
||||
unsigned int i = _bufferEntryDrawElementsPairs.size();
|
||||
_bufferEntryDrawElementsPairs.resize(i+1);
|
||||
_bufferEntryDrawElementsPairs[i].second = drawElements;
|
||||
_bufferEntryDrawElementsPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
|
||||
_bufferEntryDrawElementsPairs[i].first.dataSize = 0;
|
||||
|
||||
return i;
|
||||
return addBufferData(drawElements);
|
||||
}
|
||||
|
||||
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);
|
||||
removeBufferData(drawElements);
|
||||
}
|
||||
|
||||
void ElementBufferObject::setDrawElements(unsigned int i, DrawElements* drawElements)
|
||||
{
|
||||
if (i+1>=_bufferEntryDrawElementsPairs.size()) _bufferEntryDrawElementsPairs.resize(i+1);
|
||||
|
||||
_bufferEntryDrawElementsPairs[i].second = drawElements;
|
||||
_bufferEntryDrawElementsPairs[i].first.modifiedCount.setAllElementsTo(0xffffffff);
|
||||
_bufferEntryDrawElementsPairs[i].first.dataSize = 0;
|
||||
setBufferData(i,drawElements);
|
||||
}
|
||||
|
||||
DrawElements* ElementBufferObject::getDrawElements(unsigned int i)
|
||||
{
|
||||
return dynamic_cast<DrawElements*>(getBufferData(i));
|
||||
}
|
||||
|
||||
const DrawElements* ElementBufferObject::getDrawElements(unsigned int i) const
|
||||
{
|
||||
return dynamic_cast<const DrawElements*>(getBufferData(i));
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
void ElementBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
@ -681,18 +916,7 @@ void ElementBufferObject::compileBuffer(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 ElementBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
{
|
||||
BufferObject::resizeGLObjectBuffers(maxSize);
|
||||
|
||||
for(BufferEntryDrawElementsPairs::iterator itr = _bufferEntryDrawElementsPairs.begin();
|
||||
itr != _bufferEntryDrawElementsPairs.end();
|
||||
++itr)
|
||||
{
|
||||
itr->first.modifiedCount.resize(maxSize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -703,13 +927,14 @@ PixelBufferObject::PixelBufferObject(osg::Image* image):
|
||||
{
|
||||
_target = GL_PIXEL_UNPACK_BUFFER_ARB;
|
||||
_usage = GL_STREAM_DRAW_ARB;
|
||||
_bufferEntryImagePair.second = image;
|
||||
|
||||
osg::notify(osg::NOTICE)<<"Constructing PixelBufferObject for image="<<image<<std::endl;
|
||||
|
||||
setBufferData(0, image);
|
||||
}
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
PixelBufferObject::PixelBufferObject(const PixelBufferObject& buffer,const CopyOp& copyop):
|
||||
BufferObject(buffer,copyop),
|
||||
_bufferEntryImagePair(buffer._bufferEntryImagePair)
|
||||
BufferObject(buffer,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
@ -719,12 +944,20 @@ PixelBufferObject::~PixelBufferObject()
|
||||
|
||||
void PixelBufferObject::setImage(osg::Image* image)
|
||||
{
|
||||
if (_bufferEntryImagePair.second == image) return;
|
||||
|
||||
_bufferEntryImagePair.second = image;
|
||||
|
||||
dirty();
|
||||
setBufferData(0, image);
|
||||
}
|
||||
|
||||
Image* PixelBufferObject::getImage()
|
||||
{
|
||||
return dynamic_cast<Image*>(getBufferData(0));
|
||||
}
|
||||
|
||||
const Image* PixelBufferObject::getImage() const
|
||||
{
|
||||
return dynamic_cast<const Image*>(getBufferData(0));
|
||||
}
|
||||
|
||||
#if 0
|
||||
void PixelBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
@ -781,14 +1014,7 @@ void PixelBufferObject::compileBuffer(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);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@ -799,13 +1025,11 @@ PixelDataBufferObject::PixelDataBufferObject()
|
||||
{
|
||||
_target = GL_ARRAY_BUFFER_ARB;
|
||||
_usage = GL_DYNAMIC_DRAW_ARB;
|
||||
_bufferData.dataSize = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
PixelDataBufferObject::PixelDataBufferObject(const PixelDataBufferObject& buffer,const CopyOp& copyop):
|
||||
BufferObject(buffer,copyop),
|
||||
_bufferData(buffer._bufferData)
|
||||
BufferObject(buffer,copyop)
|
||||
{
|
||||
}
|
||||
|
||||
@ -818,32 +1042,28 @@ PixelDataBufferObject::~PixelDataBufferObject()
|
||||
void PixelDataBufferObject::compileBuffer(State& state) const
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
if (!isDirty(contextID) || _bufferData.dataSize == 0) return;
|
||||
if ( _dataSize == 0) return;
|
||||
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
|
||||
if (!bo || !bo->isDirty()) return;
|
||||
|
||||
GLuint& pbo = buffer(contextID);
|
||||
if (pbo == 0)
|
||||
{
|
||||
extensions->glGenBuffers(1, &pbo);
|
||||
}
|
||||
|
||||
extensions->glBindBuffer(_target, pbo);
|
||||
extensions->glBufferData(_target, _bufferData.dataSize, NULL, _usage);
|
||||
extensions->glBindBuffer(_target, 0);
|
||||
|
||||
_compiledList[contextID] = 1;
|
||||
bo->_extensions->glBindBuffer(_target, bo->getGLObjectID());
|
||||
bo->_extensions->glBufferData(_target, _dataSize, NULL, _usage);
|
||||
bo->_extensions->glBindBuffer(_target, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
void PixelDataBufferObject::bindBufferInReadMode(State& state)
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
if (isDirty(contextID)) compileBuffer(state);
|
||||
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
|
||||
if (!bo) return;
|
||||
|
||||
if (bo->isDirty()) compileBuffer(state);
|
||||
|
||||
bo->_extensions->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, bo->getGLObjectID());
|
||||
|
||||
extensions->glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, buffer(contextID));
|
||||
_mode[contextID] = READ;
|
||||
}
|
||||
|
||||
@ -851,18 +1071,21 @@ void PixelDataBufferObject::bindBufferInReadMode(State& state)
|
||||
void PixelDataBufferObject::bindBufferInWriteMode(State& state)
|
||||
{
|
||||
unsigned int contextID = state.getContextID();
|
||||
if (isDirty(contextID)) compileBuffer(state);
|
||||
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
GLBufferObject* bo = getOrCreateGLBufferObject(contextID);
|
||||
if (!bo) return;
|
||||
|
||||
if (bo->isDirty()) compileBuffer(state);
|
||||
|
||||
bo->_extensions->glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, bo->getGLObjectID());
|
||||
|
||||
extensions->glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB, buffer(contextID));
|
||||
_mode[contextID] = WRITE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
void PixelDataBufferObject::unbindBuffer(unsigned int contextID) const
|
||||
{
|
||||
Extensions* extensions = getExtensions(contextID,true);
|
||||
GLBufferObject::Extensions* extensions = GLBufferObject::getExtensions(contextID,true);
|
||||
|
||||
switch(_mode[contextID])
|
||||
{
|
||||
@ -888,3 +1111,5 @@ void PixelDataBufferObject::resizeGLObjectBuffers(unsigned int maxSize)
|
||||
_mode.resize(maxSize);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -23,7 +23,7 @@
|
||||
|
||||
void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime)
|
||||
{
|
||||
osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::Drawable::flushDeletedDisplayLists(contextID,availableTime);
|
||||
osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
|
||||
@ -39,7 +39,7 @@ void osg::flushAllDeletedGLObjects(unsigned int contextID)
|
||||
{
|
||||
double currentTime = DBL_MAX;
|
||||
double availableTime = DBL_MAX;
|
||||
osg::BufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
|
||||
osg::Drawable::flushAllDeletedDisplayLists(contextID);
|
||||
osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
|
||||
osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
|
||||
@ -53,7 +53,7 @@ void osg::flushAllDeletedGLObjects(unsigned int contextID)
|
||||
|
||||
void osg::discardAllDeletedGLObjects(unsigned int contextID)
|
||||
{
|
||||
osg::BufferObject::discardDeletedBufferObjects(contextID);
|
||||
osg::GLBufferObject::discardDeletedBufferObjects(contextID);
|
||||
osg::Drawable::discardAllDeletedDisplayLists(contextID);
|
||||
osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID);
|
||||
osg::FrameBufferObject::discardDeletedFrameBufferObjects(contextID);
|
||||
|
@ -1374,6 +1374,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
|
||||
//
|
||||
if (usingVertexBufferObjects)
|
||||
{
|
||||
// osg::notify(osg::NOTICE)<<"Geometry::drawImplementation() Using VertexBufferObjects"<<std::endl;
|
||||
|
||||
//
|
||||
// Vertex Buffer Object path for defining vertex arrays.
|
||||
@ -1416,7 +1417,6 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
|
||||
}
|
||||
}
|
||||
state.disableVertexAttribPointersAboveAndIncluding( index );
|
||||
|
||||
}
|
||||
else if (vertexVertexAttributesSupported)
|
||||
{
|
||||
@ -1429,7 +1429,7 @@ void Geometry::drawImplementation(RenderInfo& renderInfo) const
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cout << "none VertexBuffer path"<<std::endl;
|
||||
// osg::notify(osg::NOTICE)<<"none VertexBuffer path"<<std::endl;
|
||||
|
||||
//
|
||||
// Non Vertex Buffer Object path for defining vertex arrays.
|
||||
|
@ -33,7 +33,7 @@ using namespace osg;
|
||||
using namespace std;
|
||||
|
||||
Image::Image()
|
||||
:Object(true),
|
||||
:BufferData(),
|
||||
_fileName(""),
|
||||
_writeHint(NO_PREFERENCE),
|
||||
_origin(BOTTOM_LEFT),
|
||||
@ -44,14 +44,13 @@ Image::Image()
|
||||
_packing(4),
|
||||
_pixelAspectRatio(1.0),
|
||||
_allocationMode(USE_NEW_DELETE),
|
||||
_data(0L),
|
||||
_modifiedCount(0)
|
||||
_data(0L)
|
||||
{
|
||||
setDataVariance(STATIC);
|
||||
}
|
||||
|
||||
Image::Image(const Image& image,const CopyOp& copyop):
|
||||
Object(image,copyop),
|
||||
BufferData(image,copyop),
|
||||
_fileName(image._fileName),
|
||||
_writeHint(image._writeHint),
|
||||
_origin(image._origin),
|
||||
@ -62,7 +61,6 @@ Image::Image(const Image& image,const CopyOp& copyop):
|
||||
_packing(image._packing),
|
||||
_pixelAspectRatio(image._pixelAspectRatio),
|
||||
_data(0L),
|
||||
_modifiedCount(image._modifiedCount),
|
||||
_mipmapData(image._mipmapData)
|
||||
{
|
||||
if (image._data)
|
||||
|
@ -126,12 +126,12 @@ void DrawElementsUByte::draw(State& state, bool useVertexBufferObjects) const
|
||||
{
|
||||
if (useVertexBufferObjects)
|
||||
{
|
||||
const ElementBufferObject* ebo = getElementBufferObject();
|
||||
GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
|
||||
state.bindElementBufferObject(ebo);
|
||||
if (ebo)
|
||||
{
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset(), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, getElementBufferObjectOffset());
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_BYTE, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -176,12 +176,12 @@ void DrawElementsUShort::draw(State& state, bool useVertexBufferObjects) const
|
||||
{
|
||||
if (useVertexBufferObjects)
|
||||
{
|
||||
const ElementBufferObject* ebo = getElementBufferObject();
|
||||
GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
|
||||
state.bindElementBufferObject(ebo);
|
||||
if (ebo)
|
||||
{
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset(), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, getElementBufferObjectOffset());
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_SHORT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -226,12 +226,12 @@ void DrawElementsUInt::draw(State& state, bool useVertexBufferObjects) const
|
||||
{
|
||||
if (useVertexBufferObjects)
|
||||
{
|
||||
const ElementBufferObject* ebo = getElementBufferObject();
|
||||
GLBufferObject* ebo = getOrCreateGLBufferObject(state.getContextID());
|
||||
state.bindElementBufferObject(ebo);
|
||||
if (ebo)
|
||||
{
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset(), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_INT, getElementBufferObjectOffset());
|
||||
if (_numInstances>=1) state.glDrawElementsInstanced(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())), _numInstances);
|
||||
else glDrawElements(_mode, size(), GL_UNSIGNED_INT, (const GLvoid *)(ebo->getOffset(getBufferIndex())));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1777,15 +1777,12 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
bool useHardwareMipMapGeneration = mipmappingRequired && (!image->isMipmap() && isHardwareMipmapGenerationEnabled(state));
|
||||
bool useGluBuildMipMaps = mipmappingRequired && (!useHardwareMipMapGeneration && !image->isMipmap());
|
||||
|
||||
unsigned char* dataMinusOffset = 0;
|
||||
unsigned char* dataPlusOffset = 0;
|
||||
|
||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale && !useGluBuildMipMaps)
|
||||
const unsigned char* dataPtr = image->data();
|
||||
GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
|
||||
if (pbo && !needImageRescale && !useGluBuildMipMaps)
|
||||
{
|
||||
state.bindPixelBufferObject(pbo);
|
||||
dataMinusOffset = data;
|
||||
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||
dataPtr = reinterpret_cast<const unsigned char*>(pbo->getOffset(image->getBufferIndex()));
|
||||
#ifdef DO_TIMING
|
||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||
#endif
|
||||
@ -1808,7 +1805,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
inwidth, inheight, _borderWidth,
|
||||
(GLenum)image->getPixelFormat(),
|
||||
(GLenum)image->getDataType(),
|
||||
data -dataMinusOffset+dataPlusOffset);
|
||||
dataPtr);
|
||||
|
||||
}
|
||||
else if (extensions->isCompressedTexImage2DSupported())
|
||||
@ -1821,7 +1818,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
extensions->glCompressedTexImage2D(target, 0, _internalFormat,
|
||||
inwidth, inheight,0,
|
||||
size,
|
||||
data-dataMinusOffset+dataPlusOffset);
|
||||
dataPtr);
|
||||
}
|
||||
|
||||
mipmapAfterTexImage(state, mipmapResult);
|
||||
@ -1853,7 +1850,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
width, height, _borderWidth,
|
||||
(GLenum)image->getPixelFormat(),
|
||||
(GLenum)image->getDataType(),
|
||||
image->getMipmapData(k)-dataMinusOffset+dataPlusOffset);
|
||||
dataPtr + image->getMipmapOffset(k));
|
||||
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
@ -1874,7 +1871,7 @@ void Texture::applyTexImage2D_load(State& state, GLenum target, const Image* ima
|
||||
|
||||
extensions->glCompressedTexImage2D(target, k, _internalFormat,
|
||||
width, height, _borderWidth,
|
||||
size, image->getMipmapData(k)-dataMinusOffset+dataPlusOffset);
|
||||
size, dataPtr + image->getMipmapOffset(k));
|
||||
|
||||
width >>= 1;
|
||||
height >>= 1;
|
||||
@ -2027,12 +2024,12 @@ void Texture::applyTexImage2D_subload(State& state, GLenum target, const Image*
|
||||
unsigned char* dataMinusOffset = 0;
|
||||
unsigned char* dataPlusOffset = 0;
|
||||
|
||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||
if (pbo && pbo->isPBOSupported(contextID) && !needImageRescale && !useGluBuildMipMaps)
|
||||
const unsigned char* dataPtr = image->data();
|
||||
GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
|
||||
if (pbo && !needImageRescale && !useGluBuildMipMaps)
|
||||
{
|
||||
state.bindPixelBufferObject(pbo);
|
||||
dataMinusOffset = data;
|
||||
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||
dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
|
||||
#ifdef DO_TIMING
|
||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||
#endif
|
||||
|
@ -290,19 +290,12 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned char* dataMinusOffset = 0;
|
||||
unsigned char* dataPlusOffset = 0;
|
||||
|
||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||
if (pbo && pbo->isPBOSupported(contextID))
|
||||
const unsigned char* dataPtr = image->data();
|
||||
GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
|
||||
if (pbo)
|
||||
{
|
||||
state.bindPixelBufferObject(pbo);
|
||||
dataMinusOffset = image->data();
|
||||
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset());
|
||||
}
|
||||
else
|
||||
{
|
||||
pbo = 0;
|
||||
dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
|
||||
}
|
||||
|
||||
if(isCompressedInternalFormat(_internalFormat) && extensions->isCompressedTexImage2DSupported())
|
||||
@ -310,7 +303,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
||||
extensions->glCompressedTexImage2D(target, 0, _internalFormat,
|
||||
image->s(), image->t(), 0,
|
||||
image->getImageSizeInBytes(),
|
||||
image->data() - dataMinusOffset + dataPlusOffset);
|
||||
dataPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -318,7 +311,7 @@ void TextureRectangle::applyTexImage_load(GLenum target, Image* image, State& st
|
||||
image->s(), image->t(), 0,
|
||||
(GLenum)image->getPixelFormat(),
|
||||
(GLenum)image->getDataType(),
|
||||
image->data() - dataMinusOffset + dataPlusOffset );
|
||||
dataPtr );
|
||||
}
|
||||
|
||||
|
||||
@ -365,26 +358,21 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
||||
|
||||
#ifdef DO_TIMING
|
||||
osg::Timer_t start_tick = osg::Timer::instance()->tick();
|
||||
osg::notify(osg::NOTICE)<<"glTexSubImage2D pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
|
||||
osg::notify(osg::NOTICE)<<"TextureRectangle::apply pixelFormat = "<<std::hex<<image->getPixelFormat()<<std::dec<<std::endl;
|
||||
#endif
|
||||
unsigned char* dataMinusOffset = 0;
|
||||
unsigned char* dataPlusOffset = 0;
|
||||
|
||||
const PixelBufferObject* pbo = image->getPixelBufferObject();
|
||||
if (pbo && pbo->isPBOSupported(contextID))
|
||||
const unsigned char* dataPtr = image->data();
|
||||
GLBufferObject* pbo = image->getOrCreateGLBufferObject(contextID);
|
||||
if (pbo)
|
||||
{
|
||||
state.bindPixelBufferObject(pbo);
|
||||
dataMinusOffset = image->data();
|
||||
dataPlusOffset = reinterpret_cast<unsigned char*>(pbo->offset()); // -dataMinusOffset+dataPlusOffset
|
||||
|
||||
dataPtr = reinterpret_cast<unsigned char*>(pbo->getOffset(image->getBufferIndex()));
|
||||
#ifdef DO_TIMING
|
||||
osg::notify(osg::NOTICE)<<"after PBO "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
pbo = 0;
|
||||
osg::notify(osg::NOTICE)<<" no PixelBufferObject "<<image->getBufferObject()<<", "<<image->getPixelBufferObject()<<" pbo="<<pbo<<std::endl;
|
||||
}
|
||||
|
||||
|
||||
@ -395,7 +383,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
||||
image->s(), image->t(),
|
||||
(GLenum)image->getPixelFormat(),
|
||||
(GLenum)image->getDataType(),
|
||||
image->data() - dataMinusOffset + dataPlusOffset);
|
||||
dataPtr);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -404,7 +392,7 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
||||
image->s(), image->t(),
|
||||
(GLenum)image->getPixelFormat(),
|
||||
(GLenum)image->getDataType(),
|
||||
image->data() - dataMinusOffset + dataPlusOffset );
|
||||
dataPtr);
|
||||
}
|
||||
|
||||
if (pbo)
|
||||
@ -415,7 +403,6 @@ void TextureRectangle::applyTexImage_subload(GLenum target, Image* image, State&
|
||||
#ifdef DO_TIMING
|
||||
osg::notify(osg::NOTICE)<<"glTexSubImage2D "<<osg::Timer::instance()->delta_m(start_tick,osg::Timer::instance()->tick())<<"ms"<<std::endl;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void TextureRectangle::computeInternalFormat() const
|
||||
|
@ -33,7 +33,7 @@ void DrawElementsUByte::write(DataOutputStream* out){
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * CHARSIZE);
|
||||
if (size()!=0) out->writeCharArray((const char*)&front(), size() * CHARSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUByte::read(DataInputStream* in){
|
||||
@ -53,7 +53,7 @@ void DrawElementsUByte::read(DataInputStream* in){
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
resize(size);
|
||||
in->readCharArray((char*)&front(), size * CHARSIZE);
|
||||
if (size!=0) in->readCharArray((char*)&front(), size * CHARSIZE);
|
||||
|
||||
}
|
||||
else{
|
||||
|
@ -34,7 +34,7 @@ void DrawElementsUInt::write(DataOutputStream* out){
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * INTSIZE);
|
||||
if (size()!=0) out->writeCharArray((const char*)&front(), size() * INTSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUInt::read(DataInputStream* in)
|
||||
@ -55,7 +55,7 @@ void DrawElementsUInt::read(DataInputStream* in)
|
||||
// Read array length and its elements.
|
||||
int size = in->readInt();
|
||||
resize(size);
|
||||
in->readCharArray((char*)&front(), size * INTSIZE);
|
||||
if (size!=0) in->readCharArray((char*)&front(), size * INTSIZE);
|
||||
|
||||
if (in->_byteswap)
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ void DrawElementsUShort::write(DataOutputStream* out){
|
||||
|
||||
// Write array length and its elements.
|
||||
out->writeInt(size());
|
||||
out->writeCharArray((const char*)&front(), size() * SHORTSIZE);
|
||||
if (size()!=0) out->writeCharArray((const char*)&front(), size() * SHORTSIZE);
|
||||
}
|
||||
|
||||
void DrawElementsUShort::read(DataInputStream* in){
|
||||
|
@ -73,8 +73,8 @@ class WindowCaptureCallback : public osg::Camera::DrawCallback
|
||||
|
||||
void read();
|
||||
void readPixels();
|
||||
void singlePBO(osg::BufferObject::Extensions* ext);
|
||||
void multiPBO(osg::BufferObject::Extensions* ext);
|
||||
void singlePBO(osg::GLBufferObject::Extensions* ext);
|
||||
void multiPBO(osg::GLBufferObject::Extensions* ext);
|
||||
|
||||
typedef std::vector< osg::ref_ptr<osg::Image> > ImageBuffer;
|
||||
typedef std::vector< GLuint > PBOBuffer;
|
||||
@ -220,7 +220,7 @@ void WindowCaptureCallback::ContextData::updateTimings(osg::Timer_t tick_start,
|
||||
|
||||
void WindowCaptureCallback::ContextData::read()
|
||||
{
|
||||
osg::BufferObject::Extensions* ext = osg::BufferObject::getExtensions(_gc->getState()->getContextID(),true);
|
||||
osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions(_gc->getState()->getContextID(),true);
|
||||
|
||||
if (ext->isPBOSupported() && !_pboBuffer.empty())
|
||||
{
|
||||
@ -277,7 +277,7 @@ void WindowCaptureCallback::ContextData::readPixels()
|
||||
_currentPboIndex = nextPboIndex;
|
||||
}
|
||||
|
||||
void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions* ext)
|
||||
void WindowCaptureCallback::ContextData::singlePBO(osg::GLBufferObject::Extensions* ext)
|
||||
{
|
||||
unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();
|
||||
|
||||
@ -352,7 +352,7 @@ void WindowCaptureCallback::ContextData::singlePBO(osg::BufferObject::Extensions
|
||||
_currentImageIndex = nextImageIndex;
|
||||
}
|
||||
|
||||
void WindowCaptureCallback::ContextData::multiPBO(osg::BufferObject::Extensions* ext)
|
||||
void WindowCaptureCallback::ContextData::multiPBO(osg::GLBufferObject::Extensions* ext)
|
||||
{
|
||||
unsigned int nextImageIndex = (_currentImageIndex+1)%_imageBuffer.size();
|
||||
unsigned int nextPboIndex = (_currentPboIndex+1)%_pboBuffer.size();
|
||||
|
@ -445,7 +445,7 @@ suppress reflector "osg::StencilTwoSided::Extensions"
|
||||
suppress reflector "osg::Texture3D::Extensions"
|
||||
suppress reflector "osg::GL2Extensions"
|
||||
suppress reflector "osg::Drawable::Extensions"
|
||||
suppress reflector "osg::BufferObject::Extensions"
|
||||
suppress reflector "osg::GLBufferObject::Extensions"
|
||||
suppress reflector "osg::FBOExtensions"
|
||||
suppress reflector "osg::Drawable::Extensions"
|
||||
suppress reflector "osg::BlendColor::Extensions"
|
||||
|
@ -64,7 +64,7 @@ END_REFLECTOR
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
I_DeclaringFile("osg/Array");
|
||||
I_BaseType(osg::Object);
|
||||
I_BaseType(osg::BufferData);
|
||||
I_ConstructorWithDefaults3(IN, osg::Array::Type, arrayType, osg::Array::ArrayType, IN, GLint, dataSize, 0, IN, GLenum, dataType, 0,
|
||||
____Array__Type__GLint__GLenum,
|
||||
"",
|
||||
@ -148,21 +148,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
__void__trim,
|
||||
"Frees unused space on this vector - i.e. ",
|
||||
"the difference between size() and max_size() of the underlying vector. ");
|
||||
I_Method0(void, dirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__dirty,
|
||||
"Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
|
||||
"");
|
||||
I_Method1(void, setModifiedCount, IN, unsigned int, value,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setModifiedCount__unsigned_int,
|
||||
"Set the modified count value. ",
|
||||
"");
|
||||
I_Method0(unsigned int, getModifiedCount,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getModifiedCount,
|
||||
"Get modified count value. ",
|
||||
"");
|
||||
I_Method1(void, setVertexBufferObject, IN, osg::VertexBufferObject *, vbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setVertexBufferObject__osg_VertexBufferObject_P1,
|
||||
@ -178,16 +163,6 @@ 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, setVertexBufferObjectOffset, IN, const GLvoid *, offset,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setVertexBufferObjectOffset__C5_GLvoid_P1,
|
||||
"Set the offset into the VertexBufferObject, if used. ",
|
||||
"");
|
||||
I_Method0(const GLvoid *, getVertexBufferObjectOffset,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_GLvoid_P1__getVertexBufferObjectOffset,
|
||||
"Get the offset into the VertexBufferObject, if used. ",
|
||||
"");
|
||||
I_SimpleProperty(const GLvoid *, DataPointer,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
0);
|
||||
@ -197,9 +172,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
I_SimpleProperty(GLenum, DataType,
|
||||
__GLenum__getDataType,
|
||||
0);
|
||||
I_SimpleProperty(unsigned int, ModifiedCount,
|
||||
__unsigned_int__getModifiedCount,
|
||||
__void__setModifiedCount__unsigned_int);
|
||||
I_SimpleProperty(unsigned int, TotalDataSize,
|
||||
__unsigned_int__getTotalDataSize,
|
||||
0);
|
||||
@ -209,9 +181,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::Array)
|
||||
I_SimpleProperty(osg::VertexBufferObject *, VertexBufferObject,
|
||||
__osg_VertexBufferObject_P1__getVertexBufferObject,
|
||||
__void__setVertexBufferObject__osg_VertexBufferObject_P1);
|
||||
I_SimpleProperty(const GLvoid *, VertexBufferObjectOffset,
|
||||
__C5_GLvoid_P1__getVertexBufferObjectOffset,
|
||||
__void__setVertexBufferObjectOffset__C5_GLvoid_P1);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::ArrayVisitor)
|
||||
|
@ -26,6 +26,108 @@
|
||||
#undef OUT
|
||||
#endif
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferData)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_BaseType(osg::Object);
|
||||
I_Constructor0(____BufferData,
|
||||
"",
|
||||
"");
|
||||
I_ConstructorWithDefaults2(IN, const osg::BufferData &, bd, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
|
||||
____BufferData__C5_BufferData_R1__C5_CopyOp_R1,
|
||||
"Copy constructor using CopyOp to manage deep vs shallow copy. ",
|
||||
"");
|
||||
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
|
||||
Properties::VIRTUAL,
|
||||
__bool__isSameKindAs__C5_Object_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const char *, libraryName,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__libraryName,
|
||||
"return the name of the object's library. ",
|
||||
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
|
||||
I_Method0(const char *, className,
|
||||
Properties::VIRTUAL,
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method0(const GLvoid *, getDataPointer,
|
||||
Properties::PURE_VIRTUAL,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getTotalDataSize,
|
||||
Properties::PURE_VIRTUAL,
|
||||
__unsigned_int__getTotalDataSize,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setBufferObject, IN, osg::BufferObject *, bufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setBufferObject__BufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::BufferObject *, getBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__BufferObject_P1__getBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::BufferObject *, getBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_BufferObject_P1__getBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setBufferIndex, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setBufferIndex__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getBufferIndex,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getBufferIndex,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::GLBufferObject *, getGLBufferObject, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLBufferObject_P1__getGLBufferObject__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::GLBufferObject *, getOrCreateGLBufferObject, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLBufferObject_P1__getOrCreateGLBufferObject__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__dirty,
|
||||
"Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
|
||||
"");
|
||||
I_Method1(void, setModifiedCount, IN, unsigned int, value,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setModifiedCount__unsigned_int,
|
||||
"Set the modified count value. ",
|
||||
"");
|
||||
I_Method0(unsigned int, getModifiedCount,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getModifiedCount,
|
||||
"Get modified count value. ",
|
||||
"");
|
||||
I_SimpleProperty(unsigned int, BufferIndex,
|
||||
__unsigned_int__getBufferIndex,
|
||||
__void__setBufferIndex__unsigned_int);
|
||||
I_SimpleProperty(osg::BufferObject *, BufferObject,
|
||||
__BufferObject_P1__getBufferObject,
|
||||
__void__setBufferObject__BufferObject_P1);
|
||||
I_SimpleProperty(const GLvoid *, DataPointer,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
0);
|
||||
I_SimpleProperty(unsigned int, ModifiedCount,
|
||||
__unsigned_int__getModifiedCount,
|
||||
__void__setModifiedCount__unsigned_int);
|
||||
I_SimpleProperty(unsigned int, TotalDataSize,
|
||||
__unsigned_int__getTotalDataSize,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_BaseType(osg::Object);
|
||||
@ -51,6 +153,16 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(void, setTarget, IN, GLenum, target,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setTarget__GLenum,
|
||||
"",
|
||||
"");
|
||||
I_Method0(GLenum, getTarget,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLenum__getTarget,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setUsage, IN, GLenum, usage,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setUsage__GLenum,
|
||||
@ -61,46 +173,11 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
|
||||
__GLenum__getUsage,
|
||||
"Get the type of usage the buffer object has been set up for. ",
|
||||
"");
|
||||
I_Method1(bool, isBufferObjectSupported, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isBufferObjectSupported__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(bool, isPBOSupported, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isPBOSupported__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(GLuint &, buffer, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLuint_R1__buffer__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, bindBuffer, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__bindBuffer__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, unbindBuffer, IN, unsigned int, contextID,
|
||||
Properties::VIRTUAL,
|
||||
__void__unbindBuffer__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__dirty,
|
||||
"",
|
||||
"");
|
||||
I_Method1(bool, isDirty, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isDirty__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::PURE_VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
|
||||
Properties::VIRTUAL,
|
||||
__void__resizeGLObjectBuffers__unsigned_int,
|
||||
@ -111,50 +188,66 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::BufferObject)
|
||||
__void__releaseGLObjects__State_P1,
|
||||
"If State is non-zero, this function releases OpenGL objects for the specified graphics context. ",
|
||||
"Otherwise, releases OpenGL objects 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. ",
|
||||
I_Method1(unsigned int, addBufferData, IN, osg::BufferData *, bd,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__addBufferData__BufferData_P1,
|
||||
"",
|
||||
"");
|
||||
I_StaticMethod3(void, flushDeletedBufferObjects, IN, unsigned int, contextID, IN, double, x, IN, double &, availableTime,
|
||||
__void__flushDeletedBufferObjects__unsigned_int__double__double_R1_S,
|
||||
"flush all the cached display list which need to be deleted in the OpenGL context related to contextID. ",
|
||||
I_Method1(void, removeBufferData, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__removeBufferData__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_StaticMethod1(void, discardDeletedBufferObjects, IN, unsigned int, contextID,
|
||||
__void__discardDeletedBufferObjects__unsigned_int_S,
|
||||
"dicard all the cached display list which need to be deleted in the OpenGL context related to contextID. ",
|
||||
"Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. ");
|
||||
I_StaticMethod2(osg::BufferObject::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized,
|
||||
__Extensions_P1__getExtensions__unsigned_int__bool_S,
|
||||
"Function to call to get the extension of a specified context. ",
|
||||
"If the Extension object for that context has not yet been created and the 'createIfNotInitalized' flag been set to false then returns NULL. If 'createIfNotInitalized' is true then the Extensions object is automatically created. However, in this case the extension object is only created with the graphics context associated with ContextID.. ");
|
||||
I_StaticMethod2(void, setExtensions, IN, unsigned int, contextID, IN, osg::BufferObject::Extensions *, extensions,
|
||||
__void__setExtensions__unsigned_int__Extensions_P1_S,
|
||||
"setExtensions allows users to override the extensions across graphics contexts. ",
|
||||
"typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions. ");
|
||||
I_Method1(void, removeBufferData, IN, osg::BufferData *, bd,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__removeBufferData__BufferData_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method2(void, setBufferData, IN, unsigned int, index, IN, osg::BufferData *, bd,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setBufferData__unsigned_int__BufferData_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::BufferData *, getBufferData, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__BufferData_P1__getBufferData__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(const osg::BufferData *, getBufferData, IN, unsigned int, index,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_BufferData_P1__getBufferData__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getNumBufferData,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getNumBufferData,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::GLBufferObject *, getGLBufferObject, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLBufferObject_P1__getGLBufferObject__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(osg::GLBufferObject *, getOrCreateGLBufferObject, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLBufferObject_P1__getOrCreateGLBufferObject__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_ArrayProperty(osg::BufferData *, BufferData,
|
||||
__BufferData_P1__getBufferData__unsigned_int,
|
||||
__void__setBufferData__unsigned_int__BufferData_P1,
|
||||
__unsigned_int__getNumBufferData,
|
||||
__unsigned_int__addBufferData__BufferData_P1,
|
||||
0,
|
||||
__void__removeBufferData__unsigned_int);
|
||||
I_SimpleProperty(GLenum, Target,
|
||||
__GLenum__getTarget,
|
||||
__void__setTarget__GLenum);
|
||||
I_SimpleProperty(GLenum, Usage,
|
||||
__GLenum__getUsage,
|
||||
__void__setUsage__GLenum);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::BufferObject::BufferEntry)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_Constructor0(____BufferEntry,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, const osg::BufferObject::BufferEntry &, be,
|
||||
Properties::NON_EXPLICIT,
|
||||
____BufferEntry__C5_BufferEntry_R1,
|
||||
"",
|
||||
"");
|
||||
I_PublicMemberProperty(osg::buffered_value< unsigned int >, modifiedCount);
|
||||
I_PublicMemberProperty(unsigned int, dataSize);
|
||||
I_PublicMemberProperty(unsigned int, offset);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::DrawElements * >, osg::ElementBufferObject::BufferEntryDrawElementsPair)
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< osg::ElementBufferObject::BufferEntryDrawElementsPair >, osg::ElementBufferObject::BufferEntryDrawElementsPairs)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_BaseType(osg::BufferObject);
|
||||
@ -215,28 +308,145 @@ BEGIN_OBJECT_REFLECTOR(osg::ElementBufferObject)
|
||||
__C5_DrawElements_P1__getDrawElements__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(const GLvoid *, getOffset, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_GLvoid_P1__getOffset__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
|
||||
Properties::VIRTUAL,
|
||||
__void__resizeGLObjectBuffers__unsigned_int,
|
||||
"Resize any per context GLObject buffers to specified size. ",
|
||||
"");
|
||||
I_IndexedProperty(osg::DrawElements *, DrawElements,
|
||||
__DrawElements_P1__getDrawElements__unsigned_int,
|
||||
__void__setDrawElements__unsigned_int__DrawElements_P1,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::Image * >, osg::PixelBufferObject::BufferEntryImagePair)
|
||||
BEGIN_OBJECT_REFLECTOR(osg::GLBufferObject)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_BaseType(osg::Referenced);
|
||||
I_ConstructorWithDefaults2(IN, unsigned int, contextID, , IN, osg::BufferObject *, bufferObject, 0,
|
||||
____GLBufferObject__unsigned_int__BufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setBufferObject, IN, osg::BufferObject *, bufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setBufferObject__BufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(osg::BufferObject *, getBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__BufferObject_P1__getBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getContextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getContextID,
|
||||
"",
|
||||
"");
|
||||
I_Method0(GLuint &, getGLObjectID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLuint_R1__getGLObjectID,
|
||||
"",
|
||||
"");
|
||||
I_Method0(GLuint, getGLObjectID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLuint__getGLObjectID,
|
||||
"",
|
||||
"");
|
||||
I_Method1(GLsizeiptrARB, getOffset, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__GLsizeiptrARB__getOffset__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, bindBuffer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__bindBuffer,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, unbindBuffer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__unbindBuffer,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, isDirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isDirty,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__dirty,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, clear,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__clear,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, compileBuffer,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__compileBuffer,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, deleteGLObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__deleteGLObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, assign, IN, osg::BufferObject *, bufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__assign__BufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(bool, isPBOSupported,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isPBOSupported,
|
||||
"",
|
||||
"");
|
||||
I_StaticMethod2(osg::GLBufferObject *, createGLBufferObject, IN, unsigned int, contextID, IN, const osg::BufferObject *, bufferObject,
|
||||
__GLBufferObject_P1__createGLBufferObject__unsigned_int__C5_BufferObject_P1_S,
|
||||
"",
|
||||
"");
|
||||
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. ",
|
||||
"");
|
||||
I_StaticMethod3(void, flushDeletedBufferObjects, IN, unsigned int, contextID, IN, double, x, IN, double &, availableTime,
|
||||
__void__flushDeletedBufferObjects__unsigned_int__double__double_R1_S,
|
||||
"flush all the cached display list which need to be deleted in the OpenGL context related to contextID. ",
|
||||
"");
|
||||
I_StaticMethod1(void, discardDeletedBufferObjects, IN, unsigned int, contextID,
|
||||
__void__discardDeletedBufferObjects__unsigned_int_S,
|
||||
"dicard all the cached display list which need to be deleted in the OpenGL context related to contextID. ",
|
||||
"Note, unlike flush no OpenGL calls are made, instead the handles are all removed. this call is useful for when an OpenGL context has been destroyed. ");
|
||||
I_StaticMethod2(osg::GLBufferObject::Extensions *, getExtensions, IN, unsigned int, contextID, IN, bool, createIfNotInitalized,
|
||||
__Extensions_P1__getExtensions__unsigned_int__bool_S,
|
||||
"Function to call to get the extension of a specified context. ",
|
||||
"If the Extension object for that context has not yet been created and the 'createIfNotInitalized' flag been set to false then returns NULL. If 'createIfNotInitalized' is true then the Extensions object is automatically created. However, in this case the extension object is only created with the graphics context associated with ContextID.. ");
|
||||
I_StaticMethod2(void, setExtensions, IN, unsigned int, contextID, IN, osg::GLBufferObject::Extensions *, extensions,
|
||||
__void__setExtensions__unsigned_int__Extensions_P1_S,
|
||||
"setExtensions allows users to override the extensions across graphics contexts. ",
|
||||
"typically used when you have different extensions supported across graphics pipes but need to ensure that they all use the same low common denominator extensions. ");
|
||||
I_SimpleProperty(osg::BufferObject *, BufferObject,
|
||||
__BufferObject_P1__getBufferObject,
|
||||
__void__setBufferObject__BufferObject_P1);
|
||||
I_SimpleProperty(unsigned int, ContextID,
|
||||
__unsigned_int__getContextID,
|
||||
0);
|
||||
I_SimpleProperty(GLuint, GLObjectID,
|
||||
__GLuint__getGLObjectID,
|
||||
0);
|
||||
I_PublicMemberProperty(osg::GLBufferObject::Extensions *, _extensions);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_VALUE_REFLECTOR(osg::GLBufferObject::BufferEntry)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_Constructor0(____BufferEntry,
|
||||
"",
|
||||
"");
|
||||
I_Constructor1(IN, const osg::GLBufferObject::BufferEntry &, rhs,
|
||||
Properties::NON_EXPLICIT,
|
||||
____BufferEntry__C5_BufferEntry_R1,
|
||||
"",
|
||||
"");
|
||||
I_PublicMemberProperty(unsigned int, modifiedCount);
|
||||
I_PublicMemberProperty(GLsizeiptrARB, dataSize);
|
||||
I_PublicMemberProperty(GLsizeiptrARB, offset);
|
||||
I_PublicMemberProperty(osg::BufferData *, dataSource);
|
||||
END_REFLECTOR
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::PixelBufferObject)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
@ -290,21 +500,11 @@ BEGIN_OBJECT_REFLECTOR(osg::PixelBufferObject)
|
||||
__C5_Image_P1__getImage,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, offset,
|
||||
I_Method1(bool, isPBOSupported, IN, unsigned int, contextID,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__offset,
|
||||
__bool__isPBOSupported__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
|
||||
Properties::VIRTUAL,
|
||||
__void__resizeGLObjectBuffers__unsigned_int,
|
||||
"Resize any per context GLObject buffers to specified size. ",
|
||||
"");
|
||||
I_SimpleProperty(osg::Image *, Image,
|
||||
__Image_P1__getImage,
|
||||
__void__setImage__osg_Image_P1);
|
||||
@ -397,10 +597,6 @@ BEGIN_OBJECT_REFLECTOR(osg::PixelDataBufferObject)
|
||||
__void__setDataSize__unsigned_int);
|
||||
END_REFLECTOR
|
||||
|
||||
TYPE_NAME_ALIAS(std::pair< osg::BufferObject::BufferEntry COMMA osg::Array * >, osg::VertexBufferObject::BufferEntryArrayPair)
|
||||
|
||||
TYPE_NAME_ALIAS(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >, osg::VertexBufferObject::BufferEntryArrayPairs)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
|
||||
I_DeclaringFile("osg/BufferObject");
|
||||
I_BaseType(osg::BufferObject);
|
||||
@ -461,34 +657,9 @@ BEGIN_OBJECT_REFLECTOR(osg::VertexBufferObject)
|
||||
__C5_Array_P1__getArray__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(const GLvoid *, getOffset, IN, unsigned int, i,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_GLvoid_P1__getOffset__unsigned_int,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, compileBuffer, IN, osg::State &, state,
|
||||
Properties::VIRTUAL,
|
||||
__void__compileBuffer__State_R1,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, resizeGLObjectBuffers, IN, unsigned int, maxSize,
|
||||
Properties::VIRTUAL,
|
||||
__void__resizeGLObjectBuffers__unsigned_int,
|
||||
"Resize any per context GLObject buffers to specified size. ",
|
||||
"");
|
||||
I_IndexedProperty(osg::Array *, Array,
|
||||
__Array_P1__getArray__unsigned_int,
|
||||
__void__setArray__unsigned_int__Array_P1,
|
||||
0);
|
||||
END_REFLECTOR
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::Array * >)
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::DrawElements * >)
|
||||
|
||||
STD_PAIR_REFLECTOR(std::pair< osg::BufferObject::BufferEntry COMMA osg::Image * >)
|
||||
|
||||
STD_VECTOR_REFLECTOR(std::vector< osg::ElementBufferObject::BufferEntryDrawElementsPair >)
|
||||
|
||||
STD_VECTOR_REFLECTOR(std::vector< osg::VertexBufferObject::BufferEntryArrayPair >)
|
||||
|
||||
|
@ -52,7 +52,7 @@ TYPE_NAME_ALIAS(std::vector< unsigned int >, osg::Image::MipmapDataType)
|
||||
|
||||
BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
I_DeclaringFile("osg/Image");
|
||||
I_BaseType(osg::Object);
|
||||
I_BaseType(osg::BufferData);
|
||||
I_Constructor0(____Image,
|
||||
"",
|
||||
"");
|
||||
@ -85,6 +85,16 @@ BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method0(const GLvoid *, getDataPointer,
|
||||
Properties::VIRTUAL,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
"",
|
||||
"");
|
||||
I_Method0(unsigned int, getTotalDataSize,
|
||||
Properties::VIRTUAL,
|
||||
__unsigned_int__getTotalDataSize,
|
||||
"",
|
||||
"");
|
||||
I_Method1(int, compare, IN, const osg::Image &, rhs,
|
||||
Properties::VIRTUAL,
|
||||
__int__compare__C5_Image_R1,
|
||||
@ -310,21 +320,6 @@ BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
__void__ensureValidSizeForTexturing__GLint,
|
||||
"Ensure image dimensions are a power of two. ",
|
||||
"Mipmapped textures require the image dimensions to be power of two and are within the maxiumum texture size for the host machine. ");
|
||||
I_Method0(void, dirty,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__dirty,
|
||||
"Dirty the image, which increments the modified count, to force osg::Texture to reload the image. ",
|
||||
"");
|
||||
I_Method1(void, setModifiedCount, IN, unsigned int, value,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setModifiedCount__unsigned_int,
|
||||
"Set the modified count value. ",
|
||||
"Used by osg::Texture when using texture subloading. ");
|
||||
I_Method0(unsigned int, getModifiedCount,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getModifiedCount,
|
||||
"Get modified count value. ",
|
||||
"Used by osg::Texture when using texture subloading. ");
|
||||
I_Method0(bool, isMipmap,
|
||||
Properties::NON_VIRTUAL,
|
||||
__bool__isMipmap,
|
||||
@ -447,6 +442,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
I_SimpleProperty(osg::Image::AllocationMode, AllocationMode,
|
||||
__AllocationMode__getAllocationMode,
|
||||
__void__setAllocationMode__AllocationMode);
|
||||
I_SimpleProperty(const GLvoid *, DataPointer,
|
||||
__C5_GLvoid_P1__getDataPointer,
|
||||
0);
|
||||
I_SimpleProperty(GLenum, DataType,
|
||||
__GLenum__getDataType,
|
||||
__void__setDataType__GLenum);
|
||||
@ -465,9 +463,6 @@ BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
I_SimpleProperty(const osg::Image::MipmapDataType &, MipmapLevels,
|
||||
__C5_MipmapDataType_R1__getMipmapLevels,
|
||||
__void__setMipmapLevels__C5_MipmapDataType_R1);
|
||||
I_SimpleProperty(unsigned int, ModifiedCount,
|
||||
__unsigned_int__getModifiedCount,
|
||||
__void__setModifiedCount__unsigned_int);
|
||||
I_SimpleProperty(osg::Image::Origin, Origin,
|
||||
__Origin__getOrigin,
|
||||
__void__setOrigin__Origin);
|
||||
@ -489,6 +484,9 @@ BEGIN_OBJECT_REFLECTOR(osg::Image)
|
||||
I_SimpleProperty(unsigned int, RowSizeInBytes,
|
||||
__unsigned_int__getRowSizeInBytes,
|
||||
0);
|
||||
I_SimpleProperty(unsigned int, TotalDataSize,
|
||||
__unsigned_int__getTotalDataSize,
|
||||
0);
|
||||
I_SimpleProperty(unsigned int, TotalSizeInBytes,
|
||||
__unsigned_int__getTotalSizeInBytes,
|
||||
0);
|
||||
|
@ -157,11 +157,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements)
|
||||
__C5_DrawElements_P1__getDrawElements,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::VIRTUAL,
|
||||
__void__dirty,
|
||||
"Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
|
||||
"");
|
||||
I_Method1(void, setElementBufferObject, IN, osg::ElementBufferObject *, ebo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setElementBufferObject__osg_ElementBufferObject_P1,
|
||||
@ -177,26 +172,6 @@ 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, setElementBufferObjectOffset, IN, const GLvoid *, offset,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setElementBufferObjectOffset__C5_GLvoid_P1,
|
||||
"Set the offset into the ElementBufferObject, if used. ",
|
||||
"");
|
||||
I_Method0(const GLvoid *, getElementBufferObjectOffset,
|
||||
Properties::NON_VIRTUAL,
|
||||
__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 objects for all graphics contexts. ");
|
||||
I_Method1(void, reserveElements, IN, unsigned int, numIndices,
|
||||
Properties::PURE_VIRTUAL,
|
||||
__void__reserveElements__unsigned_int,
|
||||
@ -223,9 +198,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::DrawElements)
|
||||
I_SimpleProperty(osg::ElementBufferObject *, ElementBufferObject,
|
||||
__osg_ElementBufferObject_P1__getElementBufferObject,
|
||||
__void__setElementBufferObject__osg_ElementBufferObject_P1);
|
||||
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)
|
||||
@ -429,7 +401,7 @@ END_REFLECTOR
|
||||
|
||||
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet)
|
||||
I_DeclaringFile("osg/PrimitiveSet");
|
||||
I_BaseType(osg::Object);
|
||||
I_BaseType(osg::BufferData);
|
||||
I_ConstructorWithDefaults3(IN, osg::PrimitiveSet::Type, primType, osg::PrimitiveSet::PrimitiveType, IN, GLenum, mode, 0, IN, int, numInstances, 0,
|
||||
____PrimitiveSet__Type__GLenum__int,
|
||||
"",
|
||||
@ -538,31 +510,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet)
|
||||
__unsigned_int__getNumPrimitives,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, dirty,
|
||||
Properties::VIRTUAL,
|
||||
__void__dirty,
|
||||
"Dirty the primitive, which increments the modified count, to force buffer objects to update. ",
|
||||
"");
|
||||
I_Method1(void, setModifiedCount, IN, unsigned int, value,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setModifiedCount__unsigned_int,
|
||||
"Set the modified count value. ",
|
||||
"");
|
||||
I_Method0(unsigned int, getModifiedCount,
|
||||
Properties::NON_VIRTUAL,
|
||||
__unsigned_int__getModifiedCount,
|
||||
"Get modified count value. ",
|
||||
"");
|
||||
I_Method1(void, resizeGLObjectBuffers, IN, unsigned, int,
|
||||
Properties::VIRTUAL,
|
||||
__void__resizeGLObjectBuffers__unsigned,
|
||||
"Resize any per context GLObject buffers to specified size. ",
|
||||
"");
|
||||
I_MethodWithDefaults1(void, releaseGLObjects, IN, osg::State *, x, 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 objects for all graphics contexts. ");
|
||||
I_Method0(void, computeRange,
|
||||
Properties::VIRTUAL,
|
||||
__void__computeRange,
|
||||
@ -577,9 +524,6 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osg::PrimitiveSet)
|
||||
I_SimpleProperty(GLenum, Mode,
|
||||
__GLenum__getMode,
|
||||
__void__setMode__GLenum);
|
||||
I_SimpleProperty(unsigned int, ModifiedCount,
|
||||
__unsigned_int__getModifiedCount,
|
||||
__void__setModifiedCount__unsigned_int);
|
||||
I_SimpleProperty(int, NumInstances,
|
||||
0,
|
||||
__void__setNumInstances__int);
|
||||
|
@ -331,19 +331,19 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
__void__dirtyAllVertexArrays,
|
||||
"dirty the vertex, normal, color, tex coords, secondary color, fog coord and index arrays. ",
|
||||
"");
|
||||
I_Method1(void, setCurrentVertexBufferObject, IN, osg::VertexBufferObject *, vbo,
|
||||
I_Method1(void, setCurrentVertexBufferObject, IN, osg::GLBufferObject *, vbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setCurrentVertexBufferObject__osg_VertexBufferObject_P1,
|
||||
__void__setCurrentVertexBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::VertexBufferObject *, getCurrentVertexBufferObject,
|
||||
I_Method0(const osg::GLBufferObject *, getCurrentVertexBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_VertexBufferObject_P1__getCurrentVertexBufferObject,
|
||||
__C5_GLBufferObject_P1__getCurrentVertexBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, bindVertexBufferObject, IN, const osg::VertexBufferObject *, vbo,
|
||||
I_Method1(void, bindVertexBufferObject, IN, osg::GLBufferObject *, vbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__bindVertexBufferObject__C5_osg_VertexBufferObject_P1,
|
||||
__void__bindVertexBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, unbindVertexBufferObject,
|
||||
@ -351,19 +351,19 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
__void__unbindVertexBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setCurrentElementBufferObject, IN, osg::ElementBufferObject *, ebo,
|
||||
I_Method1(void, setCurrentElementBufferObject, IN, osg::GLBufferObject *, ebo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setCurrentElementBufferObject__osg_ElementBufferObject_P1,
|
||||
__void__setCurrentElementBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::ElementBufferObject *, getCurrentElementBufferObject,
|
||||
I_Method0(const osg::GLBufferObject *, getCurrentElementBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_ElementBufferObject_P1__getCurrentElementBufferObject,
|
||||
__C5_GLBufferObject_P1__getCurrentElementBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, bindElementBufferObject, IN, const osg::ElementBufferObject *, ebo,
|
||||
I_Method1(void, bindElementBufferObject, IN, osg::GLBufferObject *, ebo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__bindElementBufferObject__C5_osg_ElementBufferObject_P1,
|
||||
__void__bindElementBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, unbindElementBufferObject,
|
||||
@ -371,19 +371,19 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
__void__unbindElementBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setCurrentPixelBufferObject, IN, osg::PixelBufferObject *, pbo,
|
||||
I_Method1(void, setCurrentPixelBufferObject, IN, osg::GLBufferObject *, pbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setCurrentPixelBufferObject__osg_PixelBufferObject_P1,
|
||||
__void__setCurrentPixelBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osg::PixelBufferObject *, getCurrentPixelBufferObject,
|
||||
I_Method0(const osg::GLBufferObject *, getCurrentPixelBufferObject,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_PixelBufferObject_P1__getCurrentPixelBufferObject,
|
||||
__C5_GLBufferObject_P1__getCurrentPixelBufferObject,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, bindPixelBufferObject, IN, const osg::PixelBufferObject *, pbo,
|
||||
I_Method1(void, bindPixelBufferObject, IN, osg::GLBufferObject *, pbo,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__bindPixelBufferObject__C5_osg_PixelBufferObject_P1,
|
||||
__void__bindPixelBufferObject__osg_GLBufferObject_P1,
|
||||
"",
|
||||
"");
|
||||
I_Method0(void, unbindPixelBufferObject,
|
||||
@ -830,15 +830,15 @@ BEGIN_OBJECT_REFLECTOR(osg::State)
|
||||
I_SimpleProperty(unsigned int, ContextID,
|
||||
__unsigned_int__getContextID,
|
||||
__void__setContextID__unsigned_int);
|
||||
I_SimpleProperty(osg::ElementBufferObject *, CurrentElementBufferObject,
|
||||
I_SimpleProperty(osg::GLBufferObject *, CurrentElementBufferObject,
|
||||
0,
|
||||
__void__setCurrentElementBufferObject__osg_ElementBufferObject_P1);
|
||||
I_SimpleProperty(osg::PixelBufferObject *, CurrentPixelBufferObject,
|
||||
__void__setCurrentElementBufferObject__osg_GLBufferObject_P1);
|
||||
I_SimpleProperty(osg::GLBufferObject *, CurrentPixelBufferObject,
|
||||
0,
|
||||
__void__setCurrentPixelBufferObject__osg_PixelBufferObject_P1);
|
||||
I_SimpleProperty(osg::VertexBufferObject *, CurrentVertexBufferObject,
|
||||
__void__setCurrentPixelBufferObject__osg_GLBufferObject_P1);
|
||||
I_SimpleProperty(osg::GLBufferObject *, CurrentVertexBufferObject,
|
||||
0,
|
||||
__void__setCurrentVertexBufferObject__osg_VertexBufferObject_P1);
|
||||
__void__setCurrentVertexBufferObject__osg_GLBufferObject_P1);
|
||||
I_SimpleProperty(const osg::Viewport *, CurrentViewport,
|
||||
__C5_Viewport_P1__getCurrentViewport,
|
||||
0);
|
||||
|
Loading…
Reference in New Issue
Block a user