glarea: Make the code snippet compile

This commit is contained in:
Timm Bäder 2017-10-11 13:26:59 +02:00
parent 114f232a99
commit d027e365d3

View File

@ -56,11 +56,7 @@
* create a widget instance and connect to the #GtkGLArea::render signal: * create a widget instance and connect to the #GtkGLArea::render signal:
* *
* |[<!-- language="C" --> * |[<!-- language="C" -->
* // create a GtkGLArea instance
* GtkWidget *gl_area = gtk_gl_area_new ();
*
* // connect to the "render" signal
* g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
* ]| * ]|
* *
* The `render()` function will be called when the #GtkGLArea is ready * The `render()` function will be called when the #GtkGLArea is ready
@ -80,13 +76,22 @@
* glClear (GL_COLOR_BUFFER_BIT); * glClear (GL_COLOR_BUFFER_BIT);
* *
* // draw your object * // draw your object
* draw_an_object (); * // draw_an_object ();
* *
* // we completed our drawing; the draw commands will be * // we completed our drawing; the draw commands will be
* // flushed at the end of the signal emission chain, and * // flushed at the end of the signal emission chain, and
* // the buffers will be drawn on the window * // the buffers will be drawn on the window
* return TRUE; * return TRUE;
* } * }
*
* void setup_glarea (void)
* {
* // create a GtkGLArea instance
* GtkWidget *gl_area = gtk_gl_area_new ();
*
* // connect to the "render" signal
* g_signal_connect (gl_area, "render", G_CALLBACK (render), NULL);
* }
* ]| * ]|
* *
* If you need to initialize OpenGL state, e.g. buffer objects or * If you need to initialize OpenGL state, e.g. buffer objects or