Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Main_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class ATTR_DLL_LOCAL CVisualizationWaveForm

glm::mat4 m_modelProjMat;

GLuint m_vao = 0;

#ifdef HAS_GL
GLuint m_vertexVBO = 0;
#endif
Expand Down Expand Up @@ -131,6 +133,8 @@ bool CVisualizationWaveForm::Start(int channels, int samplesPerSec, int bitsPerS
else
m_backgroundColor.a = 0.0f;

glGenVertexArrays(1, &m_vao);

#ifdef HAS_GL
glGenBuffers(1, &m_vertexVBO);
#endif
Expand All @@ -156,6 +160,8 @@ void CVisualizationWaveForm::Stop()
glDeleteBuffers(1, &m_vertexVBO);
m_vertexVBO = 0;
#endif

glDeleteVertexArrays(1, &m_vao);
}

//-- Render -------------------------------------------------------------------
Expand All @@ -166,6 +172,8 @@ void CVisualizationWaveForm::Render()
if (!m_startOK)
return;

glBindVertexArray(m_vao);

#ifdef HAS_GL
glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO);

Expand Down Expand Up @@ -203,6 +211,8 @@ void CVisualizationWaveForm::Render()
#ifdef HAS_GL
glDisable(GL_LINE_SMOOTH);
#endif

glBindVertexArray(0);
}

void CVisualizationWaveForm::DrawLine(float* waveform, bool topBottom)
Expand Down