[gtk+/gtk-3-16] demo/glarea: Check errors on GtkGLArea
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-16] demo/glarea: Check errors on GtkGLArea
- Date: Fri, 27 Mar 2015 11:38:46 +0000 (UTC)
commit a7f06d2ae672b3eac9202ad72c0472b8b80e221b
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]