From 3c93ebf249cc51c630a31f80d2558cb2c5b44f37 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sun, 16 Apr 2023 21:36:37 +0800 Subject: [PATCH] gtk gl --- main.c | 2 +- simp_gtk_gl.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index cdfcf00..1d61294 100644 --- a/main.c +++ b/main.c @@ -52,7 +52,7 @@ static void resize (GtkGLArea* self, gint width, gint height, gpointer user_data if (gdk_gl_context_get_use_es (context)) { printf("%s(),%d, gles\n", __func__, __LINE__); } else { - printf("%s(),%d, gl\n", __func__, __LINE__); + printf("%s(),%d, gl, width: %d, height: %d\n", __func__, __LINE__, width, height); } // simp_avio_run(user_data); diff --git a/simp_gtk_gl.c b/simp_gtk_gl.c index 3d4b087..16a6107 100644 --- a/simp_gtk_gl.c +++ b/simp_gtk_gl.c @@ -227,14 +227,17 @@ static int _gtk_gl_run(simp_avio_t* io) glActiveTexture(GL_TEXTURE0); glBindTexture (GL_TEXTURE_2D, gl->texture_y); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, SIMP_GL_WIDTH, SIMP_GL_HEIGHT, GL_RED, GL_UNSIGNED_BYTE, gl->y); glUniform1i (gl->uniform_y, 0); glActiveTexture(GL_TEXTURE1); glBindTexture (GL_TEXTURE_2D, gl->texture_u); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, SIMP_GL_WIDTH / 2, SIMP_GL_HEIGHT/ 2, GL_RED, GL_UNSIGNED_BYTE, gl->u); glUniform1i (gl->uniform_u, 1); glActiveTexture(GL_TEXTURE2); glBindTexture (GL_TEXTURE_2D, gl->texture_v); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, SIMP_GL_WIDTH / 2, SIMP_GL_HEIGHT/ 2, GL_RED, GL_UNSIGNED_BYTE, gl->v); glUniform1i (gl->uniform_v, 2); // draw -- 2.25.1