From 0d463d17987fee01e5f2897c23d81565365a5c50 Mon Sep 17 00:00:00 2001 From: Alwin Esch Date: Sun, 3 Feb 2019 12:04:54 +0100 Subject: [PATCH] Code cleanup --- screensaver.asteroids/addon.xml.in | 6 +++--- src/main.cpp | 13 +++++-------- src/main.h | 2 -- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/screensaver.asteroids/addon.xml.in b/screensaver.asteroids/addon.xml.in index 1552502..e76cf26 100644 --- a/screensaver.asteroids/addon.xml.in +++ b/screensaver.asteroids/addon.xml.in @@ -1,7 +1,7 @@  @ADDON_DEPENDS@ @@ -9,8 +9,8 @@ point="xbmc.ui.screensaver" library_@PLATFORM@="@LIBRARY_FILENAME@"/> - Asteroids screensaver - An old-style screen saver where the asteroids are shot away. + Asteroids screensaver + An old-style screen saver where the asteroids are shot away. @PLATFORM@ resources/icon.png diff --git a/src/main.cpp b/src/main.cpp index f545934..83d1b12 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -130,7 +130,6 @@ bool CMyAddon::Start() } glGenBuffers(1, &m_vertexVBO); - glGenBuffers(1, &m_indexVBO); #else m_pContext = reinterpret_cast(Device()); @@ -172,6 +171,11 @@ void CMyAddon::Render() if (!m_asteroids) return; +#ifndef WIN32 + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); +#endif + Begin(); m_timer->Update(); m_asteroids->Update(m_timer->GetDeltaTime()); @@ -200,8 +204,6 @@ void CMyAddon::Stop() #ifndef WIN32 glDeleteBuffers(1, &m_vertexVBO); m_vertexVBO = 0; - glDeleteBuffers(1, &m_indexVBO); - m_indexVBO = 0; SAFE_DELETE(m_shader); #endif @@ -232,7 +234,6 @@ bool CMyAddon::Draw() GLfloat x, y, z; GLfloat r, g, b; } vertex[m_NumLines * 2]; - unsigned int idx[m_NumLines * 2]; for (size_t j = 0; j < m_NumLines * 2; ++j) { @@ -242,7 +243,6 @@ bool CMyAddon::Draw() vertex[j].r = m_VertBuf[j].col[0]; vertex[j].g = m_VertBuf[j].col[1]; vertex[j].b = m_VertBuf[j].col[2]; - idx[j] = j; } GLint colLoc = m_shader->GetColLoc(); @@ -250,9 +250,6 @@ bool CMyAddon::Draw() glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(PackedVertex)*m_NumLines*2, vertex, GL_STATIC_DRAW); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_indexVBO); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(idx), idx, GL_STATIC_DRAW); - glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(PackedVertex), BUFFER_OFFSET(offsetof(PackedVertex, x))); glEnableVertexAttribArray(0); diff --git a/src/main.h b/src/main.h index bdd59e7..c95eeda 100644 --- a/src/main.h +++ b/src/main.h @@ -60,8 +60,6 @@ class ATTRIBUTE_HIDDEN CMyAddon TRenderVertex* m_VertBuf; CGUIShader* m_shader; unsigned int m_vertexVBO; - unsigned int m_vertexVAO; - unsigned int m_indexVBO; #else ID3D11DeviceContext* m_pContext;