diff --git a/src/osg/GLStaticLibrary.cpp b/src/osg/GLStaticLibrary.cpp index fcbf93c34..539b3fa24 100644 --- a/src/osg/GLStaticLibrary.cpp +++ b/src/osg/GLStaticLibrary.cpp @@ -19,6 +19,7 @@ #include "GLStaticLibrary.h" #include +#include #include #include @@ -34,150 +35,153 @@ typedef std::map GLProcAddressMap; static bool sProcAddressInitialized = false; static GLProcAddressMap sProcAddressMap; +#define ADD_FUNCTION(FunctionName) sProcAddressMap[#FunctionName] = reinterpret_cast(&FunctionName); + void initGLES2ProcAddress() { - sProcAddressMap["glActiveTexture"] = reinterpret_cast(&glActiveTexture); - sProcAddressMap["glAttachShader"] = reinterpret_cast(&glAttachShader); - sProcAddressMap["glBindAttribLocation"] = reinterpret_cast(&glBindAttribLocation); - sProcAddressMap["glBindBuffer"] = reinterpret_cast(&glBindBuffer); - sProcAddressMap["glBindFramebuffer"] = reinterpret_cast(&glBindFramebuffer); - sProcAddressMap["glBindRenderbuffer"] = reinterpret_cast(&glBindRenderbuffer); - sProcAddressMap["glBindTexture"] = reinterpret_cast(&glBindTexture); - sProcAddressMap["glBlendColor"] = reinterpret_cast(&glBlendColor); - sProcAddressMap["glBlendEquation"] = reinterpret_cast(&glBlendEquation); - sProcAddressMap["glBlendEquationSeparate"] = reinterpret_cast(&glBlendEquationSeparate); - sProcAddressMap["glBlendFunc"] = reinterpret_cast(&glBlendFunc); - sProcAddressMap["glBlendFuncSeparate"] = reinterpret_cast(&glBlendFuncSeparate); - sProcAddressMap["glBufferData"] = reinterpret_cast(&glBufferData); - sProcAddressMap["glBufferSubData"] = reinterpret_cast(&glBufferSubData); - sProcAddressMap["glCheckFramebufferStatus"] = reinterpret_cast(&glCheckFramebufferStatus); - sProcAddressMap["glClear"] = reinterpret_cast(&glClear); - sProcAddressMap["glClearColor"] = reinterpret_cast(&glClearColor); - sProcAddressMap["glClearDepthf"] = reinterpret_cast(&glClearDepthf); - sProcAddressMap["glClearStencil"] = reinterpret_cast(&glClearStencil); - sProcAddressMap["glColorMask"] = reinterpret_cast(&glColorMask); - sProcAddressMap["glCompileShader"] = reinterpret_cast(&glCompileShader); - sProcAddressMap["glCompressedTexImage2D"] = reinterpret_cast(&glCompressedTexImage2D); - sProcAddressMap["glCompressedTexSubImage2D"] = reinterpret_cast(&glCompressedTexSubImage2D); - sProcAddressMap["glCopyTexImage2D"] = reinterpret_cast(&glCopyTexImage2D); - sProcAddressMap["glCopyTexSubImage2D"] = reinterpret_cast(&glCopyTexSubImage2D); - sProcAddressMap["glCreateProgram"] = reinterpret_cast(&glCreateProgram); - sProcAddressMap["glCreateShader"] = reinterpret_cast(&glCreateShader); - sProcAddressMap["glCullFace"] = reinterpret_cast(&glCullFace); - sProcAddressMap["glDeleteBuffers"] = reinterpret_cast(&glDeleteBuffers); - sProcAddressMap["glDeleteFramebuffers"] = reinterpret_cast(&glDeleteFramebuffers); - sProcAddressMap["glDeleteProgram"] = reinterpret_cast(&glDeleteProgram); - sProcAddressMap["glDeleteRenderbuffers"] = reinterpret_cast(&glDeleteRenderbuffers); - sProcAddressMap["glDeleteShader"] = reinterpret_cast(&glDeleteShader); - sProcAddressMap["glDeleteTextures"] = reinterpret_cast(&glDeleteTextures); - sProcAddressMap["glDepthFunc"] = reinterpret_cast(&glDepthFunc); - sProcAddressMap["glDepthMask"] = reinterpret_cast(&glDepthMask); - sProcAddressMap["glDepthRangef"] = reinterpret_cast(&glDepthRangef); - sProcAddressMap["glDetachShader"] = reinterpret_cast(&glDetachShader); - sProcAddressMap["glDisable"] = reinterpret_cast(&glDisable); - sProcAddressMap["glDisableVertexAttribArray"] = reinterpret_cast(&glDisableVertexAttribArray); - sProcAddressMap["glDrawArrays"] = reinterpret_cast(&glDrawArrays); - sProcAddressMap["glDrawElements"] = reinterpret_cast(&glDrawElements); - sProcAddressMap["glEnable"] = reinterpret_cast(&glEnable); - sProcAddressMap["glEnableVertexAttribArray"] = reinterpret_cast(&glEnableVertexAttribArray); - sProcAddressMap["glFinish"] = reinterpret_cast(&glFinish); - sProcAddressMap["glFlush"] = reinterpret_cast(&glFlush); - sProcAddressMap["glFramebufferRenderbuffer"] = reinterpret_cast(&glFramebufferRenderbuffer); - sProcAddressMap["glFramebufferTexture2D"] = reinterpret_cast(&glFramebufferTexture2D); - sProcAddressMap["glFrontFace"] = reinterpret_cast(&glFrontFace); - sProcAddressMap["glGenBuffers"] = reinterpret_cast(&glGenBuffers); - sProcAddressMap["glGenerateMipmap"] = reinterpret_cast(&glGenerateMipmap); - sProcAddressMap["glGenFramebuffers"] = reinterpret_cast(&glGenFramebuffers); - sProcAddressMap["glGenRenderbuffers"] = reinterpret_cast(&glGenRenderbuffers); - sProcAddressMap["glGenTextures"] = reinterpret_cast(&glGenTextures); - sProcAddressMap["glGetActiveAttrib"] = reinterpret_cast(&glGetActiveAttrib); - sProcAddressMap["glGetActiveUniform"] = reinterpret_cast(&glGetActiveUniform); - sProcAddressMap["glGetAttachedShaders"] = reinterpret_cast(&glGetAttachedShaders); - sProcAddressMap["glGetAttribLocation"] = reinterpret_cast(&glGetAttribLocation); - sProcAddressMap["glGetBooleanv"] = reinterpret_cast(&glGetBooleanv); - sProcAddressMap["glGetBufferParameteriv"] = reinterpret_cast(&glGetBufferParameteriv); - sProcAddressMap["glGetError"] = reinterpret_cast(&glGetError); - sProcAddressMap["glGetFloatv"] = reinterpret_cast(&glGetFloatv); - sProcAddressMap["glGetFramebufferAttachmentParameteriv"] = reinterpret_cast(&glGetFramebufferAttachmentParameteriv); - sProcAddressMap["glGetIntegerv"] = reinterpret_cast(&glGetIntegerv); - sProcAddressMap["glGetProgramiv"] = reinterpret_cast(&glGetProgramiv); - sProcAddressMap["glGetProgramInfoLog"] = reinterpret_cast(&glGetProgramInfoLog); - sProcAddressMap["glGetRenderbufferParameteriv"] = reinterpret_cast(&glGetRenderbufferParameteriv); - sProcAddressMap["glGetShaderiv"] = reinterpret_cast(&glGetShaderiv); - sProcAddressMap["glGetShaderInfoLog"] = reinterpret_cast(&glGetShaderInfoLog); - sProcAddressMap["glGetShaderPrecisionFormat"] = reinterpret_cast(&glGetShaderPrecisionFormat); - sProcAddressMap["glGetShaderSource"] = reinterpret_cast(&glGetShaderSource); - sProcAddressMap["glGetString"] = reinterpret_cast(&glGetString); - sProcAddressMap["glGetTexParameterfv"] = reinterpret_cast(&glGetTexParameterfv); - sProcAddressMap["glGetTexParameteriv"] = reinterpret_cast(&glGetTexParameteriv); - sProcAddressMap["glGetUniformfv"] = reinterpret_cast(&glGetUniformfv); - sProcAddressMap["glGetUniformiv"] = reinterpret_cast(&glGetUniformiv); - sProcAddressMap["glGetUniformLocation"] = reinterpret_cast(&glGetUniformLocation); - sProcAddressMap["glGetVertexAttribfv"] = reinterpret_cast(&glGetVertexAttribfv); - sProcAddressMap["glGetVertexAttribiv"] = reinterpret_cast(&glGetVertexAttribiv); - sProcAddressMap["glGetVertexAttribPointerv"] = reinterpret_cast(&glGetVertexAttribPointerv); - sProcAddressMap["glHint"] = reinterpret_cast(&glHint); - sProcAddressMap["glIsBuffer"] = reinterpret_cast(&glIsBuffer); - sProcAddressMap["glIsEnabled"] = reinterpret_cast(&glIsEnabled); - sProcAddressMap["glIsFramebuffer"] = reinterpret_cast(&glIsFramebuffer); - sProcAddressMap["glIsProgram"] = reinterpret_cast(&glIsProgram); - sProcAddressMap["glIsRenderbuffer"] = reinterpret_cast(&glIsRenderbuffer); - sProcAddressMap["glIsShader"] = reinterpret_cast(&glIsShader); - sProcAddressMap["glIsTexture"] = reinterpret_cast(&glIsTexture); - sProcAddressMap["glLineWidth"] = reinterpret_cast(&glLineWidth); - sProcAddressMap["glLinkProgram"] = reinterpret_cast(&glLinkProgram); - sProcAddressMap["glPixelStorei"] = reinterpret_cast(&glPixelStorei); - sProcAddressMap["glPolygonOffset"] = reinterpret_cast(&glPolygonOffset); - sProcAddressMap["glReadPixels"] = reinterpret_cast(&glReadPixels); - sProcAddressMap["glReleaseShaderCompiler"] = reinterpret_cast(&glReleaseShaderCompiler); - sProcAddressMap["glRenderbufferStorage"] = reinterpret_cast(&glRenderbufferStorage); - sProcAddressMap["glSampleCoverage"] = reinterpret_cast(&glSampleCoverage); - sProcAddressMap["glScissor"] = reinterpret_cast(&glScissor); - sProcAddressMap["glShaderBinary"] = reinterpret_cast(&glShaderBinary); - sProcAddressMap["glShaderSource"] = reinterpret_cast(&glShaderSource); - sProcAddressMap["glStencilFunc"] = reinterpret_cast(&glStencilFunc); - sProcAddressMap["glStencilFuncSeparate"] = reinterpret_cast(&glStencilFuncSeparate); - sProcAddressMap["glStencilMask"] = reinterpret_cast(&glStencilMask); - sProcAddressMap["glStencilMaskSeparate"] = reinterpret_cast(&glStencilMaskSeparate); - sProcAddressMap["glStencilOp"] = reinterpret_cast(&glStencilOp); - sProcAddressMap["glStencilOpSeparate"] = reinterpret_cast(&glStencilOpSeparate); - sProcAddressMap["glTexImage2D"] = reinterpret_cast(&glTexImage2D); - sProcAddressMap["glTexParameterf"] = reinterpret_cast(&glTexParameterf); - sProcAddressMap["glTexParameterfv"] = reinterpret_cast(&glTexParameterfv); - sProcAddressMap["glTexParameteri"] = reinterpret_cast(&glTexParameteri); - sProcAddressMap["glTexParameteriv"] = reinterpret_cast(&glTexParameteriv); - sProcAddressMap["glTexSubImage2D"] = reinterpret_cast(&glTexSubImage2D); - sProcAddressMap["glUniform1f"] = reinterpret_cast(&glUniform1f); - sProcAddressMap["glUniform1fv"] = reinterpret_cast(&glUniform1fv); - sProcAddressMap["glUniform1i"] = reinterpret_cast(&glUniform1i); - sProcAddressMap["glUniform1iv"] = reinterpret_cast(&glUniform1iv); - sProcAddressMap["glUniform2f"] = reinterpret_cast(&glUniform2f); - sProcAddressMap["glUniform2fv"] = reinterpret_cast(&glUniform2fv); - sProcAddressMap["glUniform2i"] = reinterpret_cast(&glUniform2i); - sProcAddressMap["glUniform2iv"] = reinterpret_cast(&glUniform2iv); - sProcAddressMap["glUniform3f"] = reinterpret_cast(&glUniform3f); - sProcAddressMap["glUniform3fv"] = reinterpret_cast(&glUniform3fv); - sProcAddressMap["glUniform3i"] = reinterpret_cast(&glUniform3i); - sProcAddressMap["glUniform3iv"] = reinterpret_cast(&glUniform3iv); - sProcAddressMap["glUniform4f"] = reinterpret_cast(&glUniform4f); - sProcAddressMap["glUniform4fv"] = reinterpret_cast(&glUniform4fv); - sProcAddressMap["glUniform4i"] = reinterpret_cast(&glUniform4i); - sProcAddressMap["glUniform4iv"] = reinterpret_cast(&glUniform4iv); - sProcAddressMap["glUniformMatrix2fv"] = reinterpret_cast(&glUniformMatrix2fv); - sProcAddressMap["glUniformMatrix3fv"] = reinterpret_cast(&glUniformMatrix3fv); - sProcAddressMap["glUniformMatrix4fv"] = reinterpret_cast(&glUniformMatrix4fv); - sProcAddressMap["glUseProgram"] = reinterpret_cast(&glUseProgram); - sProcAddressMap["glValidateProgram"] = reinterpret_cast(&glValidateProgram); - sProcAddressMap["glVertexAttrib1f"] = reinterpret_cast(&glVertexAttrib1f); - sProcAddressMap["glVertexAttrib1fv"] = reinterpret_cast(&glVertexAttrib1fv); - sProcAddressMap["glVertexAttrib2f"] = reinterpret_cast(&glVertexAttrib2f); - sProcAddressMap["glVertexAttrib2fv"] = reinterpret_cast(&glVertexAttrib2fv); - sProcAddressMap["glVertexAttrib3f"] = reinterpret_cast(&glVertexAttrib3f); - sProcAddressMap["glVertexAttrib3fv"] = reinterpret_cast(&glVertexAttrib3fv); - sProcAddressMap["glVertexAttrib4f"] = reinterpret_cast(&glVertexAttrib4f); - sProcAddressMap["glVertexAttrib4fv"] = reinterpret_cast(&glVertexAttrib4fv); - sProcAddressMap["glVertexAttribPointer"] = reinterpret_cast(&glVertexAttribPointer); - sProcAddressMap["glViewport"] = reinterpret_cast(&glViewport); + ADD_FUNCTION(glActiveTexture) + ADD_FUNCTION(glAttachShader) + ADD_FUNCTION(glBindAttribLocation) + ADD_FUNCTION(glBindBuffer) + ADD_FUNCTION(glBindFramebuffer) + ADD_FUNCTION(glBindRenderbuffer) + ADD_FUNCTION(glBindTexture) + ADD_FUNCTION(glBlendColor) + ADD_FUNCTION(glBlendEquation) + ADD_FUNCTION(glBlendEquationSeparate) + ADD_FUNCTION(glBlendFunc) + ADD_FUNCTION(glBlendFuncSeparate) + ADD_FUNCTION(glBufferData) + ADD_FUNCTION(glBufferSubData) + ADD_FUNCTION(glCheckFramebufferStatus) + ADD_FUNCTION(glClear) + ADD_FUNCTION(glClearColor) + ADD_FUNCTION(glClearDepthf) + ADD_FUNCTION(glClearStencil) + ADD_FUNCTION(glColorMask) + ADD_FUNCTION(glCompileShader) + ADD_FUNCTION(glCompressedTexImage2D) + ADD_FUNCTION(glCompressedTexSubImage2D) + ADD_FUNCTION(glCopyTexImage2D) + ADD_FUNCTION(glCopyTexSubImage2D) + ADD_FUNCTION(glCreateProgram) + ADD_FUNCTION(glCreateShader) + ADD_FUNCTION(glCullFace) + ADD_FUNCTION(glDeleteBuffers) + ADD_FUNCTION(glDeleteFramebuffers) + ADD_FUNCTION(glDeleteProgram) + ADD_FUNCTION(glDeleteRenderbuffers) + ADD_FUNCTION(glDeleteShader) + ADD_FUNCTION(glDeleteTextures) + ADD_FUNCTION(glDepthFunc) + ADD_FUNCTION(glDepthMask) + + ADD_FUNCTION(glDepthRangef) + ADD_FUNCTION(glDetachShader) + ADD_FUNCTION(glDisable) + ADD_FUNCTION(glDisableVertexAttribArray) + ADD_FUNCTION(glDrawArrays) + ADD_FUNCTION(glDrawElements) + ADD_FUNCTION(glEnable) + ADD_FUNCTION(glEnableVertexAttribArray) + ADD_FUNCTION(glFinish) + ADD_FUNCTION(glFlush) + ADD_FUNCTION(glFramebufferRenderbuffer) + ADD_FUNCTION(glFramebufferTexture2D) + ADD_FUNCTION(glFrontFace) + ADD_FUNCTION(glGenBuffers) + ADD_FUNCTION(glGenerateMipmap) + ADD_FUNCTION(glGenFramebuffers) + ADD_FUNCTION(glGenRenderbuffers) + ADD_FUNCTION(glGenTextures) + ADD_FUNCTION(glGetActiveAttrib) + ADD_FUNCTION(glGetActiveUniform) + ADD_FUNCTION(glGetAttachedShaders) + ADD_FUNCTION(glGetAttribLocation) + ADD_FUNCTION(glGetBooleanv) + ADD_FUNCTION(glGetBufferParameteriv) + ADD_FUNCTION(glGetError) + ADD_FUNCTION(glGetFloatv) + ADD_FUNCTION(glGetFramebufferAttachmentParameteriv) + ADD_FUNCTION(glGetIntegerv) + ADD_FUNCTION(glGetProgramiv) + ADD_FUNCTION(glGetProgramInfoLog) + ADD_FUNCTION(glGetRenderbufferParameteriv) + ADD_FUNCTION(glGetShaderiv) + ADD_FUNCTION(glGetShaderInfoLog) + ADD_FUNCTION(glGetShaderPrecisionFormat) + ADD_FUNCTION(glGetShaderSource) + ADD_FUNCTION(glGetString) + ADD_FUNCTION(glGetTexParameterfv) + ADD_FUNCTION(glGetTexParameteriv) + ADD_FUNCTION(glGetUniformfv) + ADD_FUNCTION(glGetUniformiv) + ADD_FUNCTION(glGetUniformLocation) + ADD_FUNCTION(glGetVertexAttribfv) + ADD_FUNCTION(glGetVertexAttribiv) + ADD_FUNCTION(glGetVertexAttribPointerv) + ADD_FUNCTION(glHint) + ADD_FUNCTION(glIsBuffer) + ADD_FUNCTION(glIsEnabled) + ADD_FUNCTION(glIsFramebuffer) + ADD_FUNCTION(glIsProgram) + ADD_FUNCTION(glIsRenderbuffer) + ADD_FUNCTION(glIsShader) + ADD_FUNCTION(glIsTexture) + ADD_FUNCTION(glLineWidth) + ADD_FUNCTION(glLinkProgram) + ADD_FUNCTION(glPixelStorei) + ADD_FUNCTION(glPolygonOffset) + ADD_FUNCTION(glReadPixels) + ADD_FUNCTION(glReleaseShaderCompiler) + ADD_FUNCTION(glRenderbufferStorage) + ADD_FUNCTION(glSampleCoverage) + ADD_FUNCTION(glScissor) + ADD_FUNCTION(glShaderBinary) + ADD_FUNCTION(glShaderSource) + ADD_FUNCTION(glStencilFunc) + ADD_FUNCTION(glStencilFuncSeparate) + ADD_FUNCTION(glStencilMask) + ADD_FUNCTION(glStencilMaskSeparate) + ADD_FUNCTION(glStencilOp) + ADD_FUNCTION(glStencilOpSeparate) + ADD_FUNCTION(glTexImage2D) + ADD_FUNCTION(glTexParameterf) + ADD_FUNCTION(glTexParameterfv) + ADD_FUNCTION(glTexParameteri) + ADD_FUNCTION(glTexParameteriv) + ADD_FUNCTION(glTexSubImage2D) + ADD_FUNCTION(glUniform1f) + ADD_FUNCTION(glUniform1fv) + ADD_FUNCTION(glUniform1i) + ADD_FUNCTION(glUniform1iv) + ADD_FUNCTION(glUniform2f) + ADD_FUNCTION(glUniform2fv) + ADD_FUNCTION(glUniform2i) + ADD_FUNCTION(glUniform2iv) + ADD_FUNCTION(glUniform3f) + ADD_FUNCTION(glUniform3fv) + ADD_FUNCTION(glUniform3i) + ADD_FUNCTION(glUniform3iv) + ADD_FUNCTION(glUniform4f) + ADD_FUNCTION(glUniform4fv) + ADD_FUNCTION(glUniform4i) + ADD_FUNCTION(glUniform4iv) + ADD_FUNCTION(glUniformMatrix2fv) + ADD_FUNCTION(glUniformMatrix3fv) + ADD_FUNCTION(glUniformMatrix4fv) + ADD_FUNCTION(glUseProgram) + ADD_FUNCTION(glValidateProgram) + ADD_FUNCTION(glVertexAttrib1f) + ADD_FUNCTION(glVertexAttrib1fv) + ADD_FUNCTION(glVertexAttrib2f) + ADD_FUNCTION(glVertexAttrib2fv) + ADD_FUNCTION(glVertexAttrib3f) + ADD_FUNCTION(glVertexAttrib3fv) + ADD_FUNCTION(glVertexAttrib4f) + ADD_FUNCTION(glVertexAttrib4fv) + ADD_FUNCTION(glVertexAttribPointer) + ADD_FUNCTION(glViewport) } void initProcAddress()