![]() | ![]() | ![]() | GtkGLExt Reference Manual | ![]() |
---|
OpenGL-Capable Widget — OpenGL extension API to GtkWidget
#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. As opposed to Jane Loff's GtkGLArea, it does not provide any OpenGL widget, but an interface to use OpenGL on GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability to add OpenGL support to a widget, it will create a GL drawable for the widget, which can be obtained via gtk_widget_get_gl_drawable. GL context can also be obtained via gtk_widget_get_gl_context. With GL drawable and GL context, 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 which to share display lists. 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.
This function is useful to check if a widget is OpenGL-capable (i.e if it is possible to use OpenGL functions to draw on it).
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.
This returns a GdkGLConfig with the OpenGL configuration of 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 which to share display lists. 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)
Return the GdkGLDrawable owned by the widget. In fact it calls gtk_widget_get_gl_window and casts result to a GDK_GL_DRAWABLE.
widget : | a GtkWidget. |
Returns : | the GdkGLDrawable. |
<< Initialization | Version Information >> |