Skip to content

Commit 444759f

Browse files
switching glsl version depends of --enable-gles configure flag
fix vao memleak
1 parent f7bf7b7 commit 444759f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libprojectM/Renderer/ShaderEngine.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
#include "ShaderEngine.hpp"
1010
#include "BeatDetect.hpp"
1111

12-
#define GLSL_VERSION "410"
12+
#ifdef USE_GLES
13+
#define GLSL_VERSION "300 es"
14+
#else
15+
#define GLSL_VERSION "410"
16+
#endif
1317

1418
std::string v2f_c4f_vert(
1519
"#version "
@@ -94,6 +98,7 @@ ShaderEngine::ShaderEngine()
9498
SetupCg();
9599
#endif
96100

101+
// glValidateProgram needs a VAO for its checks
97102
GLuint m_temp_vao;
98103
glGenVertexArrays(1, &m_temp_vao);
99104
glBindVertexArray(m_temp_vao);
@@ -105,6 +110,8 @@ ShaderEngine::ShaderEngine()
105110
UNIFORM_V2F_C4F_VERTEX_POINT_SIZE = glGetUniformLocation(programID_v2f_c4f, "vertex_point_size");
106111
UNIFORM_V2F_C4F_T2F_VERTEX_TRANFORMATION = glGetUniformLocation(programID_v2f_c4f_t2f, "vertex_transformation");
107112
UNIFORM_V2F_C4F_T2F_FRAG_TEXTURE_SAMPLER = glGetUniformLocation(programID_v2f_c4f_t2f, "texture_sampler");
113+
114+
glDeleteVertexArrays(1, &m_temp_vao);
108115
}
109116

110117
ShaderEngine::~ShaderEngine()

0 commit comments

Comments
 (0)