tmp
authoryu.dongliang <18588496441@163.com>
Sun, 16 Apr 2023 13:17:39 +0000 (21:17 +0800)
committeryu.dongliang <18588496441@163.com>
Sun, 16 Apr 2023 13:17:39 +0000 (21:17 +0800)
main.c
simp_gtk_gl.c

diff --git a/main.c b/main.c
index f4f4cea98cc8fc25fd6570bd50bcc85b9f7084ac..cdfcf009079890650cf0878ebc477665eefa92f7 100644 (file)
--- 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);
 
index 935941badcf82017017761ada83a7ff72f306655..3d4b087f9bb5d202742b9e602caadfc244fa69ff 100644 (file)
@@ -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);