Use glVertexAttribDivisorARB

If GL 3.1 is supported but not 3.3, use glVertexAttribDivisorARB instead
of glVertexAttribDivisor
This commit is contained in:
vlj 2014-09-29 01:50:33 +02:00
parent e2da98bcfb
commit 398a556df2
3 changed files with 19 additions and 19 deletions

View File

@ -266,13 +266,13 @@ void ParticleSystemProxy::CommonRenderingVAO(GLuint PositionBuffer)
glBindBuffer(GL_ARRAY_BUFFER, PositionBuffer); glBindBuffer(GL_ARRAY_BUFFER, PositionBuffer);
glEnableVertexAttribArray(0); glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleData), 0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(ParticleData), 0);
glVertexAttribDivisor(0, 1); glVertexAttribDivisorARB(0, 1);
glEnableVertexAttribArray(1); glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(3 * sizeof(float))); glVertexAttribPointer(1, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(3 * sizeof(float)));
glVertexAttribDivisor(1, 1); glVertexAttribDivisorARB(1, 1);
glEnableVertexAttribArray(2); glEnableVertexAttribArray(2);
glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(7 * sizeof(float))); glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, sizeof(ParticleData), (GLvoid *)(7 * sizeof(float)));
glVertexAttribDivisor(2, 1); glVertexAttribDivisorARB(2, 1);
} }
void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer) void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer)
@ -281,11 +281,11 @@ void ParticleSystemProxy::AppendQuaternionRenderingVAO(GLuint QuaternionBuffer)
glEnableVertexAttribArray(5); glEnableVertexAttribArray(5);
glVertexAttribPointer(5, 3, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0); glVertexAttribPointer(5, 3, GL_FLOAT, GL_FALSE, 4 * sizeof(float), 0);
glVertexAttribDivisor(5, 1); glVertexAttribDivisorARB(5, 1);
glEnableVertexAttribArray(6); glEnableVertexAttribArray(6);
glVertexAttribPointer(6, 1, GL_FLOAT, GL_FALSE, 4 * sizeof(float), (GLvoid *)(3 * sizeof(float))); 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) void ParticleSystemProxy::CommonSimulationVAO(GLuint position_vbo, GLuint initialValues_vbo)

View File

@ -1321,10 +1321,10 @@ namespace LightShader
glEnableVertexAttribArray(attrib_Radius); glEnableVertexAttribArray(attrib_Radius);
glVertexAttribPointer(attrib_Radius, 1, GL_FLOAT, GL_FALSE, sizeof(PointLightInfo), (GLvoid*)(7 * sizeof(float))); glVertexAttribPointer(attrib_Radius, 1, GL_FLOAT, GL_FALSE, sizeof(PointLightInfo), (GLvoid*)(7 * sizeof(float)));
glVertexAttribDivisor(attrib_Position, 1); glVertexAttribDivisorARB(attrib_Position, 1);
glVertexAttribDivisor(attrib_Energy, 1); glVertexAttribDivisorARB(attrib_Energy, 1);
glVertexAttribDivisor(attrib_Color, 1); glVertexAttribDivisorARB(attrib_Color, 1);
glVertexAttribDivisor(attrib_Radius, 1); glVertexAttribDivisorARB(attrib_Radius, 1);
} }
} }

View File

@ -188,13 +188,13 @@ struct VAOInstanceUtil
{ {
glEnableVertexAttribArray(7); glEnableVertexAttribArray(7);
glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, sizeof(T), 0); glVertexAttribPointer(7, 3, GL_FLOAT, GL_FALSE, sizeof(T), 0);
glVertexAttribDivisor(7, 1); glVertexAttribDivisorARB(7, 1);
glEnableVertexAttribArray(8); glEnableVertexAttribArray(8);
glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(3 * sizeof(float))); glVertexAttribPointer(8, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(3 * sizeof(float)));
glVertexAttribDivisor(8, 1); glVertexAttribDivisorARB(8, 1);
glEnableVertexAttribArray(9); glEnableVertexAttribArray(9);
glVertexAttribPointer(9, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(6 * sizeof(float))); glVertexAttribPointer(9, 3, GL_FLOAT, GL_FALSE, sizeof(T), (GLvoid*)(6 * sizeof(float)));
glVertexAttribDivisor(9, 1); glVertexAttribDivisorARB(9, 1);
} }
static void SetVertexAttrib(); static void SetVertexAttrib();
@ -206,7 +206,7 @@ void VAOInstanceUtil<InstanceDataSingleTex>::SetVertexAttrib()
SetVertexAttrib_impl(); SetVertexAttrib_impl();
glEnableVertexAttribArray(10); glEnableVertexAttribArray(10);
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataSingleTex), (GLvoid*)(9 * sizeof(float))); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataSingleTex), (GLvoid*)(9 * sizeof(float)));
glVertexAttribDivisor(10, 1); glVertexAttribDivisorARB(10, 1);
} }
template<> template<>
@ -215,10 +215,10 @@ void VAOInstanceUtil<InstanceDataDualTex>::SetVertexAttrib()
SetVertexAttrib_impl(); SetVertexAttrib_impl();
glEnableVertexAttribArray(10); glEnableVertexAttribArray(10);
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float))); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float)));
glVertexAttribDivisor(10, 1); glVertexAttribDivisorARB(10, 1);
glEnableVertexAttribArray(11); glEnableVertexAttribArray(11);
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned))); glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataDualTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned)));
glVertexAttribDivisor(11, 1); glVertexAttribDivisorARB(11, 1);
} }
template<> template<>
@ -227,13 +227,13 @@ void VAOInstanceUtil<InstanceDataThreeTex>::SetVertexAttrib()
SetVertexAttrib_impl(); SetVertexAttrib_impl();
glEnableVertexAttribArray(10); glEnableVertexAttribArray(10);
glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float))); glVertexAttribIPointer(10, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float)));
glVertexAttribDivisor(10, 1); glVertexAttribDivisorARB(10, 1);
glEnableVertexAttribArray(11); glEnableVertexAttribArray(11);
glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned))); glVertexAttribIPointer(11, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 2 * sizeof(unsigned)));
glVertexAttribDivisor(11, 1); glVertexAttribDivisorARB(11, 1);
glEnableVertexAttribArray(13); glEnableVertexAttribArray(13);
glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 4 * sizeof(unsigned))); glVertexAttribIPointer(13, 2, GL_UNSIGNED_INT, sizeof(InstanceDataThreeTex), (GLvoid*)(9 * sizeof(float) + 4 * sizeof(unsigned)));
glVertexAttribDivisor(13, 1); glVertexAttribDivisorARB(13, 1);
} }
template<> template<>
@ -242,7 +242,7 @@ void VAOInstanceUtil<GlowInstanceData>::SetVertexAttrib()
SetVertexAttrib_impl(); SetVertexAttrib_impl();
glEnableVertexAttribArray(12); glEnableVertexAttribArray(12);
glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GlowInstanceData), (GLvoid*)(9 * sizeof(float))); glVertexAttribPointer(12, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GlowInstanceData), (GLvoid*)(9 * sizeof(float)));
glVertexAttribDivisor(12, 1); glVertexAttribDivisorARB(12, 1);
} }