fix: opengl error 0500
This commit is contained in:
+1
-1
@@ -113,7 +113,7 @@ make -f Makefile.dev release-arch
|
|||||||
- [x] Documentation in default config file
|
- [x] Documentation in default config file
|
||||||
- [x] Clone "shaders" and config in system path at setup
|
- [x] Clone "shaders" and config in system path at setup
|
||||||
- [ ] Minimal sample shaders
|
- [ ] Minimal sample shaders
|
||||||
- [ ] Find and fix opengl errors 0500 ?
|
- [x] Find and fix opengl errors 0500 ?
|
||||||
- [ ] Investigate video device fps loss (bad unregister ?)
|
- [ ] Investigate video device fps loss (bad unregister ?)
|
||||||
- explore libv4l directly [github](https://github.com/philips/libv4l) (with `-lv4l2`)
|
- explore libv4l directly [github](https://github.com/philips/libv4l) (with `-lv4l2`)
|
||||||
- [ ] Bonus
|
- [ ] Bonus
|
||||||
|
|||||||
+41
-6
@@ -22,6 +22,19 @@
|
|||||||
|
|
||||||
static const GLuint unused_uniform = (GLuint)-1;
|
static const GLuint unused_uniform = (GLuint)-1;
|
||||||
|
|
||||||
|
bool check_glerror(ShaderProgram *program) {
|
||||||
|
unsigned int code;
|
||||||
|
|
||||||
|
code = glGetError();
|
||||||
|
|
||||||
|
if (code > 0) {
|
||||||
|
log_warn("GL Error: %04x", code);
|
||||||
|
program->error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return code > 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void init_gl(ShaderProgram *program) {
|
static void init_gl(ShaderProgram *program) {
|
||||||
gladLoadGL(glfwGetProcAddress);
|
gladLoadGL(glfwGetProcAddress);
|
||||||
|
|
||||||
@@ -45,8 +58,6 @@ static void init_textures(ShaderProgram *program,
|
|||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, program->textures[i]);
|
glBindTexture(GL_TEXTURE_2D, program->textures[i]);
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
|
||||||
|
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
@@ -399,28 +410,52 @@ void shaders_init(ShaderProgram *program, const Project *project,
|
|||||||
|
|
||||||
init_gl(program);
|
init_gl(program);
|
||||||
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_shaders(program, project);
|
init_shaders(program, project);
|
||||||
|
|
||||||
if (program->error) {
|
if (program->error || check_glerror(program)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_textures(program, context);
|
init_textures(program, context);
|
||||||
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_input(program, &project->config, inputs);
|
init_input(program, &project->config, inputs);
|
||||||
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_framebuffers(program, &project->config);
|
init_framebuffers(program, &project->config);
|
||||||
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_programs(program, &project->config, &project->state_config);
|
init_programs(program, &project->config, &project->state_config);
|
||||||
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
init_vertices(program);
|
init_vertices(program);
|
||||||
|
|
||||||
// log_debug("Error after init: %04x",
|
if (check_glerror(program)) {
|
||||||
// glGetError()); // TODO check error at each step
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bind_vertices(program, rebind ? 1 : 0);
|
bind_vertices(program, rebind ? 1 : 0);
|
||||||
;
|
|
||||||
|
if (check_glerror(program)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shaders_update(const ShaderProgram *program, const File *fragment_shader,
|
void shaders_update(const ShaderProgram *program, const File *fragment_shader,
|
||||||
|
|||||||
Reference in New Issue
Block a user