2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtkglext-gtkglwidget.html
50 * - GdkGLConfig* -> GLConfig
51 * - GdkGLContext* -> GLContext
52 * - GdkGLDrawable* -> Drawable
53 * - GdkGLWindow* -> GLWindow
54 * - GtkWidget* -> Widget
59 module glgtk
.GLWidget
;
65 import tango
.io
.Stdout
; // use the tango loging?
69 private import gtkglc
.glgtktypes
;
71 private import gtkglc
.glgtk
;
74 private import gtk
.Widget
;
75 private import glgdk
.GLDrawable
;
76 private import glgdk
.GLConfig
;
77 private import glgdk
.GLContext
;
78 private import glgdk
.GLWindow
;
85 * GtkGLExt is an extension to GTK which adds OpenGL capabilities to
86 * GtkWidget. Its use is quite simple: use gtk_widget_set_gl_capability
87 * to add OpenGL support to a widget, it will create a OpenGL drawable
88 * (GdkGLDrawable) for the widget, which can be obtained via
89 * gtk_widget_get_gl_drawable. OpenGL rendering context (GdkGLContext)
90 * can also be obtained via gtk_widget_get_gl_context.
91 * With GdkGLDrawable and GdkGLContext, gdk_gl_drawable_gl_begin and
92 * gdk_gl_drawable_gl_end can be called, and OpenGL function calls can
93 * be made between those two functions.
99 * Gets the GL Frawable for (from???) the widget
101 * @return a new GLDrawable
103 static GLDrawable
getGLDrawable(Widget widget
)
105 return new GLDrawable(cast(GdkGLDrawable
*)gtk_widget_get_gl_window((widget
is null) ?
null : widget
.getWidgetStruct()));
112 * Set the OpenGL-capability to the widget.
113 * This function prepares the widget for its use with OpenGL.
115 * the GtkWidget to be used as the rendering area.
119 * the GdkGLContext with which to share display lists and texture
120 * objects. NULL indicates that no sharing is to take place.
122 * whether rendering is to be done with a direct connection to
123 * the graphics system.
125 * GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
128 * TRUE if it is successful, FALSE otherwise.
130 public static int setGLCapability(Widget widget
, GLConfig glconfig
, GLContext shareList
, int direct
, int renderType
)
132 // gboolean gtk_widget_set_gl_capability (GtkWidget *widget, GdkGLConfig *glconfig, GdkGLContext *share_list, gboolean direct, int render_type);
133 return gtk_widget_set_gl_capability((widget
is null) ?
null : widget
.getWidgetStruct(), (glconfig
is null) ?
null : glconfig
.getGLConfigStruct(), (shareList
is null) ?
null : shareList
.getGLContextStruct(), direct
, renderType
);
137 * Returns whether the widget is OpenGL-capable.
141 * TRUE if the widget is OpenGL-capable, FALSE otherwise.
143 public static int isGLCapable(Widget widget
)
145 // gboolean gtk_widget_is_gl_capable (GtkWidget *widget);
146 return gtk_widget_is_gl_capable((widget
is null) ?
null : widget
.getWidgetStruct());
150 * Returns the GdkGLConfig referred by the widget.
156 public static GLConfig
getGLConfig(Widget widget
)
158 // GdkGLConfig* gtk_widget_get_gl_config (GtkWidget *widget);
159 return new GLConfig( gtk_widget_get_gl_config((widget
is null) ?
null : widget
.getWidgetStruct()) );
163 * Creates a new GdkGLContext with the appropriate GdkGLDrawable
164 * for this widget. The GL context must be freed when you're
165 * finished with it. See also gtk_widget_get_gl_context().
169 * the GdkGLContext with which to share display lists and texture
170 * objects. NULL indicates that no sharing is to take place.
172 * whether rendering is to be done with a direct connection to
173 * the graphics system.
175 * GDK_GL_RGBA_TYPE or GDK_GL_COLOR_INDEX_TYPE (currently not
178 * the new GdkGLContext.
180 public static GLContext
createGLContext(Widget widget
, GLContext shareList
, int direct
, int renderType
)
182 // GdkGLContext* gtk_widget_create_gl_context (GtkWidget *widget, GdkGLContext *share_list, gboolean direct, int render_type);
183 return new GLContext( gtk_widget_create_gl_context((widget
is null) ?
null : widget
.getWidgetStruct(), (shareList
is null) ?
null : shareList
.getGLContextStruct(), direct
, renderType
) );
187 * Returns the GdkGLContext with the appropriate GdkGLDrawable
188 * for this widget. Unlike the GL context returned by
189 * gtk_widget_create_gl_context(), this context is owned by the widget.
190 * GdkGLContext is needed for the function gdk_gl_drawable_begin,
191 * or for sharing display lists (see gtk_widget_set_gl_capability()).
197 public static GLContext
getGLContext(Widget widget
)
199 // GdkGLContext* gtk_widget_get_gl_context (GtkWidget *widget);
200 return new GLContext( gtk_widget_get_gl_context((widget
is null) ?
null : widget
.getWidgetStruct()) );
204 * Returns the GdkGLWindow owned by the widget.
210 public static GLWindow
getGLWindow(Widget widget
)
212 // GdkGLWindow* gtk_widget_get_gl_window (GtkWidget *widget);
213 return new GLWindow( gtk_widget_get_gl_window((widget
is null) ?
null : widget
.getWidgetStruct()) );