From efe52842fad255d453a7f5979e87950f0e5a9d7a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 3 Jun 2013 09:19:46 +0000 Subject: [PATCH] From Aurelien Albert, "This submission is made against trunk version and add the loading of "glVertexAttribDivisor" extension." --- include/osg/GL2Extensions | 3 +++ src/osg/GL2Extensions.cpp | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index ea4d3c4fb..2c59feee0 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -637,6 +637,7 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced void glVertexAttrib4uiv(GLuint index, const GLuint *v) const; void glVertexAttrib4usv(GLuint index, const GLushort *v) const; void glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer) const; + void glVertexAttribDivisor(GLuint index, GLuint divisor) const; // C++-friendly convenience wrapper methods GLuint getCurrentProgram() const; @@ -828,6 +829,7 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced 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 * VertexAttribDivisorProc)(GLuint index, GLuint divisor); 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 ); @@ -974,6 +976,7 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced VertexAttrib4uivProc _glVertexAttrib4uiv; VertexAttrib4usvProc _glVertexAttrib4usv; VertexAttribPointerProc _glVertexAttribPointer; + VertexAttribDivisorProc _glVertexAttribDivisor; GetInfoLogARBProc _glGetInfoLogARB; GetObjectParameterivARBProc _glGetObjectParameterivARB; diff --git a/src/osg/GL2Extensions.cpp b/src/osg/GL2Extensions.cpp index 0143b19ea..c3ee2fd71 100644 --- a/src/osg/GL2Extensions.cpp +++ b/src/osg/GL2Extensions.cpp @@ -147,6 +147,7 @@ GL2Extensions::GL2Extensions(const GL2Extensions& rhs) : osg::Referenced() _glVertexAttrib4uiv = rhs._glVertexAttrib4uiv; _glVertexAttrib4usv = rhs._glVertexAttrib4usv; _glVertexAttribPointer = rhs._glVertexAttribPointer; + _glVertexAttribDivisor = rhs._glVertexAttribDivisor; _glGetInfoLogARB = rhs._glGetInfoLogARB; _glGetObjectParameterivARB = rhs._glGetObjectParameterivARB; @@ -331,6 +332,7 @@ void GL2Extensions::lowestCommonDenominator(const GL2Extensions& rhs) if (!rhs._glVertexAttrib4uiv) _glVertexAttrib4uiv = 0; if (!rhs._glVertexAttrib4usv) _glVertexAttrib4usv = 0; if (!rhs._glVertexAttribPointer) _glVertexAttribPointer = 0; + if (!rhs._glVertexAttribDivisor) _glVertexAttribDivisor = 0; if (!rhs._glGetInfoLogARB) _glGetInfoLogARB = 0; if (!rhs._glGetObjectParameterivARB) _glGetObjectParameterivARB = 0; @@ -523,6 +525,7 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID) _glVertexAttrib4uiv= 0; _glVertexAttrib4usv= 0; _glVertexAttribPointer= 0; + _glVertexAttribDivisor= 0; _glGetInfoLogARB= 0; _glGetObjectParameterivARB= 0; @@ -732,6 +735,7 @@ void GL2Extensions::setupGL2Extensions(unsigned int contextID) setGLExtensionFuncPtr(_glVertexAttrib4uiv, "glVertexAttrib4uiv"); setGLExtensionFuncPtr(_glVertexAttrib4usv, "glVertexAttrib4usv"); setGLExtensionFuncPtr(_glVertexAttribPointer, "glVertexAttribPointer"); + setGLExtensionFuncPtr(_glVertexAttribDivisor, "glVertexAttribDivisor"); // v1.5-only ARB entry points, in case they're needed for fallback setGLExtensionFuncPtr(_glGetInfoLogARB, "glGetInfoLogARB"); @@ -2165,6 +2169,17 @@ void GL2Extensions::glVertexAttribPointer(GLuint index, GLint size, GLenum type, } } +void GL2Extensions::glVertexAttribDivisor(GLuint index, GLuint divisor) const +{ + if (_glVertexAttribDivisor) + { + _glVertexAttribDivisor(index, divisor); + } + else + { + NotSupported( "glVertexAttribDivisor" ); + } +} void GL2Extensions::glUniformMatrix2x3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value ) const {