[gtk+] demo/glarea: Check errors on GtkGLArea
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] demo/glarea: Check errors on GtkGLArea
- Date: Wed, 25 Mar 2015 17:04:10 +0000 (UTC)
commit 721134b00877355f1e2cec01cffa05c9e053174f
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Mar 25 15:20:36 2015 +0000
demo/glarea: Check errors on GtkGLArea
We should not call OpenGL API if GtkGLArea is in an error state.
https://bugzilla.gnome.org/show_bug.cgi?id=746746
demos/gtk-demo/glarea.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/demos/gtk-demo/glarea.c b/demos/gtk-demo/glarea.c
index ed87ef0..613c2c9 100644
--- a/demos/gtk-demo/glarea.c
+++ b/demos/gtk-demo/glarea.c
@@ -220,6 +220,9 @@ realize (GtkWidget *widget)
{
gtk_gl_area_make_current (GTK_GL_AREA (widget));
+ if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
+ return;
+
init_buffers (&position_buffer, NULL);
init_shaders (&program, &mvp_location);
}
@@ -230,6 +233,9 @@ unrealize (GtkWidget *widget)
{
gtk_gl_area_make_current (GTK_GL_AREA (widget));
+ if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
+ return;
+
glDeleteBuffers (1, &position_buffer);
glDeleteProgram (program);
}
@@ -271,6 +277,9 @@ static gboolean
render (GtkGLArea *area,
GdkGLContext *context)
{
+ if (gtk_gl_area_get_error (area) != NULL)
+ return FALSE;
+
/* Clear the viewport */
glClearColor (0.5, 0.5, 0.5, 1.0);
glClear (GL_COLOR_BUFFER_BIT);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]