| GtkGLExt Reference Manual |
|---|
OpenGL-Capable Widget — OpenGL extension to GtkWidget API
#include <gtk/gtkgl.h> gboolean gtk_widget_set_gl_capability (GtkWidget *widget, GdkGLConfig *glconfig, GdkGLContext *share_list, gboolean direct, int render_type); gboolean gtk_widget_is_gl_capable (GtkWidget *widget); GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget); GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type); GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget); GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget); #define gtk_widget_get_gl_drawable (widget)
GtkGLExt is an extension to GTK which adds OpenGL capabilities to GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability to add OpenGL support to a widget, it will create a OpenGL drawable (GdkGLDrawable) for the widget, which can be obtained via gtk_widget_get_gl_drawable. OpenGL rendering context (GdkGLContext) can also be obtained via gtk_widget_get_gl_context. With GdkGLDrawable and GdkGLContext, gdk_gl_drawable_gl_begin and gdk_gl_drawable_gl_end can be called, and OpenGL function calls can be made between those two functions.
gboolean gtk_widget_set_gl_capability (GtkWidget *widget,
GdkGLConfig *glconfig,
GdkGLContext *share_list,
gboolean direct,
int render_type);Set the OpenGL-capability to the widget. This function prepares the widget for its use with OpenGL.
| widget : | the GtkWidget to be used as the rendering area. |
| glconfig : | a GdkGLConfig. |
| share_list : | the GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place. |
| direct : | whether rendering is to be done with a direct connection to the graphics system. |
| render_type : | GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not used). |
| Returns : | TRUE if it is successful, FALSE otherwise. |
gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
Returns whether the widget is OpenGL-capable.
| widget : | a GtkWidget. |
| Returns : | TRUE if the widget is OpenGL-capable, FALSE otherwise. |
GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget);
Returns the GdkGLConfig referred by the widget.
| widget : | a GtkWidget. |
| Returns : | the GdkGLConfig. |
GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type);
Creates a new GdkGLContext with the appropriate GdkGLDrawable for this widget. The GL context must be freed when you're finished with it. See also gtk_widget_get_gl_context().
| widget : | a GtkWidget. |
| share_list : | the GdkGLContext with which to share display lists and texture objects. NULL indicates that no sharing is to take place. |
| direct : | whether rendering is to be done with a direct connection to the graphics system. |
| render_type : | GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not used). |
| Returns : | the new GdkGLContext. |
GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget);
Returns the GdkGLContext with the appropriate GdkGLDrawable for this widget. Unlike the GL context returned by gtk_widget_create_gl_context(), this context is owned by the widget.
GdkGLContext is needed for the function gdk_gl_drawable_begin, or for sharing display lists (see gtk_widget_set_gl_capability()).
| widget : | a GtkWidget. |
| Returns : | the GdkGLContext. |
GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget);
Returns the GdkGLWindow owned by the widget.
| widget : | a GtkWidget. |
| Returns : | the GdkGLWindow. |
#define gtk_widget_get_gl_drawable(widget)
Returns the GdkGLDrawable owned by the widget. In fact, this is macro that casts the result of gtk_widget_get_gl_window to GdkGLDrawable.
| widget : | a GtkWidget. |
| Returns : | the GdkGLDrawable. |
| << Initialization | Version Information >> |