Skip to content
Open
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions src/matrixtrails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ bool CMatrixTrails::RestoreDevice(const std::string& path)
if (!LoadShaderFiles(vertShader, fraqShader) || !CompileAndLink())
return false;

#if defined(HAS_GL)
glGenVertexArrays(1, &m_vao);
#endif

glGenBuffers(1, &m_vertexVBO);

m_Texture = SOIL_load_OGL_texture(path.c_str(), SOIL_LOAD_RGB, 0, 0);
Expand All @@ -61,6 +65,10 @@ void CMatrixTrails::InvalidateDevice()
{
glDeleteBuffers(1, &m_vertexVBO);
m_vertexVBO = 0;

#if defined(HAS_GL)
glDeleteVertexArrays(1, &m_vao);
#endif
}

////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -89,6 +97,10 @@ bool CMatrixTrails::Draw()
posX += m_CharSize.x;
}

#if defined(HAS_GL)
glBindVertexArray(m_vao);
#endif

EnableShader();

glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO);
Expand All @@ -114,8 +126,14 @@ bool CMatrixTrails::Draw()
glDisableVertexAttribArray(m_aColor);
glDisableVertexAttribArray(m_aCoord);

glBindBuffer(GL_ARRAY_BUFFER, 0);

DisableShader();

#if defined(HAS_GL)
glBindVertexArray(m_vao);
#endif

return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/matrixtrails.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class ATTR_DLL_LOCAL CMatrixTrails : public kodi::gui::gl::CShaderProgram
GLuint m_Texture;

private:
GLuint m_vao = -1;
GLuint m_vertexVBO = -1;

GLint m_aPosition = -1;
Expand Down