alternative to assert
[gtkD.git] / gtkD / srcgl / glgdk / GLDrawable.d
blob30ded1cbfc207079e7303aa3105af5f4317461b2
1 /*
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-gdkgldrawable.html
26 * outPack = glgdk
27 * outFile = GLDrawable
28 * strct = GdkGLDrawable
29 * realStrct=
30 * ctorStrct=
31 * clss = GLDrawable
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_gl_drawable_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glgdk.GLContext
45 * structWrap:
46 * - GdkGLContext* -> GLContext
47 * module aliases:
48 * local aliases:
51 module glgdk.GLDrawable;
53 version(noAssert)
55 version(Tango)
57 import tango.io.Stdout; // use the tango loging?
61 private import gtkglc.glgdktypes;
63 private import gtkglc.glgdk;
66 private import glgdk.GLContext;
71 /**
72 * Description
74 public class GLDrawable
77 /** the main Gtk struct */
78 protected GdkGLDrawable* gdkGLDrawable;
81 public GdkGLDrawable* getGLDrawableStruct()
83 return gdkGLDrawable;
87 /** the main Gtk struct as a void* */
88 protected void* getStruct()
90 return cast(void*)gdkGLDrawable;
93 /**
94 * Sets our main struct and passes it to the parent class
96 public this (GdkGLDrawable* gdkGLDrawable)
98 version(noAssert)
100 if ( gdkGLDrawable is null )
102 int zero = 0;
103 version(Tango)
105 Stdout("struct gdkGLDrawable is null on constructor").newline;
107 else
109 printf("struct gdkGLDrawable is null on constructor");
111 zero = zero / zero;
114 else
116 assert(gdkGLDrawable !is null, "struct gdkGLDrawable is null on constructor");
118 this.gdkGLDrawable = gdkGLDrawable;
126 * Attach an OpenGL rendering context to a gldrawable.
127 * gldrawable:
128 * a GdkGLDrawable.
129 * glcontext:
130 * a GdkGLContext.
131 * Returns:
132 * TRUE if it is successful, FALSE otherwise.
134 public int makeCurrent(GLContext glcontext)
136 // gboolean gdk_gl_drawable_make_current (GdkGLDrawable *gldrawable, GdkGLContext *glcontext);
137 return gdk_gl_drawable_make_current(gdkGLDrawable, (glcontext is null) ? null : glcontext.getGLContextStruct());
141 * Returns whether the gldrawable supports the double-buffered visual.
142 * gldrawable:
143 * a GdkGLDrawable.
144 * Returns:
145 * TRUE if the double-buffered visual is supported,
146 * FALSE otherwise.
148 public int isDoubleBuffered()
150 // gboolean gdk_gl_drawable_is_double_buffered (GdkGLDrawable *gldrawable);
151 return gdk_gl_drawable_is_double_buffered(gdkGLDrawable);
155 * Exchange front and back buffers.
156 * gldrawable:
157 * a GdkGLDrawable.
159 public void swapBuffers()
161 // void gdk_gl_drawable_swap_buffers (GdkGLDrawable *gldrawable);
162 gdk_gl_drawable_swap_buffers(gdkGLDrawable);
166 * Complete OpenGL execution prior to subsequent GDK drawing calls.
167 * gldrawable:
168 * a GdkGLDrawable.
170 public void waitGl()
172 // void gdk_gl_drawable_wait_gl (GdkGLDrawable *gldrawable);
173 gdk_gl_drawable_wait_gl(gdkGLDrawable);
177 * Complete GDK drawing execution prior to subsequent OpenGL calls.
178 * gldrawable:
179 * a GdkGLDrawable.
181 public void waitGdk()
183 // void gdk_gl_drawable_wait_gdk (GdkGLDrawable *gldrawable);
184 gdk_gl_drawable_wait_gdk(gdkGLDrawable);
188 * Delimits the begining of the OpenGL execution.
189 * gldrawable:
190 * a GdkGLDrawable.
191 * glcontext:
192 * a GdkGLContext.
193 * Returns:
194 * TRUE if it is successful, FALSE otherwise.
196 public int glBegin(GLContext glcontext)
198 // gboolean gdk_gl_drawable_gl_begin (GdkGLDrawable *gldrawable, GdkGLContext *glcontext);
199 return gdk_gl_drawable_gl_begin(gdkGLDrawable, (glcontext is null) ? null : glcontext.getGLContextStruct());
203 * Delimits the end of the OpenGL execution.
204 * gldrawable:
205 * a GdkGLDrawable.
207 public void glEnd()
209 // void gdk_gl_drawable_gl_end (GdkGLDrawable *gldrawable);
210 gdk_gl_drawable_gl_end(gdkGLDrawable);
214 * Gets GdkGLConfig with which the gldrawable is configured.
215 * gldrawable:
216 * a GdkGLDrawable.
217 * Returns:
218 * the GdkGLConfig.
220 public GdkGLConfig* getGLConfig()
222 // GdkGLConfig* gdk_gl_drawable_get_gl_config (GdkGLDrawable *gldrawable);
223 return gdk_gl_drawable_get_gl_config(gdkGLDrawable);
227 * Fills *width and *height with the size of GL drawable.
228 * width or height can be NULL if you only want the other one.
229 * gldrawable:
230 * a GdkGLDrawable.
231 * width:
232 * location to store drawable's width, or NULL.
233 * height:
234 * location to store drawable's height, or NULL.
236 public void getSize(int* width, int* height)
238 // void gdk_gl_drawable_get_size (GdkGLDrawable *gldrawable, gint *width, gint *height);
239 gdk_gl_drawable_get_size(gdkGLDrawable, width, height);
243 * Returns the current GdkGLDrawable.
244 * Returns:
245 * the current GdkGLDrawable or NULL if there is no current drawable.
246 * <<Rendering Context
247 * OpenGL Pixmap>>
249 public static GdkGLDrawable* getCurrent()
251 // GdkGLDrawable* gdk_gl_drawable_get_current (void);
252 return gdk_gl_drawable_get_current();