[retro-gtk/wip/aplazas/gl-display] fixes?
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [retro-gtk/wip/aplazas/gl-display] fixes?
- Date: Thu, 16 Nov 2017 05:50:27 +0000 (UTC)
commit 4fc1855c902e4ded3aabecce3b4df5561580a475
Author: Adrien Plazas <kekun plazas laposte net>
Date: Thu Nov 16 06:50:00 2017 +0100
fixes?
retro-gtk/retro-gl-display.c | 8 +++++++-
retro-gtk/retro-glsl-filter.c | 14 +++++++-------
retro-gtk/retro-glsl-filter.h | 1 +
3 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/retro-gtk/retro-gl-display.c b/retro-gtk/retro-gl-display.c
index 372bd7c..34f5dc1 100644
--- a/retro-gtk/retro-gl-display.c
+++ b/retro-gtk/retro-gl-display.c
@@ -120,7 +120,7 @@ retro_gl_display_realize (RetroGLDisplay *self)
for (filter = 0; filter < RETRO_VIDEO_FILTER_COUNT; filter++) {
self->glsl_filter[filter] = retro_glsl_filter_new (filter_uris[filter], NULL);
- retro_glsl_filter_use_program (self->glsl_filter[filter]);
+ retro_glsl_filter_prepare_program (self->glsl_filter[filter]);
retro_glsl_filter_set_attribute_pointer (self->glsl_filter[filter],
"position",
@@ -143,6 +143,12 @@ retro_gl_display_realize (RetroGLDisplay *self)
self->texture = 0;
glGenTextures (1, &self->texture);
glBindTexture (GL_TEXTURE_2D, self->texture);
+
+ filter = self->filter >= RETRO_VIDEO_FILTER_COUNT ?
+ RETRO_VIDEO_FILTER_SMOOTH :
+ self->filter;
+
+ retro_glsl_filter_use_program (self->glsl_filter[filter]);
}
static void
diff --git a/retro-gtk/retro-glsl-filter.c b/retro-gtk/retro-glsl-filter.c
index f8795a5..61abf91 100644
--- a/retro-gtk/retro-glsl-filter.c
+++ b/retro-gtk/retro-glsl-filter.c
@@ -249,16 +249,10 @@ create_shader (GBytes *source_bytes,
}
void
-retro_glsl_filter_use_program (RetroGLSLFilter *self)
+retro_glsl_filter_prepare_program (RetroGLSLFilter *self)
{
g_return_if_fail (RETRO_IS_GLSL_FILTER (self));
- if (self->program != 0) {
- glUseProgram (self->program);
-
- return;
- }
-
self->vertex_shader = create_shader (self->vertex, GL_VERTEX_SHADER);
self->fragment_shader = create_shader (self->fragment, GL_FRAGMENT_SHADER);
@@ -266,6 +260,12 @@ retro_glsl_filter_use_program (RetroGLSLFilter *self)
glAttachShader (self->program, self->vertex_shader);
glAttachShader (self->program, self->fragment_shader);
glLinkProgram (self->program);
+}
+
+void
+retro_glsl_filter_use_program (RetroGLSLFilter *self)
+{
+ g_return_if_fail (RETRO_IS_GLSL_FILTER (self));
glUseProgram (self->program);
}
diff --git a/retro-gtk/retro-glsl-filter.h b/retro-gtk/retro-glsl-filter.h
index bf10e59..a9d0e11 100644
--- a/retro-gtk/retro-glsl-filter.h
+++ b/retro-gtk/retro-glsl-filter.h
@@ -14,6 +14,7 @@ G_DECLARE_FINAL_TYPE (RetroGLSLFilter, retro_glsl_filter, RETRO, GLSL_FILTER, GO
RetroGLSLFilter *retro_glsl_filter_new (const char *uri,
GError **error);
void retro_glsl_filter_apply_texture_params (RetroGLSLFilter *self);
+void retro_glsl_filter_prepare_program (RetroGLSLFilter *self);
void retro_glsl_filter_use_program (RetroGLSLFilter *self);
void retro_glsl_filter_set_attribute_pointer (RetroGLSLFilter *self,
const gchar *name,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]