diff --git a/include/osg/Drawable b/include/osg/Drawable index 4d194b6a0..588a72eb8 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -481,7 +481,7 @@ public: { if (indices==0 || count==0) return; - typedef unsigned char* IndexPointer; + typedef GLubyte* IndexPointer; switch(mode) { @@ -548,7 +548,7 @@ public: { if (indices==0 || count==0) return; - typedef unsigned short* IndexPointer; + typedef GLushort* IndexPointer; switch(mode) { @@ -617,7 +617,7 @@ public: { if (indices==0 || count==0) return; - typedef unsigned int* IndexPointer; + typedef GLuint* IndexPointer; switch(mode) { diff --git a/include/osg/GeoSet b/include/osg/GeoSet index e94d5c524..d23c479ba 100644 --- a/include/osg/GeoSet +++ b/include/osg/GeoSet @@ -84,11 +84,11 @@ class SG_EXPORT GeoSet : public Drawable bool _is_ushort; union { - ushort* _ushort; - uint* _uint; + GLushort* _ushort; + GLuint* _uint; } _ptr; - IndexPointer() { _size=0;_is_ushort=true;_ptr._ushort = (ushort*)0; } + IndexPointer() { _size=0;_is_ushort=true;_ptr._ushort = (GLushort*)0; } inline const bool operator == (const IndexPointer& ip) const { @@ -99,22 +99,22 @@ class SG_EXPORT GeoSet : public Drawable inline const bool valid() const { - return _ptr._ushort != (ushort*)0; + return _ptr._ushort != (GLushort*)0; } inline const bool null() const { - return _ptr._ushort == (ushort*)0; + return _ptr._ushort == (GLushort*)0; } inline void setToNull() { _size = 0; _is_ushort = true; - _ptr._ushort = (ushort*)0; + _ptr._ushort = (GLushort*)0; } - inline void set(uint size,ushort* data) + inline void set(uint size,GLushort* data) { _size = size; _is_ushort = true; @@ -122,7 +122,7 @@ class SG_EXPORT GeoSet : public Drawable } - void set(const uint size,uint* data) + void set(const uint size,GLuint* data) { _size = size; _is_ushort = false; @@ -145,7 +145,7 @@ class SG_EXPORT GeoSet : public Drawable return max; } - inline const uint operator [] (const uint pos) const + inline const GLint operator [] (const GLuint pos) const { if (_is_ushort) return _ptr._ushort[pos]; else return _ptr._uint[pos]; @@ -199,11 +199,11 @@ class SG_EXPORT GeoSet : public Drawable /** set the coords (i.e the geometry) and ushort indices of the geoset. To reduce memory footprint and bandwidth for small datasets it is recommended the ushort indices are used instead of unit indices.*/ - void setCoords( Vec3 *cp, ushort *ci ); + void setCoords( Vec3 *cp, GLushort *ci ); /** set the coords (i.e the geometry) and uint indices of the geoset. Unless your data set exceeds 65536 indices prefer ushort indices over uint indices, only use this unit indices version if necessary.*/ - void setCoords( Vec3 *cp, uint *ci ); + void setCoords( Vec3 *cp, GLuint *ci ); /** set the coords (i.e the geometry) and indices of the geoset.*/ void setCoords( Vec3 *cp, IndexPointer& ip ); @@ -222,9 +222,9 @@ class SG_EXPORT GeoSet : public Drawable /** set the normals of the geoset.*/ void setNormals( Vec3 *np ); /** set the normals and normal indices of the geoset.*/ - void setNormals( Vec3 *np, ushort *ni ); + void setNormals( Vec3 *np, GLushort *ni ); /** set the normals and normal indices of the geoset.*/ - void setNormals( Vec3 *np, uint *ni ); + void setNormals( Vec3 *np, GLuint *ni ); /** set the normals and normal indices of the geoset.*/ void setNormals( Vec3 *np, IndexPointer& ip ); /** set the normals binding to the vertices/primitives/overall.*/ @@ -246,9 +246,9 @@ class SG_EXPORT GeoSet : public Drawable /** set the colors of the geoset.*/ void setColors( Vec4 *cp ); /** set the colors and color indices of the geoset.*/ - void setColors( Vec4 *cp, ushort *li ); + void setColors( Vec4 *cp, GLushort *li ); /** set the colors and color indices of the geoset.*/ - void setColors( Vec4 *cp, uint *li ); + void setColors( Vec4 *cp, GLuint *li ); /** set the colors and color indices of the geoset.*/ void setColors( Vec4 *cp, IndexPointer& ip ); /** set the color binding to the vertices/primitives/overall.*/ @@ -270,9 +270,9 @@ class SG_EXPORT GeoSet : public Drawable /** set the texture coords of the geoset.*/ void setTextureCoords( Vec2 *tc ); /** set the texture coords and texture coord indices of the geoset.*/ - void setTextureCoords( Vec2 *tc, ushort *ti ); + void setTextureCoords( Vec2 *tc, GLushort *ti ); /** set the texture coords and texture coord indices of the geoset.*/ - void setTextureCoords( Vec2 *tc, uint *ti ); + void setTextureCoords( Vec2 *tc, GLuint *ti ); /** set the texture coords and texture indices of the geoset.*/ void setTextureCoords( Vec2 *tc, IndexPointer& ip ); /** set the texture coord binding to the vertices/primitives/overall.*/ @@ -296,8 +296,8 @@ class SG_EXPORT GeoSet : public Drawable /** set the interleaved arrays of the geoset.*/ void setInterleavedArray( const InterleaveArrayType format, float *ia ); - void setInterleavedArray( const InterleaveArrayType format, float *ia, ushort *iai ); - void setInterleavedArray( const InterleaveArrayType format, float *ia, uint *iai ); + void setInterleavedArray( const InterleaveArrayType format, float *ia, GLushort *iai ); + void setInterleavedArray( const InterleaveArrayType format, float *ia, GLuint *iai ); void setInterleavedArray( const InterleaveArrayType format, float *ia, IndexPointer& iai ); /** draw geoset directly ignoring an OpenGL display list which could be attached. @@ -414,13 +414,13 @@ void for_each_triangle(GeoSet& gset,T& op) { if (gset.getCoordIndices()._is_ushort) { - ushort* iptr = gset.getCoordIndices()._ptr._ushort; + GLushort* iptr = gset.getCoordIndices()._ptr._ushort; Vec3* vptr = gset.getCoords(); const int numPrim = gset.getNumPrims(); for(int i=0; i0) { const Vec3& start = vptr[*(iptr)]; - uint* iend = iptr+primLength; + GLuint* iend = iptr+primLength; ++iptr; for(int j = 2; j < primLength; ++j ) { diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index 3aa37bd82..1aec3ddad 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -160,8 +160,8 @@ void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset) // coord indicies may be shared so we have to go through the long winded // step of creating unique pointer sets which we then delete. This // ensures that arrays aren't osgDelete twice. Robert. - std::set ushortList; - std::set uintList; + std::set ushortList; + std::set uintList; INDEX_ARRAY_DELETE(gset->getCoordIndices()) INDEX_ARRAY_DELETE(gset->getNormalIndices()); @@ -169,14 +169,14 @@ void GeoSet::AttributeDeleteFunctor::operator() (GeoSet* gset) INDEX_ARRAY_DELETE(gset->getTextureIndices()) INDEX_ARRAY_DELETE(gset->getInterleavedIndices()); - for(std::set::iterator sitr=ushortList.begin(); + for(std::set::iterator sitr=ushortList.begin(); sitr!=ushortList.end(); ++sitr) { osgDelete [] *sitr; } - for(std::set::iterator iitr=uintList.begin(); + for(std::set::iterator iitr=uintList.begin(); iitr!=uintList.end(); ++iitr) { @@ -594,7 +594,7 @@ void GeoSet::setCoords( Vec3 *cp ) } -void GeoSet::setCoords( Vec3 *cp, ushort *ci ) +void GeoSet::setCoords( Vec3 *cp, GLushort *ci ) { _coords = cp; // note the size of cindex defaults 0, but will be recalculated @@ -605,7 +605,7 @@ void GeoSet::setCoords( Vec3 *cp, ushort *ci ) } -void GeoSet::setCoords( Vec3 *cp, uint *ci ) +void GeoSet::setCoords( Vec3 *cp, GLuint *ci ) { _coords = cp; // note the size of cindex defaults 0, but will be recalculated @@ -634,7 +634,7 @@ void GeoSet::setNormals( Vec3 *np ) } -void GeoSet::setNormals( Vec3 *np, ushort *ni ) +void GeoSet::setNormals( Vec3 *np, GLushort *ni ) { _normals = np; // note the size of nindex defaults 0, but will be recalculated @@ -646,7 +646,7 @@ void GeoSet::setNormals( Vec3 *np, ushort *ni ) set_fast_path(); } -void GeoSet::setNormals( Vec3 *np, uint *ni ) +void GeoSet::setNormals( Vec3 *np, GLuint *ni ) { _normals = np; // note the size of nindex defaults 0, but will be recalculated @@ -681,7 +681,7 @@ void GeoSet::setColors( Vec4 *lp ) } -void GeoSet::setColors( Vec4 *lp, ushort *coli ) +void GeoSet::setColors( Vec4 *lp, GLushort *coli ) { _colors = lp; // note the size of colindex defaults 0, but will be recalculated @@ -693,7 +693,7 @@ void GeoSet::setColors( Vec4 *lp, ushort *coli ) set_fast_path(); } -void GeoSet::setColors( Vec4 *lp, uint *coli ) +void GeoSet::setColors( Vec4 *lp, GLuint *coli ) { _colors = lp; // note the size of colindex defaults 0, but will be recalculated @@ -728,7 +728,7 @@ void GeoSet::setTextureCoords( Vec2 *tc ) } -void GeoSet::setTextureCoords( Vec2 *tc, ushort *ti ) +void GeoSet::setTextureCoords( Vec2 *tc, GLushort *ti ) { _tcoords = tc; // note the size of tindex defaults 0, but will be recalculated @@ -741,7 +741,7 @@ void GeoSet::setTextureCoords( Vec2 *tc, ushort *ti ) } -void GeoSet::setTextureCoords( Vec2 *tc, uint *ti ) +void GeoSet::setTextureCoords( Vec2 *tc, GLuint *ti ) { _tcoords = tc; // note the size of tindex defaults 0, but will be recalculated diff --git a/src/osg/State.cpp b/src/osg/State.cpp index ef43fef2f..7418e7de9 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -3,6 +3,8 @@ #include +#include + using namespace osg; State::State() @@ -188,9 +190,9 @@ void State::apply(const StateSet* dstate) const StateSet::TextureAttributeList& ds_textureAttributeList = dstate->getTextureAttributeList(); unsigned int unit; - unsigned int unitMax = std::max(ds_textureModeList.size(),ds_textureAttributeList.size()); - unitMax = std::max(unitMax,_textureModeMapList.size()); - unitMax = std::max(unitMax,_textureAttributeMapList.size()); + unsigned int unitMax = std::max(static_cast(ds_textureModeList.size()),static_cast(ds_textureAttributeList.size())); + unitMax = std::max(static_cast(unitMax),static_cast(_textureModeMapList.size())); + unitMax = std::max(static_cast(unitMax),static_cast(_textureAttributeMapList.size())); for(unit=0;unit