Fri, 24 Jan 2014 20:46:57 +0200
- renamed some member variables for clarity
src/GLCompiler.cc | file | annotate | diff | comparison | revisions | |
src/GLCompiler.h | file | annotate | diff | comparison | revisions |
--- a/src/GLCompiler.cc Fri Jan 24 18:31:25 2014 +0200 +++ b/src/GLCompiler.cc Fri Jan 24 20:46:57 2014 +0200 @@ -22,13 +22,13 @@ GLCompiler::GLCompiler() : m_Document (null) { - glGenBuffers (VBO_NumArrays, &m_mainVBOIndices[0]); + glGenBuffers (VBO_NumArrays, &m_mainVBOs[0]); needMerge(); } GLCompiler::~GLCompiler() { - glDeleteBuffers (VBO_NumArrays, &m_mainVBOIndices[0]); + glDeleteBuffers (VBO_NumArrays, &m_mainVBOs[0]); } // ============================================================================= @@ -166,17 +166,17 @@ if (!m_changed[type]) return; - m_mainArrays[type].clear(); + m_mainVBOData[type].clear(); for (auto it = m_objArrays.begin(); it != m_objArrays.end(); ++it) - m_mainArrays[type] += (*it)[type]; + m_mainVBOData[type] += (*it)[type]; - glBindBuffer (GL_ARRAY_BUFFER, m_mainVBOIndices[type]); - glBufferData (GL_ARRAY_BUFFER, m_mainArrays[type].size() * sizeof(float), - m_mainArrays[type].constData(), GL_DYNAMIC_DRAW); - glBindBuffer (GL_ARRAY_BUFFER, m_mainVBOIndices[type]); + glBindBuffer (GL_ARRAY_BUFFER, m_mainVBOs[type]); + glBufferData (GL_ARRAY_BUFFER, m_mainVBOData[type].size() * sizeof(float), + m_mainVBOData[type].constData(), GL_DYNAMIC_DRAW); + glBindBuffer (GL_ARRAY_BUFFER, m_mainVBOs[type]); m_changed[type] = false; - log ("VBO array %1 prepared: %2 coordinates", (int) type, m_mainArrays[type].size()); + log ("VBO array %1 prepared: %2 coordinates", (int) type, m_mainVBOData[type].size()); } // =============================================================================
--- a/src/GLCompiler.h Fri Jan 24 18:31:25 2014 +0200 +++ b/src/GLCompiler.h Fri Jan 24 20:46:57 2014 +0200 @@ -77,12 +77,12 @@ inline GLuint getVBOIndex (E_VBOArray array) const { - return m_mainVBOIndices[array]; + return m_mainVBOs[array]; } inline int getVBOCount (E_VBOArray array) const { - return m_mainArrays[array].size() / 3; + return m_mainVBOData[array].size() / 3; } private: @@ -92,8 +92,8 @@ void writeColor (QVector< float >& array, const QColor& color); QMap<LDObject*, QVector<float>*> m_objArrays; - QVector<float> m_mainArrays[VBO_NumArrays]; - GLuint m_mainVBOIndices[VBO_NumArrays]; + QVector<float> m_mainVBOData[VBO_NumArrays]; + GLuint m_mainVBOs[VBO_NumArrays]; bool m_changed[VBO_NumArrays]; LDObjectList m_staged; // Objects that need to be compiled };