diff --git a/src/main.cpp b/src/main.cpp index 29f80b5..509592a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,7 +188,11 @@ void CVisualizationMatrix::Render() { if (m_initialized) { + glBindVertexArray(m_state.vao); + RenderTo(m_matrixShader.ProgramHandle(), 0); + + glBindVertexArray(0); } } @@ -205,11 +209,16 @@ bool CVisualizationMatrix::Start(int iChannels, int iSamplesPerSec, int iBitsPer -1.0,-1.0, 1.0, 1.0, }; + glGenVertexArrays(1, &m_state.vao); + glBindVertexArray(m_state.vao); + // Upload vertex data to a buffer glGenBuffers(1, &m_state.vertex_buffer); glBindBuffer(GL_ARRAY_BUFFER, m_state.vertex_buffer); glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW); + glBindVertexArray(0); + m_samplesPerSec = iSamplesPerSec; Launch(m_currentPreset); m_initialized = true; @@ -226,6 +235,8 @@ void CVisualizationMatrix::Stop() UnloadTextures(); glDeleteBuffers(1, &m_state.vertex_buffer); + + glDeleteVertexArrays(1, &m_state.vao); } diff --git a/src/main.h b/src/main.h index 0556116..a9e45eb 100644 --- a/src/main.h +++ b/src/main.h @@ -107,6 +107,7 @@ class ATTR_DLL_LOCAL CVisualizationMatrix struct { + GLuint vao; GLuint vertex_buffer; GLuint attr_vertex_e; GLuint attr_vertex_r, uTexture;