Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use VAO #63

Open
wants to merge 1 commit into
base: Omega
Choose a base branch
from
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
10 changes: 8 additions & 2 deletions src/fishbmc_addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ bool CVisualizationFishBMC::Start(int channels,
m_shaderLoaded = true;
}

glGenVertexArrays(1, &m_vao);

#ifdef HAS_GL
glGenBuffers(2, m_vertexVBO);
glGenBuffers(1, &m_indexVBO);
Expand Down Expand Up @@ -131,16 +133,16 @@ void CVisualizationFishBMC::Stop()
glDeleteTextures(1, &m_texture);

#ifdef HAS_GL
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(2, m_vertexVBO);
m_vertexVBO[0] = 0;
m_vertexVBO[1] = 0;

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &m_indexVBO);
m_indexVBO = 0;
#endif

glDeleteVertexArrays(1, &m_vao);

delete[] m_axis;
m_axis = nullptr;
}
Expand Down Expand Up @@ -196,6 +198,8 @@ void CVisualizationFishBMC::Render()
}
}

glBindVertexArray(m_vao);

start_render();

// loop over and draw all quads
Expand Down Expand Up @@ -226,6 +230,8 @@ void CVisualizationFishBMC::Render()
}

finish_render();

glBindVertexArray(0);
}

ADDON_STATUS CVisualizationFishBMC::SetSetting(const std::string& settingName,
Expand Down
1 change: 1 addition & 0 deletions src/fishbmc_addon.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class ATTR_DLL_LOCAL CVisualizationFishBMC : public kodi::addon::CAddonBase,
GLint m_aVertexLoc = -1;
GLint m_aCoordLoc = -1;

GLuint m_vao = 0;
GLuint m_vertexVBO[2] = {0};
GLuint m_indexVBO = 0;
GLuint m_texture = 0;
Expand Down