summaryrefslogtreecommitdiffstats
path: root/src/datavis3d/engine/q3dbars.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavis3d/engine/q3dbars.cpp')
-rw-r--r--src/datavis3d/engine/q3dbars.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp
index 89f49dea..47321272 100644
--- a/src/datavis3d/engine/q3dbars.cpp
+++ b/src/datavis3d/engine/q3dbars.cpp
@@ -238,6 +238,7 @@ void Q3DBars::render()
#ifdef USE_HAX0R_SELECTION
// 1st attribute buffer : vertices
+ glEnableVertexAttribArray(d_ptr->m_positionAttrSelection);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_vertexbuffer);
glVertexAttribPointer(d_ptr->m_positionAttrSelection
, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
@@ -245,18 +246,16 @@ void Q3DBars::render()
// Index buffer
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, d_ptr->m_elementbuffer);
- glEnableVertexAttribArray(0);
-
// Draw the triangles
glDrawElements(GL_TRIANGLES, d_ptr->m_indexCount, GL_UNSIGNED_SHORT, (void*)0);
- glDisableVertexAttribArray(0);
+ glDisableVertexAttribArray(d_ptr->m_positionAttrSelection);
#else // TODO: fix this - doesn't work yet
glBindFramebuffer(GL_FRAMEBUFFER, d_ptr->m_framebufferSelection);
//glReadBuffer(GL_COLOR_ATTACHMENT0);
// 1st attribute buffer : vertices
- glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(d_ptr->m_positionAttrSelection);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_vertexbuffer);
glVertexAttribPointer(d_ptr->m_positionAttrSelection
, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
@@ -268,7 +267,7 @@ void Q3DBars::render()
GLenum DrawBuffers[1] = {GL_COLOR_ATTACHMENT0};
glDrawElements(GL_TRIANGLES, d_ptr->m_indexCount, GL_UNSIGNED_SHORT, DrawBuffers);
- glDisableVertexAttribArray(0);
+ glDisableVertexAttribArray(d_ptr->m_positionAttrSelection);
//glReadBuffer(GL_NONE);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
@@ -350,17 +349,17 @@ void Q3DBars::render()
, 4.0f);
// 1st attribute buffer : vertices
- glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(d_ptr->m_positionAttrBackground);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_vertexbufferBackground);
glVertexAttribPointer(d_ptr->m_positionAttrBackground, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
// 2nd attribute buffer : normals
- glEnableVertexAttribArray(1); // this causes trouble with desktop opengl, but ANGLE requires it
+ glEnableVertexAttribArray(d_ptr->m_normalAttrBackground);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_normalbufferBackground);
glVertexAttribPointer(d_ptr->m_normalAttrBackground, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
// 3rd attribute buffer : UVs
- //glEnableVertexAttribArray(2);
+ //glEnableVertexAttribArray(d_ptr->m_uvAttrBackground);
//glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_uvbufferBackground);
//glVertexAttribPointer(d_ptr->m_uvAttrBackground, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
@@ -370,9 +369,9 @@ void Q3DBars::render()
// Draw the triangles
glDrawElements(GL_TRIANGLES, d_ptr->m_indexCountBackground, GL_UNSIGNED_SHORT, (void*)0);
- //glDisableVertexAttribArray(2);
- glDisableVertexAttribArray(1); // this causes trouble with desktop opengl, but ANGLE requires it
- glDisableVertexAttribArray(0);
+ //glDisableVertexAttribArray(d_ptr->m_uvAttrBackground);
+ glDisableVertexAttribArray(d_ptr->m_normalAttrBackground);
+ glDisableVertexAttribArray(d_ptr->m_positionAttrBackground);
}
// Release background shader
@@ -469,17 +468,17 @@ void Q3DBars::render()
//qDebug() << "height:" << barHeight;
// 1st attribute buffer : vertices
- glEnableVertexAttribArray(0);
+ glEnableVertexAttribArray(d_ptr->m_positionAttr);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_vertexbuffer);
glVertexAttribPointer(d_ptr->m_positionAttr, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
// 2nd attribute buffer : normals
- glEnableVertexAttribArray(1); // this causes trouble with desktop opengl, but ANGLE requires it
+ glEnableVertexAttribArray(d_ptr->m_normalAttr);
glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_normalbuffer);
glVertexAttribPointer(d_ptr->m_normalAttr, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
// 3rd attribute buffer : UVs
- //glEnableVertexAttribArray(2);
+ //glEnableVertexAttribArray(d_ptr->m_uvAttr);
//glBindBuffer(GL_ARRAY_BUFFER, d_ptr->m_uvbuffer);
//glVertexAttribPointer(d_ptr->m_uvAttr, 2, GL_FLOAT, GL_FALSE, 0, (void*)0);
@@ -489,9 +488,9 @@ void Q3DBars::render()
// Draw the triangles
glDrawElements(GL_TRIANGLES, d_ptr->m_indexCount, GL_UNSIGNED_SHORT, (void*)0);
- //glDisableVertexAttribArray(2);
- glDisableVertexAttribArray(1); // this causes trouble with desktop opengl, but ANGLE requires it
- glDisableVertexAttribArray(0);
+ //glDisableVertexAttribArray(d_ptr->m_uvAttr);
+ glDisableVertexAttribArray(d_ptr->m_normalAttr);
+ glDisableVertexAttribArray(d_ptr->m_positionAttr);
}
}