diff --git a/CMakeLists.txt b/CMakeLists.txt index 696a91ba2..ead83d13c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,6 +309,7 @@ OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions libr OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF) OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF) OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF) +OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF) SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.") diff --git a/include/osg/BlendColor b/include/osg/BlendColor index 288b8c510..858291560 100644 --- a/include/osg/BlendColor +++ b/include/osg/BlendColor @@ -93,7 +93,7 @@ class OSG_EXPORT BlendColor : public StateAttribute ~Extensions() {} - typedef void (APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + typedef void (GL_APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); bool _isBlendColorSupported; GLBlendColorProc _glBlendColor; diff --git a/include/osg/BlendEquation b/include/osg/BlendEquation index ed505b6be..fad66849a 100644 --- a/include/osg/BlendEquation +++ b/include/osg/BlendEquation @@ -123,8 +123,8 @@ class OSG_EXPORT BlendEquation : public StateAttribute ~Extensions() {} - typedef void (APIENTRY * GLBlendEquationProc)(GLenum mode); - typedef void (APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); + typedef void (GL_APIENTRY * GLBlendEquationProc)(GLenum mode); + typedef void (GL_APIENTRY * GLBlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); bool _isBlendEquationSupported; bool _isBlendEquationSeparateSupported; diff --git a/include/osg/BlendFunc b/include/osg/BlendFunc index 1a624c62d..611cfb241 100644 --- a/include/osg/BlendFunc +++ b/include/osg/BlendFunc @@ -157,7 +157,7 @@ class OSG_EXPORT BlendFunc : public StateAttribute ~Extensions() {} - typedef void (APIENTRY * GLBlendFuncSeparateProc) (GLenum sfactorRGB, + typedef void (GL_APIENTRY * GLBlendFuncSeparateProc) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); diff --git a/include/osg/BufferObject b/include/osg/BufferObject index 09ae73334..b333e5645 100644 --- a/include/osg/BufferObject +++ b/include/osg/BufferObject @@ -269,17 +269,17 @@ class OSG_EXPORT GLBufferObject : public Referenced protected: - typedef void (APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); - typedef void (APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); - typedef void (APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); - typedef void (APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); - typedef void (APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); - typedef GLboolean (APIENTRY * IsBufferProc) (GLuint buffer); - typedef void (APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); - typedef GLvoid* (APIENTRY * MapBufferProc) (GLenum target, GLenum access); - typedef GLboolean (APIENTRY * UnmapBufferProc) (GLenum target); - typedef void (APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); + typedef void (GL_APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); + typedef void (GL_APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); + typedef void (GL_APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); + typedef void (GL_APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); + typedef void (GL_APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); + typedef GLboolean (GL_APIENTRY * IsBufferProc) (GLuint buffer); + typedef void (GL_APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); + typedef GLvoid* (GL_APIENTRY * MapBufferProc) (GLenum target, GLenum access); + typedef GLboolean (GL_APIENTRY * UnmapBufferProc) (GLenum target); + typedef void (GL_APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); GenBuffersProc _glGenBuffers; BindBufferProc _glBindBuffer; diff --git a/include/osg/ClampColor b/include/osg/ClampColor index f059bd8cd..4ea5d627b 100644 --- a/include/osg/ClampColor +++ b/include/osg/ClampColor @@ -105,7 +105,7 @@ class OSG_EXPORT ClampColor : public StateAttribute ~Extensions() {} - typedef void (APIENTRY * GLClampColorProc) (GLenum target, GLenum mode); + typedef void (GL_APIENTRY * GLClampColorProc) (GLenum target, GLenum mode); bool _isClampColorSupported; GLClampColorProc _glClampColor; diff --git a/include/osg/Drawable b/include/osg/Drawable index 49e315c33..0f532aec3 100644 --- a/include/osg/Drawable +++ b/include/osg/Drawable @@ -671,54 +671,54 @@ class OSG_EXPORT Drawable : public Object friend class ArrayDispatchers; - typedef void (APIENTRY * FogCoordProc) (const GLfloat* coord); + typedef void (GL_APIENTRY * FogCoordProc) (const GLfloat* coord); - typedef void (APIENTRY * VertexAttrib1sProc) (GLuint index, GLshort s); - typedef void (APIENTRY * VertexAttrib1fProc) (GLuint index, GLfloat f); - typedef void (APIENTRY * VertexAttrib1dProc) (GLuint index, GLdouble f); - typedef void (APIENTRY * VertexAttribfvProc) (GLuint index, const GLfloat * v); - typedef void (APIENTRY * VertexAttribdvProc) (GLuint index, const GLdouble * v); - typedef void (APIENTRY * VertexAttribubvProc) (GLuint index, const GLubyte * v); + typedef void (GL_APIENTRY * VertexAttrib1sProc) (GLuint index, GLshort s); + typedef void (GL_APIENTRY * VertexAttrib1fProc) (GLuint index, GLfloat f); + typedef void (GL_APIENTRY * VertexAttrib1dProc) (GLuint index, GLdouble f); + typedef void (GL_APIENTRY * VertexAttribfvProc) (GLuint index, const GLfloat * v); + typedef void (GL_APIENTRY * VertexAttribdvProc) (GLuint index, const GLdouble * v); + typedef void (GL_APIENTRY * VertexAttribubvProc) (GLuint index, const GLubyte * v); - typedef void (APIENTRY * SecondaryColor3ubvProc) (const GLubyte* coord); - typedef void (APIENTRY * SecondaryColor3fvProc) (const GLfloat* coord); + typedef void (GL_APIENTRY * SecondaryColor3ubvProc) (const GLubyte* coord); + typedef void (GL_APIENTRY * SecondaryColor3fvProc) (const GLfloat* coord); - typedef void (APIENTRY * MultiTexCoord1fProc) (GLenum target,GLfloat coord); - typedef void (APIENTRY * MultiTexCoordfvProc) (GLenum target,const GLfloat* coord); - typedef void (APIENTRY * MultiTexCoord1dProc) (GLenum target,GLdouble coord); - typedef void (APIENTRY * MultiTexCoorddvProc) (GLenum target,const GLdouble* coord); + typedef void (GL_APIENTRY * MultiTexCoord1fProc) (GLenum target,GLfloat coord); + typedef void (GL_APIENTRY * MultiTexCoordfvProc) (GLenum target,const GLfloat* coord); + typedef void (GL_APIENTRY * MultiTexCoord1dProc) (GLenum target,GLdouble coord); + typedef void (GL_APIENTRY * MultiTexCoorddvProc) (GLenum target,const GLdouble* coord); - typedef void (APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); - typedef void (APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); - typedef void (APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); - typedef void (APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); - typedef void (APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); - typedef GLboolean (APIENTRY * IsBufferProc) (GLuint buffer); - typedef void (APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); - typedef GLvoid* (APIENTRY * MapBufferProc) (GLenum target, GLenum access); - typedef GLboolean (APIENTRY * UnmapBufferProc) (GLenum target); - typedef void (APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); + typedef void (GL_APIENTRY * GenBuffersProc) (GLsizei n, GLuint *buffers); + typedef void (GL_APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); + typedef void (GL_APIENTRY * BufferDataProc) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); + typedef void (GL_APIENTRY * BufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); + typedef void (GL_APIENTRY * DeleteBuffersProc) (GLsizei n, const GLuint *buffers); + typedef GLboolean (GL_APIENTRY * IsBufferProc) (GLuint buffer); + typedef void (GL_APIENTRY * GetBufferSubDataProc) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); + typedef GLvoid* (GL_APIENTRY * MapBufferProc) (GLenum target, GLenum access); + typedef GLboolean (GL_APIENTRY * UnmapBufferProc) (GLenum target); + typedef void (GL_APIENTRY * GetBufferParameterivProc) (GLenum target, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetBufferPointervProc) (GLenum target, GLenum pname, GLvoid* *params); - typedef void (APIENTRY * GenOcclusionQueriesProc) ( GLsizei n, GLuint *ids ); - typedef void (APIENTRY * DeleteOcclusionQueriesProc) ( GLsizei n, const GLuint *ids ); - typedef GLboolean (APIENTRY * IsOcclusionQueryProc) ( GLuint id ); - typedef void (APIENTRY * BeginOcclusionQueryProc) ( GLuint id ); - typedef void (APIENTRY * EndOcclusionQueryProc) (); - typedef void (APIENTRY * GetOcclusionQueryivProc) ( GLuint id, GLenum pname, GLint *params ); - typedef void (APIENTRY * GetOcclusionQueryuivProc) ( GLuint id, GLenum pname, GLuint *params ); - typedef void (APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64EXT *params ); + typedef void (GL_APIENTRY * GenOcclusionQueriesProc) ( GLsizei n, GLuint *ids ); + typedef void (GL_APIENTRY * DeleteOcclusionQueriesProc) ( GLsizei n, const GLuint *ids ); + typedef GLboolean (GL_APIENTRY * IsOcclusionQueryProc) ( GLuint id ); + typedef void (GL_APIENTRY * BeginOcclusionQueryProc) ( GLuint id ); + typedef void (GL_APIENTRY * EndOcclusionQueryProc) (); + typedef void (GL_APIENTRY * GetOcclusionQueryivProc) ( GLuint id, GLenum pname, GLint *params ); + typedef void (GL_APIENTRY * GetOcclusionQueryuivProc) ( GLuint id, GLenum pname, GLuint *params ); + typedef void (GL_APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64EXT *params ); - typedef void (APIENTRY *GenQueriesProc) (GLsizei n, GLuint *ids); - typedef void (APIENTRY *DeleteQueriesProc) (GLsizei n, const GLuint *ids); - typedef GLboolean (APIENTRY *IsQueryProc) (GLuint id); - typedef void (APIENTRY *BeginQueryProc) (GLenum target, GLuint id); - typedef void (APIENTRY *EndQueryProc) (GLenum target); - typedef void (APIENTRY *GetQueryivProc) (GLenum target, GLenum pname, GLint *params); - typedef void (APIENTRY *GetQueryObjectivProc) (GLuint id, GLenum pname, GLint *params); - typedef void (APIENTRY *GetQueryObjectuivProc) (GLuint id, GLenum pname, GLuint *params); - typedef void (APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64EXT *params); + typedef void (GL_APIENTRY *GenQueriesProc) (GLsizei n, GLuint *ids); + typedef void (GL_APIENTRY *DeleteQueriesProc) (GLsizei n, const GLuint *ids); + typedef GLboolean (GL_APIENTRY *IsQueryProc) (GLuint id); + typedef void (GL_APIENTRY *BeginQueryProc) (GLenum target, GLuint id); + typedef void (GL_APIENTRY *EndQueryProc) (GLenum target); + typedef void (GL_APIENTRY *GetQueryivProc) (GLenum target, GLenum pname, GLint *params); + typedef void (GL_APIENTRY *GetQueryObjectivProc) (GLuint id, GLenum pname, GLint *params); + typedef void (GL_APIENTRY *GetQueryObjectuivProc) (GLuint id, GLenum pname, GLuint *params); + typedef void (GL_APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64EXT *params); ~Extensions() {} diff --git a/include/osg/FragmentProgram b/include/osg/FragmentProgram index 8e7085590..307948428 100644 --- a/include/osg/FragmentProgram +++ b/include/osg/FragmentProgram @@ -263,11 +263,11 @@ class OSG_EXPORT FragmentProgram : public StateAttribute bool _isFragmentProgramSupported; - typedef void (APIENTRY * BindProgramProc) (GLenum target, GLuint id); - typedef void (APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); - typedef void (APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); - typedef void (APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); - typedef void (APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); + typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); + typedef void (GL_APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); + typedef void (GL_APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); + typedef void (GL_APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); + typedef void (GL_APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); BindProgramProc _glBindProgram; GenProgramsProc _glGenPrograms; diff --git a/include/osg/FrameBufferObject b/include/osg/FrameBufferObject index cbbfbf311..3a84c4a29 100644 --- a/include/osg/FrameBufferObject +++ b/include/osg/FrameBufferObject @@ -144,24 +144,24 @@ namespace osg class OSG_EXPORT FBOExtensions : public osg::Referenced { public: - typedef void APIENTRY TglBindRenderbuffer(GLenum, GLuint); - typedef void APIENTRY TglDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); - typedef void APIENTRY TglGenRenderbuffers(GLsizei, GLuint *); - typedef void APIENTRY TglRenderbufferStorage(GLenum, GLenum, GLsizei, GLsizei); - typedef void APIENTRY TglRenderbufferStorageMultisample(GLenum, GLsizei, GLenum, GLsizei, GLsizei); - typedef void APIENTRY TglRenderbufferStorageMultisampleCoverageNV(GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); - typedef void APIENTRY TglBindFramebuffer(GLenum, GLuint); - typedef void APIENTRY TglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers); - typedef void APIENTRY TglGenFramebuffers(GLsizei, GLuint *); - typedef GLenum APIENTRY TglCheckFramebufferStatus(GLenum); - typedef void APIENTRY TglFramebufferTexture1D(GLenum, GLenum, GLenum, GLuint, GLint); - typedef void APIENTRY TglFramebufferTexture2D(GLenum, GLenum, GLenum, GLuint, GLint); - typedef void APIENTRY TglFramebufferTexture3D(GLenum, GLenum, GLenum, GLuint, GLint, GLint); - typedef void APIENTRY TglFramebufferTextureLayer(GLenum, GLenum, GLuint, GLint, GLint); - typedef void APIENTRY TglFramebufferRenderbuffer(GLenum, GLenum, GLenum, GLuint); - typedef void APIENTRY TglGenerateMipmap(GLenum); - typedef void APIENTRY TglBlitFramebuffer(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); - typedef void APIENTRY TglGetRenderbufferParameteriv(GLenum, GLenum, GLint*); + typedef void GL_APIENTRY TglBindRenderbuffer(GLenum, GLuint); + typedef void GL_APIENTRY TglDeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); + typedef void GL_APIENTRY TglGenRenderbuffers(GLsizei, GLuint *); + typedef void GL_APIENTRY TglRenderbufferStorage(GLenum, GLenum, GLsizei, GLsizei); + typedef void GL_APIENTRY TglRenderbufferStorageMultisample(GLenum, GLsizei, GLenum, GLsizei, GLsizei); + typedef void GL_APIENTRY TglRenderbufferStorageMultisampleCoverageNV(GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); + typedef void GL_APIENTRY TglBindFramebuffer(GLenum, GLuint); + typedef void GL_APIENTRY TglDeleteFramebuffers(GLsizei n, const GLuint *framebuffers); + typedef void GL_APIENTRY TglGenFramebuffers(GLsizei, GLuint *); + typedef GLenum GL_APIENTRY TglCheckFramebufferStatus(GLenum); + typedef void GL_APIENTRY TglFramebufferTexture1D(GLenum, GLenum, GLenum, GLuint, GLint); + typedef void GL_APIENTRY TglFramebufferTexture2D(GLenum, GLenum, GLenum, GLuint, GLint); + typedef void GL_APIENTRY TglFramebufferTexture3D(GLenum, GLenum, GLenum, GLuint, GLint, GLint); + typedef void GL_APIENTRY TglFramebufferTextureLayer(GLenum, GLenum, GLuint, GLint, GLint); + typedef void GL_APIENTRY TglFramebufferRenderbuffer(GLenum, GLenum, GLenum, GLuint); + typedef void GL_APIENTRY TglGenerateMipmap(GLenum); + typedef void GL_APIENTRY TglBlitFramebuffer(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); + typedef void GL_APIENTRY TglGetRenderbufferParameteriv(GLenum, GLenum, GLint*); TglBindRenderbuffer* glBindRenderbuffer; TglGenRenderbuffers* glGenRenderbuffers; diff --git a/include/osg/GL b/include/osg/GL index 3b1119b86..cd3f52f58 100644 --- a/include/osg/GL +++ b/include/osg/GL @@ -17,69 +17,6 @@ #include #include -#ifndef WIN32 - - // Required for compatibility with glext.h sytle function definitions of - // OpenGL extensions, such as in src/osg/Point.cpp. - #ifndef APIENTRY - #define APIENTRY - #endif - -#else // WIN32 - - #if defined(__CYGWIN__) || defined(__MINGW32__) - - #ifndef APIENTRY - #define GLUT_APIENTRY_DEFINED - #define APIENTRY __stdcall - #endif - // XXX This is from Win32's - #ifndef CALLBACK - #define CALLBACK __stdcall - #endif - - #else // ! __CYGWIN__ - - // Under Windows avoid including - // to avoid name space pollution, but Win32's - // needs APIENTRY and WINGDIAPI defined properly. - // XXX This is from Win32's - #ifndef APIENTRY - #define GLUT_APIENTRY_DEFINED - #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) - #define WINAPI __stdcall - #define APIENTRY WINAPI - #else - #define APIENTRY - #endif - #endif - - // XXX This is from Win32's - #ifndef CALLBACK - #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) - #define CALLBACK __stdcall - #else - #define CALLBACK - #endif - #endif - - #endif // __CYGWIN__ - - // XXX This is from Win32's and - #ifndef WINGDIAPI - #define GLUT_WINGDIAPI_DEFINED - #define DECLSPEC_IMPORT __declspec(dllimport) - #define WINGDIAPI DECLSPEC_IMPORT - #endif - // XXX This is from Win32's - - #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4))) - typedef unsigned short wchar_t; - #define _WCHAR_T_DEFINED - #endif - -#endif // WIN32 - #if defined(OSG_GLES1_AVAILABLE) #ifdef __APPLE__ @@ -105,8 +42,75 @@ #define GL3_PROTOTYPES 1 #include + #ifndef GL_APIENTRY + #define GL_APIENTRY APIENTRY + #endif // GL_APIENTRY + #else + #ifndef WIN32 + + // Required for compatibility with glext.h sytle function definitions of + // OpenGL extensions, such as in src/osg/Point.cpp. + #ifndef APIENTRY + #define APIENTRY + #endif + + #else // WIN32 + + #if defined(__CYGWIN__) || defined(__MINGW32__) + + #ifndef APIENTRY + #define GLUT_APIENTRY_DEFINED + #define APIENTRY __stdcall + #endif + // XXX This is from Win32's + #ifndef CALLBACK + #define CALLBACK __stdcall + #endif + + #else // ! __CYGWIN__ + + // Under Windows avoid including + // to avoid name space pollution, but Win32's + // needs APIENTRY and WINGDIAPI defined properly. + // XXX This is from Win32's + #ifndef APIENTRY + #define GLUT_APIENTRY_DEFINED + #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) + #define WINAPI __stdcall + #define APIENTRY WINAPI + #else + #define APIENTRY + #endif + #endif + + // XXX This is from Win32's + #ifndef CALLBACK + #if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) + #define CALLBACK __stdcall + #else + #define CALLBACK + #endif + #endif + + #endif // __CYGWIN__ + + // XXX This is from Win32's and + #ifndef WINGDIAPI + #define GLUT_WINGDIAPI_DEFINED + #define DECLSPEC_IMPORT __declspec(dllimport) + #define WINGDIAPI DECLSPEC_IMPORT + #endif + + // XXX This is from Win32's + #if !defined(_WCHAR_T_DEFINED) && !(defined(__GNUC__)&&((__GNUC__ == 3)||(__GNUC__ == 4))) + typedef unsigned short wchar_t; + #define _WCHAR_T_DEFINED + #endif + + #endif // WIN32 + #ifndef __gl_h_ #ifdef __APPLE__ #include @@ -114,6 +118,10 @@ #include #endif #endif + + #ifndef GL_APIENTRY + #define GL_APIENTRY APIENTRY + #endif // GL_APIENTRY #endif diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index d13f8c283..eee53d130 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -401,124 +401,124 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced bool _isGeometryShader4Supported; bool _isGpuShader4Supported; - typedef void (APIENTRY * BlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); - typedef void (APIENTRY * DrawBuffersProc)(GLsizei n, const GLenum *bufs); - typedef void (APIENTRY * StencilOpSeparateProc)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); - typedef void (APIENTRY * StencilFuncSeparateProc)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); - typedef void (APIENTRY * StencilMaskSeparateProc)(GLenum face, GLuint mask); - typedef void (APIENTRY * AttachShaderProc)(GLuint program, GLuint shader); - typedef void (APIENTRY * BindAttribLocationProc)(GLuint program, GLuint index, const GLchar *name); - typedef void (APIENTRY * CompileShaderProc)(GLuint shader); - typedef GLuint (APIENTRY * CreateProgramProc)(void); - typedef GLuint (APIENTRY * CreateShaderProc)(GLenum type); - typedef void (APIENTRY * DeleteProgramProc)(GLuint program); - typedef void (APIENTRY * DeleteObjectARBProc)(GLuint program); - typedef void (APIENTRY * DeleteShaderProc)(GLuint shader); - typedef void (APIENTRY * DetachShaderProc)(GLuint program, GLuint shader); - typedef void (APIENTRY * DisableVertexAttribArrayProc)(GLuint index); - typedef void (APIENTRY * EnableVertexAttribArrayProc)(GLuint index); - typedef void (APIENTRY * GetActiveAttribProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); - typedef void (APIENTRY * GetActiveUniformProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); - typedef void (APIENTRY * GetAttachedShadersProc)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); - typedef GLint (APIENTRY * GetAttribLocationProc)(GLuint program, const GLchar *name); - typedef void (APIENTRY * GetProgramivProc)(GLuint program, GLenum pname, GLint *params); - typedef void (APIENTRY * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params); - typedef void (APIENTRY * GetProgramInfoLogProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (APIENTRY * GetInfoLogARBProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (APIENTRY * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params); - typedef void (APIENTRY * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); - typedef void (APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); - typedef GLint (APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name); - typedef void (APIENTRY * GetUniformfvProc)(GLuint program, GLint location, GLfloat *params); - typedef void (APIENTRY * GetUniformivProc)(GLuint program, GLint location, GLint *params); - typedef void (APIENTRY * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *params); - typedef void (APIENTRY * GetVertexAttribfvProc)(GLuint index, GLenum pname, GLfloat *params); - typedef void (APIENTRY * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params); - typedef void (APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); - typedef GLboolean (APIENTRY * IsProgramProc)(GLuint program); - typedef GLboolean (APIENTRY * IsShaderProc)(GLuint shader); - typedef void (APIENTRY * LinkProgramProc)(GLuint program); - typedef void (APIENTRY * ShaderSourceProc)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); - typedef void (APIENTRY * UseProgramProc)(GLuint program); - typedef void (APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); - typedef void (APIENTRY * Uniform2fProc)(GLint location, GLfloat v0, GLfloat v1); - typedef void (APIENTRY * Uniform3fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); - typedef void (APIENTRY * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); - typedef void (APIENTRY * Uniform1iProc)(GLint location, GLint v0); - typedef void (APIENTRY * Uniform2iProc)(GLint location, GLint v0, GLint v1); - typedef void (APIENTRY * Uniform3iProc)(GLint location, GLint v0, GLint v1, GLint v2); - typedef void (APIENTRY * Uniform4iProc)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); - typedef void (APIENTRY * Uniform1fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (APIENTRY * Uniform2fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (APIENTRY * Uniform3fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (APIENTRY * Uniform4fvProc)(GLint location, GLsizei count, const GLfloat *value); - typedef void (APIENTRY * Uniform1ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (APIENTRY * Uniform2ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (APIENTRY * Uniform3ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (APIENTRY * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value); - typedef void (APIENTRY * UniformMatrix2fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (APIENTRY * UniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (APIENTRY * UniformMatrix4fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); - typedef void (APIENTRY * ValidateProgramProc)(GLuint program); - typedef void (APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x); - typedef void (APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); - typedef void (APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); - typedef void (APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); - typedef void (APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); - typedef void (APIENTRY * VertexAttrib1svProc)(GLuint index, const GLshort *v); - typedef void (APIENTRY * VertexAttrib2dProc)(GLuint index, GLdouble x, GLdouble y); - typedef void (APIENTRY * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); - typedef void (APIENTRY * VertexAttrib2fProc)(GLuint index, GLfloat x, GLfloat y); - typedef void (APIENTRY * VertexAttrib2fvProc)(GLuint index, const GLfloat *v); - typedef void (APIENTRY * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); - typedef void (APIENTRY * VertexAttrib2svProc)(GLuint index, const GLshort *v); - typedef void (APIENTRY * VertexAttrib3dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z); - typedef void (APIENTRY * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); - typedef void (APIENTRY * VertexAttrib3fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z); - typedef void (APIENTRY * VertexAttrib3fvProc)(GLuint index, const GLfloat *v); - typedef void (APIENTRY * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); - typedef void (APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *v); - typedef void (APIENTRY * VertexAttrib4NbvProc)(GLuint index, const GLbyte *v); - typedef void (APIENTRY * VertexAttrib4NivProc)(GLuint index, const GLint *v); - typedef void (APIENTRY * VertexAttrib4NsvProc)(GLuint index, const GLshort *v); - typedef void (APIENTRY * VertexAttrib4NubProc)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); - typedef void (APIENTRY * VertexAttrib4NubvProc)(GLuint index, const GLubyte *v); - typedef void (APIENTRY * VertexAttrib4NuivProc)(GLuint index, const GLuint *v); - typedef void (APIENTRY * VertexAttrib4NusvProc)(GLuint index, const GLushort *v); - typedef void (APIENTRY * VertexAttrib4bvProc)(GLuint index, const GLbyte *v); - typedef void (APIENTRY * VertexAttrib4dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); - typedef void (APIENTRY * VertexAttrib4dvProc)(GLuint index, const GLdouble *v); - typedef void (APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - typedef void (APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); - typedef void (APIENTRY * VertexAttrib4ivProc)(GLuint index, const GLint *v); - typedef void (APIENTRY * VertexAttrib4sProc)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); - typedef void (APIENTRY * VertexAttrib4svProc)(GLuint index, const GLshort *v); - typedef void (APIENTRY * VertexAttrib4ubvProc)(GLuint index, const GLubyte *v); - typedef void (APIENTRY * VertexAttrib4uivProc)(GLuint index, const GLuint *v); - typedef void (APIENTRY * VertexAttrib4usvProc)(GLuint index, const GLushort *v); - typedef void (APIENTRY * VertexAttribPointerProc)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - typedef void (APIENTRY * UniformMatrix2x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * UniformMatrix3x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * UniformMatrix2x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * UniformMatrix4x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * UniformMatrix3x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * UniformMatrix4x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); - typedef void (APIENTRY * ProgramParameteriProc)( GLuint program, GLenum pname, GLint value ); - typedef void (APIENTRY * FramebufferTextureProc)( GLenum target, GLenum attachment, GLuint texture, GLint level ); - typedef void (APIENTRY * FramebufferTextureLayerProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ); - typedef void (APIENTRY * FramebufferTextureFaceProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ); - typedef void (APIENTRY * GetUniformuivProc)( GLuint program, GLint location, GLuint* params ); - typedef void (APIENTRY * BindFragDataLocationProc)( GLuint program, GLuint color, const GLchar* name ); - typedef GLint (APIENTRY * GetFragDataLocationProc)( GLuint program, const GLchar* name ); - typedef void (APIENTRY * Uniform1uiProc)( GLint location, GLuint v0 ); - typedef void (APIENTRY * Uniform2uiProc)( GLint location, GLuint v0, GLuint v1 ); - typedef void (APIENTRY * Uniform3uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2 ); - typedef void (APIENTRY * Uniform4uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ); - typedef void (APIENTRY * Uniform1uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (APIENTRY * Uniform2uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (APIENTRY * Uniform3uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef void (APIENTRY * Uniform4uivProc)( GLint location, GLsizei count, const GLuint *value ); - typedef GLuint (APIENTRY * GetHandleProc) (GLenum pname); + typedef void (GL_APIENTRY * BlendEquationSeparateProc)(GLenum modeRGB, GLenum modeAlpha); + typedef void (GL_APIENTRY * DrawBuffersProc)(GLsizei n, const GLenum *bufs); + typedef void (GL_APIENTRY * StencilOpSeparateProc)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); + typedef void (GL_APIENTRY * StencilFuncSeparateProc)(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); + typedef void (GL_APIENTRY * StencilMaskSeparateProc)(GLenum face, GLuint mask); + typedef void (GL_APIENTRY * AttachShaderProc)(GLuint program, GLuint shader); + typedef void (GL_APIENTRY * BindAttribLocationProc)(GLuint program, GLuint index, const GLchar *name); + typedef void (GL_APIENTRY * CompileShaderProc)(GLuint shader); + typedef GLuint (GL_APIENTRY * CreateProgramProc)(void); + typedef GLuint (GL_APIENTRY * CreateShaderProc)(GLenum type); + typedef void (GL_APIENTRY * DeleteProgramProc)(GLuint program); + typedef void (GL_APIENTRY * DeleteObjectARBProc)(GLuint program); + typedef void (GL_APIENTRY * DeleteShaderProc)(GLuint shader); + typedef void (GL_APIENTRY * DetachShaderProc)(GLuint program, GLuint shader); + typedef void (GL_APIENTRY * DisableVertexAttribArrayProc)(GLuint index); + typedef void (GL_APIENTRY * EnableVertexAttribArrayProc)(GLuint index); + typedef void (GL_APIENTRY * GetActiveAttribProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); + typedef void (GL_APIENTRY * GetActiveUniformProc)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); + typedef void (GL_APIENTRY * GetAttachedShadersProc)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); + typedef GLint (GL_APIENTRY * GetAttribLocationProc)(GLuint program, const GLchar *name); + typedef void (GL_APIENTRY * GetProgramivProc)(GLuint program, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetObjectParameterivARBProc)(GLuint program, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetProgramInfoLogProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + typedef void (GL_APIENTRY * GetInfoLogARBProc)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + typedef void (GL_APIENTRY * GetShaderivProc)(GLuint shader, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetShaderInfoLogProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); + typedef void (GL_APIENTRY * GetShaderSourceProc)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); + typedef GLint (GL_APIENTRY * GetUniformLocationProc)(GLuint program, const GLchar *name); + typedef void (GL_APIENTRY * GetUniformfvProc)(GLuint program, GLint location, GLfloat *params); + typedef void (GL_APIENTRY * GetUniformivProc)(GLuint program, GLint location, GLint *params); + typedef void (GL_APIENTRY * GetVertexAttribdvProc)(GLuint index, GLenum pname, GLdouble *params); + typedef void (GL_APIENTRY * GetVertexAttribfvProc)(GLuint index, GLenum pname, GLfloat *params); + typedef void (GL_APIENTRY * GetVertexAttribivProc)(GLuint index, GLenum pname, GLint *params); + typedef void (GL_APIENTRY * GetVertexAttribPointervProc)(GLuint index, GLenum pname, GLvoid* *pointer); + typedef GLboolean (GL_APIENTRY * IsProgramProc)(GLuint program); + typedef GLboolean (GL_APIENTRY * IsShaderProc)(GLuint shader); + typedef void (GL_APIENTRY * LinkProgramProc)(GLuint program); + typedef void (GL_APIENTRY * ShaderSourceProc)(GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); + typedef void (GL_APIENTRY * UseProgramProc)(GLuint program); + typedef void (GL_APIENTRY * Uniform1fProc)(GLint location, GLfloat v0); + typedef void (GL_APIENTRY * Uniform2fProc)(GLint location, GLfloat v0, GLfloat v1); + typedef void (GL_APIENTRY * Uniform3fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); + typedef void (GL_APIENTRY * Uniform4fProc)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); + typedef void (GL_APIENTRY * Uniform1iProc)(GLint location, GLint v0); + typedef void (GL_APIENTRY * Uniform2iProc)(GLint location, GLint v0, GLint v1); + typedef void (GL_APIENTRY * Uniform3iProc)(GLint location, GLint v0, GLint v1, GLint v2); + typedef void (GL_APIENTRY * Uniform4iProc)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); + typedef void (GL_APIENTRY * Uniform1fvProc)(GLint location, GLsizei count, const GLfloat *value); + typedef void (GL_APIENTRY * Uniform2fvProc)(GLint location, GLsizei count, const GLfloat *value); + typedef void (GL_APIENTRY * Uniform3fvProc)(GLint location, GLsizei count, const GLfloat *value); + typedef void (GL_APIENTRY * Uniform4fvProc)(GLint location, GLsizei count, const GLfloat *value); + typedef void (GL_APIENTRY * Uniform1ivProc)(GLint location, GLsizei count, const GLint *value); + typedef void (GL_APIENTRY * Uniform2ivProc)(GLint location, GLsizei count, const GLint *value); + typedef void (GL_APIENTRY * Uniform3ivProc)(GLint location, GLsizei count, const GLint *value); + typedef void (GL_APIENTRY * Uniform4ivProc)(GLint location, GLsizei count, const GLint *value); + typedef void (GL_APIENTRY * UniformMatrix2fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + typedef void (GL_APIENTRY * UniformMatrix3fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + typedef void (GL_APIENTRY * UniformMatrix4fvProc)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); + typedef void (GL_APIENTRY * ValidateProgramProc)(GLuint program); + typedef void (GL_APIENTRY * VertexAttrib1dProc)(GLuint index, GLdouble x); + typedef void (GL_APIENTRY * VertexAttrib1dvProc)(GLuint index, const GLdouble *v); + typedef void (GL_APIENTRY * VertexAttrib1fProc)(GLuint index, GLfloat x); + typedef void (GL_APIENTRY * VertexAttrib1fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttrib1sProc)(GLuint index, GLshort x); + typedef void (GL_APIENTRY * VertexAttrib1svProc)(GLuint index, const GLshort *v); + typedef void (GL_APIENTRY * VertexAttrib2dProc)(GLuint index, GLdouble x, GLdouble y); + typedef void (GL_APIENTRY * VertexAttrib2dvProc)(GLuint index, const GLdouble *v); + typedef void (GL_APIENTRY * VertexAttrib2fProc)(GLuint index, GLfloat x, GLfloat y); + typedef void (GL_APIENTRY * VertexAttrib2fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttrib2sProc)(GLuint index, GLshort x, GLshort y); + typedef void (GL_APIENTRY * VertexAttrib2svProc)(GLuint index, const GLshort *v); + typedef void (GL_APIENTRY * VertexAttrib3dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z); + typedef void (GL_APIENTRY * VertexAttrib3dvProc)(GLuint index, const GLdouble *v); + typedef void (GL_APIENTRY * VertexAttrib3fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z); + typedef void (GL_APIENTRY * VertexAttrib3fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttrib3sProc)(GLuint index, GLshort x, GLshort y, GLshort z); + typedef void (GL_APIENTRY * VertexAttrib3svProc)(GLuint index, const GLshort *v); + typedef void (GL_APIENTRY * VertexAttrib4NbvProc)(GLuint index, const GLbyte *v); + typedef void (GL_APIENTRY * VertexAttrib4NivProc)(GLuint index, const GLint *v); + typedef void (GL_APIENTRY * VertexAttrib4NsvProc)(GLuint index, const GLshort *v); + typedef void (GL_APIENTRY * VertexAttrib4NubProc)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); + typedef void (GL_APIENTRY * VertexAttrib4NubvProc)(GLuint index, const GLubyte *v); + typedef void (GL_APIENTRY * VertexAttrib4NuivProc)(GLuint index, const GLuint *v); + typedef void (GL_APIENTRY * VertexAttrib4NusvProc)(GLuint index, const GLushort *v); + typedef void (GL_APIENTRY * VertexAttrib4bvProc)(GLuint index, const GLbyte *v); + typedef void (GL_APIENTRY * VertexAttrib4dProc)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); + typedef void (GL_APIENTRY * VertexAttrib4dvProc)(GLuint index, const GLdouble *v); + typedef void (GL_APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + typedef void (GL_APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttrib4ivProc)(GLuint index, const GLint *v); + typedef void (GL_APIENTRY * VertexAttrib4sProc)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); + typedef void (GL_APIENTRY * VertexAttrib4svProc)(GLuint index, const GLshort *v); + typedef void (GL_APIENTRY * VertexAttrib4ubvProc)(GLuint index, const GLubyte *v); + typedef void (GL_APIENTRY * VertexAttrib4uivProc)(GLuint index, const GLuint *v); + typedef void (GL_APIENTRY * VertexAttrib4usvProc)(GLuint index, const GLushort *v); + typedef void (GL_APIENTRY * VertexAttribPointerProc)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + typedef void (GL_APIENTRY * UniformMatrix2x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * UniformMatrix3x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * UniformMatrix2x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * UniformMatrix4x2fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * UniformMatrix3x4fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * UniformMatrix4x3fvProc)( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ); + typedef void (GL_APIENTRY * ProgramParameteriProc)( GLuint program, GLenum pname, GLint value ); + typedef void (GL_APIENTRY * FramebufferTextureProc)( GLenum target, GLenum attachment, GLuint texture, GLint level ); + typedef void (GL_APIENTRY * FramebufferTextureLayerProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ); + typedef void (GL_APIENTRY * FramebufferTextureFaceProc)( GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face ); + typedef void (GL_APIENTRY * GetUniformuivProc)( GLuint program, GLint location, GLuint* params ); + typedef void (GL_APIENTRY * BindFragDataLocationProc)( GLuint program, GLuint color, const GLchar* name ); + typedef GLint (GL_APIENTRY * GetFragDataLocationProc)( GLuint program, const GLchar* name ); + typedef void (GL_APIENTRY * Uniform1uiProc)( GLint location, GLuint v0 ); + typedef void (GL_APIENTRY * Uniform2uiProc)( GLint location, GLuint v0, GLuint v1 ); + typedef void (GL_APIENTRY * Uniform3uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2 ); + typedef void (GL_APIENTRY * Uniform4uiProc)( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ); + typedef void (GL_APIENTRY * Uniform1uivProc)( GLint location, GLsizei count, const GLuint *value ); + typedef void (GL_APIENTRY * Uniform2uivProc)( GLint location, GLsizei count, const GLuint *value ); + typedef void (GL_APIENTRY * Uniform3uivProc)( GLint location, GLsizei count, const GLuint *value ); + typedef void (GL_APIENTRY * Uniform4uivProc)( GLint location, GLsizei count, const GLuint *value ); + typedef GLuint (GL_APIENTRY * GetHandleProc) (GLenum pname); BlendEquationSeparateProc _glBlendEquationSeparate; DrawBuffersProc _glDrawBuffers; diff --git a/include/osg/GLU b/include/osg/GLU index 4f542ac27..0a53531bc 100644 --- a/include/osg/GLU +++ b/include/osg/GLU @@ -28,9 +28,9 @@ #endif #if defined(GLU_TESS_CALLBACK_TRIPLEDOT) - typedef void (APIENTRY *GLU_TESS_CALLBACK)(...); + typedef void (GL_APIENTRY *GLU_TESS_CALLBACK)(...); #else - typedef void (APIENTRY *GLU_TESS_CALLBACK)(); + typedef void (GL_APIENTRY *GLU_TESS_CALLBACK)(); #endif #endif diff --git a/include/osg/Multisample b/include/osg/Multisample index d05bcfc7c..cbbcfb5e1 100644 --- a/include/osg/Multisample +++ b/include/osg/Multisample @@ -121,7 +121,7 @@ class OSG_EXPORT Multisample : public StateAttribute bool _isMultisampleSupported; bool _isMultisampleFilterHintSupported; - typedef void (APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert); + typedef void (GL_APIENTRY * GLSampleCoverageProc) (GLclampf value, GLboolean invert); GLSampleCoverageProc _glSampleCoverage; }; diff --git a/include/osg/Point b/include/osg/Point index 115fdae1a..fd3b1324c 100644 --- a/include/osg/Point +++ b/include/osg/Point @@ -118,9 +118,9 @@ class OSG_EXPORT Point : public StateAttribute bool _isPointParametersSupported; bool _isPointSpriteCoordOriginSupported; - typedef void (APIENTRY * GLPointParameteriProc) (GLenum pname, GLint param); - typedef void (APIENTRY * GLPointParameterfProc) (GLenum pname, GLfloat param); - typedef void (APIENTRY * GLPointParameterfvProc) (GLenum pname, const GLfloat *params); + typedef void (GL_APIENTRY * GLPointParameteriProc) (GLenum pname, GLint param); + typedef void (GL_APIENTRY * GLPointParameterfProc) (GLenum pname, GLfloat param); + typedef void (GL_APIENTRY * GLPointParameterfvProc) (GLenum pname, const GLfloat *params); GLPointParameteriProc _glPointParameteri; GLPointParameterfProc _glPointParameterf; diff --git a/include/osg/State b/include/osg/State index 680080eed..569251ddb 100644 --- a/include/osg/State +++ b/include/osg/State @@ -1660,19 +1660,19 @@ class OSG_EXPORT State : public Referenced, public Observer mutable bool _isVertexBufferObjectSupported; bool computeVertexBufferObjectSupported() const; - typedef void (APIENTRY * ActiveTextureProc) (GLenum texture); - typedef void (APIENTRY * FogCoordPointerProc) (GLenum type, GLsizei stride, const GLvoid *pointer); - typedef void (APIENTRY * SecondaryColorPointerProc) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - typedef void (APIENTRY * MultiTexCoord4fProc) (GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - typedef void (APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - typedef void (APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); - typedef void (APIENTRY * VertexAttribPointerProc) (unsigned int, GLint, GLenum, GLboolean normalized, GLsizei stride, const GLvoid *pointer); - typedef void (APIENTRY * EnableVertexAttribProc) (unsigned int); - typedef void (APIENTRY * DisableVertexAttribProc) (unsigned int); - typedef void (APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); + typedef void (GL_APIENTRY * ActiveTextureProc) (GLenum texture); + typedef void (GL_APIENTRY * FogCoordPointerProc) (GLenum type, GLsizei stride, const GLvoid *pointer); + typedef void (GL_APIENTRY * SecondaryColorPointerProc) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + typedef void (GL_APIENTRY * MultiTexCoord4fProc) (GLenum target, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + typedef void (GL_APIENTRY * VertexAttrib4fProc)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + typedef void (GL_APIENTRY * VertexAttrib4fvProc)(GLuint index, const GLfloat *v); + typedef void (GL_APIENTRY * VertexAttribPointerProc) (unsigned int, GLint, GLenum, GLboolean normalized, GLsizei stride, const GLvoid *pointer); + typedef void (GL_APIENTRY * EnableVertexAttribProc) (unsigned int); + typedef void (GL_APIENTRY * DisableVertexAttribProc) (unsigned int); + typedef void (GL_APIENTRY * BindBufferProc) (GLenum target, GLuint buffer); - typedef void (APIENTRY * DrawArraysInstancedProc)( GLenum mode, GLint first, GLsizei count, GLsizei primcount ); - typedef void (APIENTRY * DrawElementsInstancedProc)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount ); + typedef void (GL_APIENTRY * DrawArraysInstancedProc)( GLenum mode, GLint first, GLsizei count, GLsizei primcount ); + typedef void (GL_APIENTRY * DrawElementsInstancedProc)( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount ); bool _extensionProcsInitialized; GLint _glMaxTextureCoords; diff --git a/include/osg/StencilTwoSided b/include/osg/StencilTwoSided index 5c907c6c8..ef163541d 100644 --- a/include/osg/StencilTwoSided +++ b/include/osg/StencilTwoSided @@ -161,7 +161,7 @@ class OSG_EXPORT StencilTwoSided : public StateAttribute bool _isStencilTwoSidedSupported; - typedef void (APIENTRY * ActiveStencilFaceProc) (GLenum); + typedef void (GL_APIENTRY * ActiveStencilFaceProc) (GLenum); ActiveStencilFaceProc _glActiveStencilFace; }; diff --git a/include/osg/Texture b/include/osg/Texture index 943ab7fd0..be68d03db 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -709,12 +709,12 @@ class OSG_EXPORT Texture : public osg::StateAttribute ~Extensions() {} - typedef void (APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); - typedef void (APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); - typedef void (APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data); - typedef void (APIENTRY * TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); - typedef void (APIENTRY * TexParameterIivProc)(GLenum target, GLenum pname, const GLint* data); - typedef void (APIENTRY * TexParameterIuivProc)(GLenum target, GLenum pname, const GLuint* data); + typedef void (GL_APIENTRY * CompressedTexImage2DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); + typedef void (GL_APIENTRY * CompressedTexSubImage2DArbProc) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); + typedef void (GL_APIENTRY * GetCompressedTexImageArbProc) (GLenum target, GLint level, GLvoid *data); + typedef void (GL_APIENTRY * TexImage2DMultisample)(GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); + typedef void (GL_APIENTRY * TexParameterIivProc)(GLenum target, GLenum pname, const GLint* data); + typedef void (GL_APIENTRY * TexParameterIuivProc)(GLenum target, GLenum pname, const GLuint* data); CompressedTexImage2DArbProc _glCompressedTexImage2D; CompressedTexSubImage2DArbProc _glCompressedTexSubImage2D; diff --git a/include/osg/Texture2DArray b/include/osg/Texture2DArray index 7400c024d..784d7965f 100644 --- a/include/osg/Texture2DArray +++ b/include/osg/Texture2DArray @@ -167,11 +167,11 @@ class OSG_EXPORT Texture2DArray : public Texture GLint _maxLayerCount; GLint _max2DSize; - 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 (GL_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 (GL_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 (GL_APIENTRY * CompressedTexImage3DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + typedef void (GL_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 (GL_APIENTRY * GLCopyTexSubImageProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); GLTexImage3DProc _glTexImage3D; GLTexSubImage3DProc _glTexSubImage3D; diff --git a/include/osg/Texture3D b/include/osg/Texture3D index 02b24a5f7..6da37a32f 100644 --- a/include/osg/Texture3D +++ b/include/osg/Texture3D @@ -180,12 +180,12 @@ class OSG_EXPORT Texture3D : public Texture bool _isTexture3DFast; GLint _maxTexture3DSize; - 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); + typedef void (GL_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 (GL_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 (GL_APIENTRY * CompressedTexImage3DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + typedef void (GL_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 (GL_APIENTRY * GLCopyTexSubImageProc) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + typedef void (GL_APIENTRY * GLUBuild3DMipMapsProc) ( GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *data); GLTexImage3DProc _glTexImage3D; GLTexSubImage3DProc _glTexSubImage3D; diff --git a/include/osg/VertexProgram b/include/osg/VertexProgram index 1b1e9e685..511ce46e7 100644 --- a/include/osg/VertexProgram +++ b/include/osg/VertexProgram @@ -267,11 +267,11 @@ class OSG_EXPORT VertexProgram : public StateAttribute bool _isVertexProgramSupported; - typedef void (APIENTRY * BindProgramProc) (GLenum target, GLuint id); - typedef void (APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); - typedef void (APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); - typedef void (APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); - typedef void (APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); + typedef void (GL_APIENTRY * BindProgramProc) (GLenum target, GLuint id); + typedef void (GL_APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs); + typedef void (GL_APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs); + typedef void (GL_APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string); + typedef void (GL_APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params); BindProgramProc _glBindProgram; GenProgramsProc _glGenPrograms; diff --git a/src/osg/ArrayDispatchers.cpp b/src/osg/ArrayDispatchers.cpp index 5febf7b91..3dffeabd5 100644 --- a/src/osg/ArrayDispatchers.cpp +++ b/src/osg/ArrayDispatchers.cpp @@ -22,16 +22,16 @@ namespace osg { #if defined(OSG_GLES1_AVAILABLE) -inline void APIENTRY glColor4ubv(const GLubyte* c) { glColor4ub(c[0], c[1], c[2], c[3]); } -inline void APIENTRY glColor3fv(const GLfloat* c) { glColor4f(c[0], c[1], c[2], 1.0f); } -inline void APIENTRY glColor4fv(const GLfloat* c) { glColor4f(c[0], c[1], c[2], c[3]); } -inline void APIENTRY glColor3dv(const GLdouble* c) { glColor4f(c[0], c[1], c[2], 1.0f); } -inline void APIENTRY glColor4dv(const GLdouble* c) { glColor4f(c[0], c[1], c[2], c[3]); } +inline void GL_APIENTRY glColor4ubv(const GLubyte* c) { glColor4ub(c[0], c[1], c[2], c[3]); } +inline void GL_APIENTRY glColor3fv(const GLfloat* c) { glColor4f(c[0], c[1], c[2], 1.0f); } +inline void GL_APIENTRY glColor4fv(const GLfloat* c) { glColor4f(c[0], c[1], c[2], c[3]); } +inline void GL_APIENTRY glColor3dv(const GLdouble* c) { glColor4f(c[0], c[1], c[2], 1.0f); } +inline void GL_APIENTRY glColor4dv(const GLdouble* c) { glColor4f(c[0], c[1], c[2], c[3]); } -inline void APIENTRY glNormal3bv(const GLbyte* n) { const float div = 1.0f/128.0f; glNormal3f(float(n[0])*div, float(n[1])*div, float(n[3])*div); } -inline void APIENTRY glNormal3sv(const GLshort* n) { const float div = 1.0f/32768.0f; glNormal3f(float(n[0])*div, float(n[1])*div, float(n[3])*div); } -inline void APIENTRY glNormal3fv(const GLfloat* n) { glNormal3f(n[0], n[1], n[3]); } -inline void APIENTRY glNormal3dv(const GLdouble* n) { glNormal3f(n[0], n[1], n[3]); } +inline void GL_APIENTRY glNormal3bv(const GLbyte* n) { const float div = 1.0f/128.0f; glNormal3f(float(n[0])*div, float(n[1])*div, float(n[3])*div); } +inline void GL_APIENTRY glNormal3sv(const GLshort* n) { const float div = 1.0f/32768.0f; glNormal3f(float(n[0])*div, float(n[1])*div, float(n[3])*div); } +inline void GL_APIENTRY glNormal3fv(const GLfloat* n) { glNormal3f(n[0], n[1], n[3]); } +inline void GL_APIENTRY glNormal3dv(const GLdouble* n) { glNormal3f(n[0], n[1], n[3]); } #endif template @@ -39,7 +39,7 @@ class TemplateAttributeDispatch : public AttributeDispatch { public: - typedef void (APIENTRY * F) (const T*); + typedef void (GL_APIENTRY * F) (const T*); TemplateAttributeDispatch(F functionPtr, unsigned int stride): _functionPtr(functionPtr), _stride(stride), _array(0) {} @@ -64,7 +64,7 @@ class TemplateAttributeWithIndicesDispatch : public AttributeDispatch { public: - typedef void (APIENTRY * F) (const T*); + typedef void (GL_APIENTRY * F) (const T*); TemplateAttributeWithIndicesDispatch(F functionPtr, unsigned int stride): _functionPtr(functionPtr), _stride(stride), _array(0), _indices(0) {} @@ -148,7 +148,7 @@ class TemplateTargetAttributeDispatch : public AttributeDispatch { public: - typedef void (APIENTRY * F) (I, const T*); + typedef void (GL_APIENTRY * F) (I, const T*); TemplateTargetAttributeDispatch(I target, F functionPtr, unsigned int stride): _functionPtr(functionPtr), _target(target), _stride(stride), _array(0) {} @@ -175,7 +175,7 @@ class TemplateTargetAttributeWithIndicesDispatch : public AttributeDispatch { public: - typedef void (APIENTRY * F) (I, const T*); + typedef void (GL_APIENTRY * F) (I, const T*); TemplateTargetAttributeWithIndicesDispatch(I target, F functionPtr, unsigned int stride): _functionPtr(functionPtr), _target(target), _stride(stride), _array(0), _indices(0) {} @@ -265,7 +265,7 @@ public: _glBeginEndAdapter(glBeginEndAdapter) {} template - void assign(Array::Type type, void (APIENTRY *functionPtr) (const T*), unsigned int stride) + void assign(Array::Type type, void (GL_APIENTRY *functionPtr) (const T*), unsigned int stride) { if ((unsigned int)type >= _attributeDispatchList.size()) _attributeDispatchList.resize(type+1); _attributeDispatchList[type] = functionPtr ? new TemplateAttributeDispatch(functionPtr, stride) : 0; @@ -275,7 +275,7 @@ public: } template - void targetAssign(I target, Array::Type type, void (APIENTRY *functionPtr) (I, const T*), unsigned int stride) + void targetAssign(I target, Array::Type type, void (GL_APIENTRY *functionPtr) (I, const T*), unsigned int stride) { if ((unsigned int)type >= _attributeDispatchList.size()) _attributeDispatchList.resize(type+1); _attributeDispatchList[type] = functionPtr ? new TemplateTargetAttributeDispatch(target, functionPtr, stride) : 0; diff --git a/src/osg/Config.in b/src/osg/Config.in index 37dd9c448..d3cdc8416 100644 --- a/src/osg/Config.in +++ b/src/osg/Config.in @@ -38,6 +38,7 @@ #cmakedefine OSG_GL3_AVAILABLE #cmakedefine OSG_GLES1_AVAILABLE #cmakedefine OSG_GLES2_AVAILABLE +#cmakedefine OSG_GL_LIBRARY_STATIC #cmakedefine OSG_GL_DISPLAYLISTS_AVAILABLE #cmakedefine OSG_GL_MATRICES_AVAILABLE #cmakedefine OSG_GL_VERTEX_FUNCS_AVAILABLE diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index 53b0a3d67..72ea24c62 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -100,7 +100,7 @@ bool osg::isGLExtensionOrVersionSupported(unsigned int contextID, const char *ex // Get extensions using new indexed string interface. - typedef const GLubyte * APIENTRY PFNGLGETSTRINGIPROC( GLenum, GLuint ); + typedef const GLubyte * GL_APIENTRY PFNGLGETSTRINGIPROC( GLenum, GLuint ); PFNGLGETSTRINGIPROC* glGetStringi = 0; setGLExtensionFuncPtr( glGetStringi, "glGetStringi"); @@ -342,113 +342,121 @@ std::string& osg::getGLExtensionDisableString() } #endif +#ifdef OSG_GL_LIBRARY_STATIC + void* osg::getGLExtensionFuncPtr(const char *funcName) + { + OSG_NOTICE<<"osg::getGLExtensionFuncPtr("< -#elif defined(__APPLE__) - // The NS*Symbol* stuff found in is deprecated. - // Since 10.3 (Panther) OS X has provided the dlopen/dlsym/dlclose - // family of functions under . Since 10.4 (Tiger), Apple claimed - // the dlfcn family was significantly faster than the NS*Symbol* family. - // Since 'deprecated' needs to be taken very seriously with the - // coming of 10.5 (Leopard), it makes sense to use the dlfcn family when possible. - #include - #if !defined(MAC_OS_X_VERSION_10_3) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3) - #define USE_APPLE_LEGACY_NSSYMBOL - #include +#else + #if defined(WIN32) + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif // WIN32_LEAN_AND_MEAN + #ifndef NOMINMAX + #define NOMINMAX + #endif // NOMINMAX + #include + #elif defined(__APPLE__) + // The NS*Symbol* stuff found in is deprecated. + // Since 10.3 (Panther) OS X has provided the dlopen/dlsym/dlclose + // family of functions under . Since 10.4 (Tiger), Apple claimed + // the dlfcn family was significantly faster than the NS*Symbol* family. + // Since 'deprecated' needs to be taken very seriously with the + // coming of 10.5 (Leopard), it makes sense to use the dlfcn family when possible. + #include + #if !defined(MAC_OS_X_VERSION_10_3) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3) + #define USE_APPLE_LEGACY_NSSYMBOL + #include + #else + #include + #endif #else #include #endif -#else - #include -#endif -void* osg::getGLExtensionFuncPtr(const char *funcName) -{ - // OSG_NOTIFY(osg::NOTICE)<<"osg::getGLExtensionFuncPtr("<(GetProcAddress(hmodule, funcName)); - #elif defined(OSG_GLES1_AVAILABLE) - static HMODULE hmodule = GetModuleHandleA(TEXT("libgles_cm.dll")); - return convertPointerType(GetProcAddress(hmodule, funcName)); - #else - return convertPointerType(wglGetProcAddress(funcName)); - #endif + #if defined(WIN32) -#elif defined(__APPLE__) + #if defined(OSG_GLES2_AVAILABLE) + static HMODULE hmodule = GetModuleHandle(TEXT("libGLESv2.dll")); + return convertPointerType(GetProcAddress(hmodule, funcName)); + #elif defined(OSG_GLES1_AVAILABLE) + static HMODULE hmodule = GetModuleHandleA(TEXT("libgles_cm.dll")); + return convertPointerType(GetProcAddress(hmodule, funcName)); + #else + return convertPointerType(wglGetProcAddress(funcName)); + #endif - #if defined(USE_APPLE_LEGACY_NSSYMBOL) - std::string temp( "_" ); - temp += funcName; // Mac OS X prepends an underscore on function names - if ( NSIsSymbolNameDefined( temp.c_str() ) ) - { - NSSymbol symbol = NSLookupAndBindSymbol( temp.c_str() ); - return NSAddressOfSymbol( symbol ); - } else - return NULL; - #else - // I am uncertain of the correct and ideal usage of dlsym here. - // On the surface, it would seem that the FreeBSD implementation - // would be the ideal one to copy, but ELF and Mach-o are different - // and Apple's man page says the following about using RTLD_DEFAULT: - // "This can be a costly search and should be avoided." - // The documentation mentions nothing about passing in 0 so I must - // assume the behavior is undefined. - // So I could try copying the Sun method which I think all this - // actually originated from. + #elif defined(__APPLE__) + + #if defined(USE_APPLE_LEGACY_NSSYMBOL) + std::string temp( "_" ); + temp += funcName; // Mac OS X prepends an underscore on function names + if ( NSIsSymbolNameDefined( temp.c_str() ) ) + { + NSSymbol symbol = NSLookupAndBindSymbol( temp.c_str() ); + return NSAddressOfSymbol( symbol ); + } else + return NULL; + #else + // I am uncertain of the correct and ideal usage of dlsym here. + // On the surface, it would seem that the FreeBSD implementation + // would be the ideal one to copy, but ELF and Mach-o are different + // and Apple's man page says the following about using RTLD_DEFAULT: + // "This can be a costly search and should be avoided." + // The documentation mentions nothing about passing in 0 so I must + // assume the behavior is undefined. + // So I could try copying the Sun method which I think all this + // actually originated from. + + // return dlsym( RTLD_DEFAULT, funcName ); + static void *handle = dlopen((const char *)0L, RTLD_LAZY); + return dlsym(handle, funcName); + #endif + + #elif defined (__sun) - // return dlsym( RTLD_DEFAULT, funcName ); static void *handle = dlopen((const char *)0L, RTLD_LAZY); return dlsym(handle, funcName); + + #elif defined (__sgi) + + static void *handle = dlopen((const char *)0L, RTLD_LAZY); + return dlsym(handle, funcName); + + #elif defined (__FreeBSD__) + + return dlsym( RTLD_DEFAULT, funcName ); + + #elif defined (__linux__) + + typedef void (*__GLXextFuncPtr)(void); + typedef __GLXextFuncPtr (*GetProcAddressARBProc)(const char*); + + #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) + static GetProcAddressARBProc s_glXGetProcAddressARB = convertPointerType(dlsym(0, "glXGetProcAddressARB")); + if (s_glXGetProcAddressARB) + { + return convertPointerType((s_glXGetProcAddressARB)(funcName)); + } + #endif + + return dlsym(0, funcName); + + #elif defined (__QNX__) + + return dlsym(RTLD_DEFAULT, funcName); + + #else // all other unixes + + return dlsym(0, funcName); + #endif - -#elif defined (__sun) - - static void *handle = dlopen((const char *)0L, RTLD_LAZY); - return dlsym(handle, funcName); - -#elif defined (__sgi) - - static void *handle = dlopen((const char *)0L, RTLD_LAZY); - return dlsym(handle, funcName); - -#elif defined (__FreeBSD__) - - return dlsym( RTLD_DEFAULT, funcName ); - -#elif defined (__linux__) - - typedef void (*__GLXextFuncPtr)(void); - typedef __GLXextFuncPtr (*GetProcAddressARBProc)(const char*); - - #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) - static GetProcAddressARBProc s_glXGetProcAddressARB = convertPointerType(dlsym(0, "glXGetProcAddressARB")); - if (s_glXGetProcAddressARB) - { - return convertPointerType((s_glXGetProcAddressARB)(funcName)); } - #endif - - return dlsym(0, funcName); - -#elif defined (__QNX__) - - return dlsym(RTLD_DEFAULT, funcName); - -#else // all other unixes - - return dlsym(0, funcName); - #endif -} diff --git a/src/osg/Texture1D.cpp b/src/osg/Texture1D.cpp index db3b01069..46ef972bd 100644 --- a/src/osg/Texture1D.cpp +++ b/src/osg/Texture1D.cpp @@ -15,7 +15,7 @@ #include #include -typedef void (APIENTRY * MyCompressedTexImage1DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (GL_APIENTRY * MyCompressedTexImage1DArbProc) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); using namespace osg; diff --git a/src/osgViewer/GraphicsWindowWin32.cpp b/src/osgViewer/GraphicsWindowWin32.cpp index c3bf6930a..ef82227e6 100644 --- a/src/osgViewer/GraphicsWindowWin32.cpp +++ b/src/osgViewer/GraphicsWindowWin32.cpp @@ -2182,7 +2182,7 @@ void GraphicsWindowWin32::setSyncToVBlank( bool on ) // we ought to properly check if the extension is listed as supported rather than just // if the function pointer resolves through wglGetProcAddress, but in practice everything // supports this extension - typedef BOOL (APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); + typedef BOOL (GL_APIENTRY *PFNWGLSWAPINTERVALFARPROC)( int ); PFNWGLSWAPINTERVALFARPROC wglSwapIntervalEXT = 0; wglSwapIntervalEXT = (PFNWGLSWAPINTERVALFARPROC)wglGetProcAddress( "wglSwapIntervalEXT" );