From 398a556df2b3e442a3f9cb2b4516cc6e5c6cca3a Mon Sep 17 00:00:00 2001 From: vlj Date: Mon, 29 Sep 2014 01:50:33 +0200 Subject: [PATCH] Use glVertexAttribDivisorARB If GL 3.1 is supported but not 3.3, use glVertexAttribDivisorARB instead of glVertexAttribDivisor --- src/graphics/gpuparticles.cpp | 10 +++++----- src/graphics/shaders.cpp | 8 ++++---- src/graphics/vaomanager.cpp | 20 ++++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/graphics/gpuparticles.cpp b/src/graphics/gpuparticles.cpp index 063ec713d..e51f81736 100644 --- a/src/graphics/gpuparticles.cpp +++ b/src/graphics/gpuparticles.cpp @@ -266,13 +266,13 @@ void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer) glBindBuffer(GL_ARRAY_BUFFER, PositionBuffer); glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleData), 0); - glVertexAttribDivisor(0, 1); + glVertexAttribDivisorARB(0, 1); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(3 * sizeof(float))); - glVertexAttribDivisor(1, 1); + glVertexAttribDivisorARB(1, 1); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(7 * sizeof(float))); - glVertexAttribDivisor(2, 1); + glVertexAttribDivisorARB(2, 1); } void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer) @@ -281,11 +281,11 @@ void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer) glEnableVertexAttribArray(5); glVertexAttribPointer(5, 3, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); - glVertexAttribDivisor(5, 1); + glVertexAttribDivisorARB(5, 1); glEnableVertexAttribArray(6); glVertexAttribPointer(6, 1, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid *)(3 * sizeof(float))); - glVertexAttribDivisor(6, 1); + glVertexAttribDivisorARB(6, 1); } void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initialValues_vbo) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index 66cb91bdd..d18c1900a 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -1321,10 +1321,10 @@ namespace LightShader glEnableVertexAttribArray(attrib_Radius); glVertexAttribPointer(attrib_Radius, 1, GL_FLOAT, GL_FALSE, sizeof(PointLightInfo), (GLvoid*)(7 * sizeof(float))); - glVertexAttribDivisor(attrib_Position, 1); - glVertexAttribDivisor(attrib_Energy, 1); - glVertexAttribDivisor(attrib_Color, 1); - glVertexAttribDivisor(attrib_Radius, 1); + glVertexAttribDivisorARB(attrib_Position, 1); + glVertexAttribDivisorARB(attrib_Energy, 1); + glVertexAttribDivisorARB(attrib_Color, 1); + glVertexAttribDivisorARB(attrib_Radius, 1); } } diff --git a/src/graphics/vaomanager.cpp b/src/graphics/vaomanager.cpp index 2f8ea99dd..9cc094934 100644 --- a/src/graphics/vaomanager.cpp +++ b/src/graphics/vaomanager.cpp @@ -188,13 +188,13 @@ struct VAOInstanceUtil { glEnableVertexAttribArray(7); glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, sizeof(T), 0); - glVertexAttribDivisor(7, 1); + glVertexAttribDivisorARB(7, 1); glEnableVertexAttribArray(8); glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(3 * sizeof(float))); - glVertexAttribDivisor(8, 1); + glVertexAttribDivisorARB(8, 1); glEnableVertexAttribArray(9); glVertexAttribPointer(9, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(6 * sizeof(float))); - glVertexAttribDivisor(9, 1); + glVertexAttribDivisorARB(9, 1); } static void SetVertexAttrib(); @@ -206,7 +206,7 @@ void VAOInstanceUtil::SetVertexAttrib() SetVertexAttrib_impl(); glEnableVertexAttribArray(10); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataSingleTex), (GLvoid*)(9 * sizeof(float))); - glVertexAttribDivisor(10, 1); + glVertexAttribDivisorARB(10, 1); } template<> @@ -215,10 +215,10 @@ void VAOInstanceUtil::SetVertexAttrib() SetVertexAttrib_impl(); glEnableVertexAttribArray(10); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float))); - glVertexAttribDivisor(10, 1); + glVertexAttribDivisorARB(10, 1); glEnableVertexAttribArray(11); glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned))); - glVertexAttribDivisor(11, 1); + glVertexAttribDivisorARB(11, 1); } template<> @@ -227,13 +227,13 @@ void VAOInstanceUtil::SetVertexAttrib() SetVertexAttrib_impl(); glEnableVertexAttribArray(10); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float))); - glVertexAttribDivisor(10, 1); + glVertexAttribDivisorARB(10, 1); glEnableVertexAttribArray(11); glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned))); - glVertexAttribDivisor(11, 1); + glVertexAttribDivisorARB(11, 1); glEnableVertexAttribArray(13); glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 4 * sizeof(unsigned))); - glVertexAttribDivisor(13, 1); + glVertexAttribDivisorARB(13, 1); } template<> @@ -242,7 +242,7 @@ void VAOInstanceUtil::SetVertexAttrib() SetVertexAttrib_impl(); glEnableVertexAttribArray(12); glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GlowInstanceData), (GLvoid*)(9 * sizeof(float))); - glVertexAttribDivisor(12, 1); + glVertexAttribDivisorARB(12, 1); }