diff --git a/include/osg/StencilTwoSided b/include/osg/StencilTwoSided index f993b5fd4..5c907c6c8 100644 --- a/include/osg/StencilTwoSided +++ b/include/osg/StencilTwoSided @@ -161,7 +161,8 @@ class OSG_EXPORT StencilTwoSided : public StateAttribute bool _isStencilTwoSidedSupported; - void* _glActiveStencilFace; + typedef void (APIENTRY * ActiveStencilFaceProc) (GLenum); + ActiveStencilFaceProc _glActiveStencilFace; }; /** Function to call to get the extension of a specified context. diff --git a/include/osg/Texture3D b/include/osg/Texture3D index 8392dbeb8..02b24a5f7 100644 --- a/include/osg/Texture3D +++ b/include/osg/Texture3D @@ -160,24 +160,16 @@ class OSG_EXPORT Texture3D : public Texture void setMaxTexture3DSize(GLint maxsize) { _maxTexture3DSize=maxsize; } GLint maxTexture3DSize() const { return _maxTexture3DSize; } - void setTexImage3DProc(void* ptr) { _glTexImage3D = ptr; } void glTexImage3D( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) const; - - void setTexSubImage3DProc(void* ptr) { _glTexSubImage3D = ptr; } void glTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels) const; - - void setCopyTexSubImage3DProc(void* ptr) { _glCopyTexSubImage3D = ptr; } void glCopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) const; bool isCompressedTexImage3DSupported() const { return _glCompressedTexImage3D!=0; } - void setCompressedTexImage3DProc(void* ptr) { _glCompressedTexImage3D = ptr; } void glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) const; bool isCompressedTexSubImage3DSupported() const { return _glCompressedTexSubImage3D!=0; } - void setCompressedTexSubImage3DProc(void* ptr) { _glCompressedTexSubImage3D = ptr; } void glCompressedTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ) const; - void setBuild3DMipmapsProc(void* ptr) { _gluBuild3DMipmaps = ptr; } void gluBuild3DMipmaps( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *data) const; protected: @@ -188,12 +180,19 @@ class OSG_EXPORT Texture3D : public Texture bool _isTexture3DFast; GLint _maxTexture3DSize; - void* _glTexImage3D; - void* _glTexSubImage3D; - void* _glCompressedTexImage3D; - void* _glCompressedTexSubImage3D; - void* _glCopyTexSubImage3D; - void* _gluBuild3DMipmaps; + typedef void (APIENTRY * GLTexImage3DProc) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + typedef void (APIENTRY * GLTexSubImage3DProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + typedef void (APIENTRY * CompressedTexImage3DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + typedef void (APIENTRY * CompressedTexSubImage3DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); + typedef void (APIENTRY * GLCopyTexSubImageProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + typedef void (APIENTRY * GLUBuild3DMipMapsProc) ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *data); + + GLTexImage3DProc _glTexImage3D; + GLTexSubImage3DProc _glTexSubImage3D; + CompressedTexImage3DArbProc _glCompressedTexImage3D; + CompressedTexSubImage3DArbProc _glCompressedTexSubImage3D; + GLCopyTexSubImageProc _glCopyTexSubImage3D; + GLUBuild3DMipMapsProc _gluBuild3DMipmaps; }; diff --git a/src/osg/StencilTwoSided.cpp b/src/osg/StencilTwoSided.cpp index cb5f3e29c..624267b94 100644 --- a/src/osg/StencilTwoSided.cpp +++ b/src/osg/StencilTwoSided.cpp @@ -142,15 +142,14 @@ void StencilTwoSided::Extensions::setupGLExtensions(unsigned int contextID) { _isStencilTwoSidedSupported = isGLExtensionSupported(contextID,"GL_EXT_stencil_two_side"); - _glActiveStencilFace = osg::getGLExtensionFuncPtr("glActiveStencilFace","glActiveStencilFaceEXT"); + setGLExtensionFuncPtr(_glActiveStencilFace, "glActiveStencilFace","glActiveStencilFaceEXT"); } void StencilTwoSided::Extensions::glActiveStencilFace(GLenum face) const { if (_glActiveStencilFace) { - typedef void (APIENTRY * ActiveStencilFaceProc) (GLenum); - ((ActiveStencilFaceProc)_glActiveStencilFace)(face); + _glActiveStencilFace(face); } else { diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 2e8e6450d..972022d1b 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1634,8 +1634,6 @@ void Texture::Extensions::setupGLExtensions(unsigned int contextID) return; } - - float glVersion = asciiToFloat( (const char *)version ); const char* renderer = (const char*) glGetString(GL_RENDERER); std::string rendererString(renderer ? renderer : ""); diff --git a/src/osg/Texture1D.cpp b/src/osg/Texture1D.cpp index 3eb2667db..fd5172f7f 100644 --- a/src/osg/Texture1D.cpp +++ b/src/osg/Texture1D.cpp @@ -261,7 +261,7 @@ void Texture1D::applyTexImage1D(GLenum target, Image* image, State& state, GLsiz glPixelStorei(GL_UNPACK_ALIGNMENT,image->getPacking()); static MyCompressedTexImage1DArbProc glCompressedTexImage1D_ptr = - (MyCompressedTexImage1DArbProc)getGLExtensionFuncPtr("glCompressedTexImage1DARB"); + convertPointerType(getGLExtensionFuncPtr("glCompressedTexImage1DARB")); if( _min_filter == LINEAR || _min_filter == NEAREST ) { diff --git a/src/osg/Texture3D.cpp b/src/osg/Texture3D.cpp index ff2d38a39..1a0ff6ace 100644 --- a/src/osg/Texture3D.cpp +++ b/src/osg/Texture3D.cpp @@ -582,12 +582,12 @@ void Texture3D::Extensions::setupGLExtensions(unsigned int contextID) glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &_maxTexture3DSize); - _glTexImage3D = getGLExtensionFuncPtr("glTexImage3D","glTexImage3DEXT"); - _glTexSubImage3D = getGLExtensionFuncPtr("glTexSubImage3D","glTexSubImage3DEXT"); - _glCompressedTexImage3D = getGLExtensionFuncPtr("glCompressedTexImage3D","glCompressedTexImage3DARB"); - _glCompressedTexSubImage3D = getGLExtensionFuncPtr("glCompressedTexSubImage3D","glCompressedTexSubImage3DARB"); - _glCopyTexSubImage3D = getGLExtensionFuncPtr("glCopyTexSubImage3D","glCopyTexSubImage3DEXT"); - _gluBuild3DMipmaps = getGLExtensionFuncPtr("gluBuild3DMipmaps"); + setGLExtensionFuncPtr(_glTexImage3D,"glTexImage3D","glTexImage3DEXT"); + setGLExtensionFuncPtr(_glTexSubImage3D,"glTexSubImage3D","glTexSubImage3DEXT"); + setGLExtensionFuncPtr(_glCompressedTexImage3D,"glCompressedTexImage3D","glCompressedTexImage3DARB"); + setGLExtensionFuncPtr(_glCompressedTexSubImage3D,"glCompressedTexSubImage3D","glCompressedTexSubImage3DARB"); + setGLExtensionFuncPtr(_glCopyTexSubImage3D,"glCopyTexSubImage3D","glCopyTexSubImage3DEXT"); + setGLExtensionFuncPtr(_gluBuild3DMipmaps,"gluBuild3DMipmaps"); } @@ -596,8 +596,7 @@ void Texture3D::Extensions::glTexImage3D( GLenum target, GLint level, GLenum int // ::glTexImage3D( target, level, internalFormat, width, height, depth, border, format, type, pixels); if (_glTexImage3D) { - typedef void (APIENTRY * GLTexImage3DProc) ( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); - ((GLTexImage3DProc)_glTexImage3D)( target, level, internalFormat, width, height, depth, border, format, type, pixels); + _glTexImage3D( target, level, internalFormat, width, height, depth, border, format, type, pixels); } else { @@ -610,8 +609,7 @@ void Texture3D::Extensions::glTexSubImage3D( GLenum target, GLint level, GLint x // ::glTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); if (_glTexSubImage3D) { - typedef void (APIENTRY * GLTexSubImage3DProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); - ((GLTexSubImage3DProc)_glTexSubImage3D)( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + _glTexSubImage3D( target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } else { @@ -623,8 +621,7 @@ void Texture3D::Extensions::glCompressedTexImage3D(GLenum target, GLint level, G { if (_glCompressedTexImage3D) { - typedef void (APIENTRY * CompressedTexImage3DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); - ((CompressedTexImage3DArbProc)_glCompressedTexImage3D)(target, level, internalformat, width, height, depth, border, imageSize, data); + _glCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data); } else { @@ -636,8 +633,7 @@ void Texture3D::Extensions::glCompressedTexSubImage3D( GLenum target, GLint leve { if (_glCompressedTexSubImage3D) { - typedef void (APIENTRY * CompressedTexSubImage3DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); - ((CompressedTexSubImage3DArbProc)_glCompressedTexSubImage3D)(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + _glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } else { @@ -650,8 +646,7 @@ void Texture3D::Extensions::glCopyTexSubImage3D( GLenum target, GLint level, GLi // ::glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); if (_glCopyTexSubImage3D) { - typedef void (APIENTRY * GLCopyTexSubImageProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); - ((GLCopyTexSubImageProc)_glCopyTexSubImage3D)(target, level, xoffset, yoffset, zoffset, x, y, width, height); + _glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); } else { @@ -664,8 +659,7 @@ void Texture3D::Extensions::gluBuild3DMipmaps( GLenum target, GLint internalForm // ::gluBuild3DMipmaps(target, internalFormat, width, height, depth, format, type, data); if (_gluBuild3DMipmaps) { - typedef void (APIENTRY * GLUBuild3DMipMapsProc) ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *data); - ((GLUBuild3DMipMapsProc)_gluBuild3DMipmaps)(target, internalFormat, width, height, depth, format, type, data); + _gluBuild3DMipmaps(target, internalFormat, width, height, depth, format, type, data); } else { diff --git a/src/osgPlugins/ive/HeightFieldLayer.cpp b/src/osgPlugins/ive/HeightFieldLayer.cpp index 1fe19bc3c..cba525e24 100644 --- a/src/osgPlugins/ive/HeightFieldLayer.cpp +++ b/src/osgPlugins/ive/HeightFieldLayer.cpp @@ -51,8 +51,6 @@ void HeightFieldLayer::write(DataOutputStream* out) out->writeFloat(hf->getSkirtHeight()); out->writeUInt(hf->getBorderWidth()); - int packingSize = 1; - float maxError = 0.0f; if (getLocator())