

1. Help, ./configure does not find Mesa, I do have Mesa libaries installed.

    - Mesa may need additional libraries to link with, depending on what
      options were used while compiling Mesa libraries. Currently configure
      tries to link Mesa with whatever libraries GTK needs and if this fails
      it tries adding the pthreads libraries. Try passing extra libraries to
      ./configure in LIBS envinronment variable.



2. How do I make any widget opengl widget?

    Your widget needs an OpenGL capable visual and you also need to set
    a colormap for it. The widget must also have an X window (not all
    widgets have it).

    /* get visual using gdk_gl_choose_visual */
    visual = gdk_gl_choose_visual(visual_attributes);

    /* set visual and colormap */
    gtk_widget_push__colormap(gdk_colormap_new(visual, TRUE));
    gtk_widget_push_visual(visual);

    /* create your widget */
    widget = gtk_foobar_new();

    /* disable backing store (only in GTK-1.4) */
    gtk_widget_set_double_buffered(widget, FALSE);

    /* restore old values */
    gtk_widget_pop_visual();
    gtk_widget_pop_colormap();



3. How do I render to such widget?

    Create a GL context and connect it to the widget's GdkDrawable.

    context = gdk_gl_context(visual);

    /* connect to gdk window of widget */
    if (gdk_gl_make_current(widget->window, context)) {
        /* do opengl stuff... */

    }



4. How do I render to an off-screen pixmap?

    See examples/glpixmap.c, remember that pixmaps can not be rendered to with
    direct context.



5. Can I use gdk_gl functions and GtkGLArea widget in the same program?

    Yes, just remember that gtk_gl_area_make_current() makes the GtkGLArea
    widget's internal context the current context and leaves it so.



6. How do I capture keypress events for GtkGLArea widget?

    This is not a GtkGLArea specific question, but here is a solution:

    - Set an event mask:
         gtk_widget_set_events(glarea, GDK_KEY_PRESS_MASK);

    - Grab the focus:
        GTK_WIDGET_SET_FLAGS(glarea, GTK_CAN_FOCUS);
        gtk_widget_grab_focus(GTK_WIDGET(glarea));

    - Prevent possible default handlers from running:
        /* do this in the keypress handler and return TRUE from handler */
        gtk_signal_emit_stop_by_name(GTK_OBJECT(glarea), "key_press_event");



7. Where are gtk_gl_area_begingl() and gtk_gl_area_endgl()?

    These functions are deprecated. You should use gtk_gl_area_make_current()
    instead of gtk_gl_area_begingl().

    gtk_gl_area_endgl() is no longer required, but you may wish to call
    glFlush() instead.

    gtk_gl_area_swapbuffers() was renamed to gtk_gl_area_swap_buffers().

