From 9f122c9fc0e9cdcffc3a2c188cf396d564dae2e6 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 16 Apr 2023 21:17:39 +0800 Subject: [PATCH] tmp --- main.c | 16 ++++++++++------ simp_gtk_gl.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/main.c b/main.c index f4f4cea..cdfcf00 100644 --- a/main.c +++ b/main.c @@ -38,9 +38,7 @@ void simp_edit_play(GtkMenuButton* self, gpointer user_data) static void resize (GtkGLArea* self, gint width, gint height, gpointer user_data) { - printf("%s(),%d\n", __func__, __LINE__); - - GdkGLContext *context; + GdkGLContext* context; gtk_gl_area_make_current (self); @@ -56,6 +54,8 @@ static void resize (GtkGLArea* self, gint width, gint height, gpointer user_data } else { printf("%s(),%d, gl\n", __func__, __LINE__); } + +// simp_avio_run(user_data); } static void unrealize(GtkWidget *widget) @@ -65,7 +65,6 @@ static void unrealize(GtkWidget *widget) static gboolean render(GtkGLArea* self, GdkGLContext* context, gpointer user_data) { - scf_loge("%s(),%d\n", __func__, __LINE__); simp_avio_t* gl = user_data; if (gtk_gl_area_get_error (self) != NULL) @@ -84,6 +83,12 @@ static gboolean render(GtkGLArea* self, GdkGLContext* context, gpointer user_dat return TRUE; } +static gboolean timeout_render(gpointer user_data) +{ + gtk_gl_area_queue_render(GTK_GL_AREA(user_data)); + return TRUE; +} + static gboolean button_release_event (GtkWidget* self, GdkEventButton* event, gpointer user_data) { gtk_gl_area_queue_render(GTK_GL_AREA(user_data)); @@ -176,8 +181,6 @@ int main(int argc, char *argv[]) return -1; } - gl->view = gl_area; - simp_filter_add_input (f, in); simp_filter_add_output(f, alsa); simp_filter_add_output(f, gl); @@ -194,6 +197,7 @@ int main(int argc, char *argv[]) g_signal_connect(gl_area, "resize", G_CALLBACK(resize), gl); g_signal_connect(gl_area, "unrealize", G_CALLBACK(unrealize), gl); g_signal_connect(gl_area, "render", G_CALLBACK(render), gl); + g_timeout_add (10, timeout_render, gl_area); g_signal_connect(window, "button-release-event", G_CALLBACK(button_release_event), f); diff --git a/simp_gtk_gl.c b/simp_gtk_gl.c index 935941b..3d4b087 100644 --- a/simp_gtk_gl.c +++ b/simp_gtk_gl.c @@ -186,8 +186,8 @@ static int _gtk_gl_run(simp_avio_t* io) float mvp[16]; if (!gl->init) { + gl->init = 1; _gl_init(gl); - gl->init = 0; } pthread_mutex_lock (&io->mutex); -- 2.25.1