alternative to assert
[gtkD.git] / gtkD / srcgl / glgdk / GLConfig.d
blob7900549c941bee08740d44930a8f55528168eb40
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-gdkglconfig.html
26 * outPack = glgdk
27 * outFile = GLConfig
28 * strct = GdkGLConfig
29 * realStrct=
30 * ctorStrct=
31 * clss = GLConfig
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_gl_config_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - glib.Str
45 * - gdk.Screen
46 * structWrap:
47 * - GdkScreen* -> Screen
48 * module aliases:
49 * local aliases:
52 module glgdk.GLConfig;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gtkglc.glgdktypes;
64 private import gtkglc.glgdk;
67 private import glib.Str;
68 private import gdk.Screen;
73 /**
74 * Description
76 private import gobject.ObjectG;
77 public class GLConfig : ObjectG
80 /** the main Gtk struct */
81 protected GdkGLConfig* gdkGLConfig;
84 public GdkGLConfig* getGLConfigStruct()
86 return gdkGLConfig;
90 /** the main Gtk struct as a void* */
91 protected void* getStruct()
93 return cast(void*)gdkGLConfig;
96 /**
97 * Sets our main struct and passes it to the parent class
99 public this (GdkGLConfig* gdkGLConfig)
101 version(noAssert)
103 if ( gdkGLConfig is null )
105 int zero = 0;
106 version(Tango)
108 Stdout("struct gdkGLConfig is null on constructor").newline;
110 else
112 printf("struct gdkGLConfig is null on constructor");
114 zero = zero / zero;
117 else
119 assert(gdkGLConfig !is null, "struct gdkGLConfig is null on constructor");
121 super(cast(GObject*)gdkGLConfig);
122 this.gdkGLConfig = gdkGLConfig;
126 * Creates a mew OpenGL frame buffer configuration that match the specified display mode,
127 * or the fallback mode.
128 * @param mode display mode bit mask.
130 this(GLConfigMode mode, GLConfigMode fallback)
133 gdkGLConfig = cast(GdkGLConfig*)gdk_gl_config_new_by_mode(mode);
134 if ( gdkGLConfig is null )
136 printf ("*** Cannot find the double-buffered visual.\n");
137 printf ("*** Trying single-buffered visual.\n");
138 gdkGLConfig = cast(GdkGLConfig*)gdk_gl_config_new_by_mode(fallback);
140 if ( gdkGLConfig is null )
142 printf ("*** No appropriate OpenGL-capable visual found.\n");
143 throw new Error("GL configure failed");
145 this(gdkGLConfig);
155 * Returns an OpenGL frame buffer configuration that match the specified
156 * attributes.
157 * attrib_list is a int array that contains the attribute/value pairs.
158 * Available attributes are:
159 * GDK_GL_USE_GL, GDK_GL_BUFFER_SIZE, GDK_GL_LEVEL, GDK_GL_RGBA,
160 * GDK_GL_DOUBLEBUFFER, GDK_GL_STEREO, GDK_GL_AUX_BUFFERS,
161 * GDK_GL_RED_SIZE, GDK_GL_GREEN_SIZE, GDK_GL_BLUE_SIZE, GDK_GL_ALPHA_SIZE,
162 * GDK_GL_DEPTH_SIZE, GDK_GL_STENCIL_SIZE, GDK_GL_ACCUM_RED_SIZE,
163 * GDK_GL_ACCUM_GREEN_SIZE, GDK_GL_ACCUM_BLUE_SIZE, GDK_GL_ACCUM_ALPHA_SIZE.
164 * attrib_list:
165 * a list of attribute/value pairs. The last attribute must
166 * be GDK_GL_ATTRIB_LIST_NONE.
167 * Returns:
168 * the new GdkGLConfig.
170 public this (int* attribList)
172 // GdkGLConfig* gdk_gl_config_new (const int *attrib_list);
173 this(cast(GdkGLConfig*)gdk_gl_config_new(attribList) );
177 * Returns an OpenGL frame buffer configuration that match the specified
178 * attributes.
179 * screen:
180 * target screen.
181 * attrib_list:
182 * a list of attribute/value pairs. The last attribute must
183 * be GDK_GL_ATTRIB_LIST_NONE.
184 * Returns:
185 * the new GdkGLConfig.
187 public this (Screen screen, int* attribList)
189 // GdkGLConfig* gdk_gl_config_new_for_screen (GdkScreen *screen, const int *attrib_list);
190 this(cast(GdkGLConfig*)gdk_gl_config_new_for_screen((screen is null) ? null : screen.getScreenStruct(), attribList) );
194 * Returns an OpenGL frame buffer configuration that match the specified
195 * display mode.
196 * mode:
197 * display mode bit mask.
198 * Returns:
199 * the new GdkGLConfig.
201 public this (GdkGLConfigMode mode)
203 // GdkGLConfig* gdk_gl_config_new_by_mode (GdkGLConfigMode mode);
204 this(cast(GdkGLConfig*)gdk_gl_config_new_by_mode(mode) );
208 * Returns an OpenGL frame buffer configuration that match the specified
209 * display mode.
210 * screen:
211 * target screen.
212 * mode:
213 * display mode bit mask.
214 * Returns:
215 * the new GdkGLConfig.
217 public this (Screen screen, GdkGLConfigMode mode)
219 // GdkGLConfig* gdk_gl_config_new_by_mode_for_screen (GdkScreen *screen, GdkGLConfigMode mode);
220 this(cast(GdkGLConfig*)gdk_gl_config_new_by_mode_for_screen((screen is null) ? null : screen.getScreenStruct(), mode) );
224 * Gets GdkScreen.
225 * glconfig:
226 * a GdkGLConfig.
227 * Returns:
228 * the GdkScreen.
230 public Screen getScreen()
232 // GdkScreen* gdk_gl_config_get_screen (GdkGLConfig *glconfig);
233 return new Screen( gdk_gl_config_get_screen(gdkGLConfig) );
237 * Gets information about a OpenGL frame buffer configuration.
238 * glconfig:
239 * a GdkGLConfig.
240 * attribute:
241 * the attribute to be returned.
242 * value:
243 * returns the requested value.
244 * Returns:
245 * TRUE if it succeeded, FALSE otherwise.
247 public int getAttrib(int attribute, int* value)
249 // gboolean gdk_gl_config_get_attrib (GdkGLConfig *glconfig, int attribute, int *value);
250 return gdk_gl_config_get_attrib(gdkGLConfig, attribute, value);
254 * Gets the GdkColormap that is appropriate for the OpenGL frame buffer
255 * configuration.
256 * glconfig:
257 * a GdkGLConfig.
258 * Returns:
259 * the appropriate GdkColormap.
261 public GdkColormap* getColormap()
263 // GdkColormap* gdk_gl_config_get_colormap (GdkGLConfig *glconfig);
264 return gdk_gl_config_get_colormap(gdkGLConfig);
268 * Gets the GdkVisual that is appropriate for the OpenGL frame buffer
269 * configuration.
270 * glconfig:
271 * a GdkGLConfig.
272 * Returns:
273 * the appropriate GdkVisual.
275 public GdkVisual* getVisual()
277 // GdkVisual* gdk_gl_config_get_visual (GdkGLConfig *glconfig);
278 return gdk_gl_config_get_visual(gdkGLConfig);
282 * Gets the color depth of the OpenGL-capable visual.
283 * glconfig:
284 * a GdkGLConfig.
285 * Returns:
286 * number of bits per pixel
288 public int getDepth()
290 // gint gdk_gl_config_get_depth (GdkGLConfig *glconfig);
291 return gdk_gl_config_get_depth(gdkGLConfig);
295 * Gets the layer plane (level) of the frame buffer.
296 * Zero is the default frame buffer.
297 * Positive layer planes correspond to frame buffers that overlay the default
298 * buffer, and negative layer planes correspond to frame buffers that underlie
299 * the default frame buffer.
300 * glconfig:
301 * a GdkGLConfig.
302 * Returns:
303 * layer plane.
305 public int getLayerPlane()
307 // gint gdk_gl_config_get_layer_plane (GdkGLConfig *glconfig);
308 return gdk_gl_config_get_layer_plane(gdkGLConfig);
312 * Gets the number of auxiliary color buffers.
313 * glconfig:
314 * a GdkGLConfig.
315 * Returns:
316 * number of auxiliary color buffers.
318 public int getNAuxBuffers()
320 // gint gdk_gl_config_get_n_aux_buffers (GdkGLConfig *glconfig);
321 return gdk_gl_config_get_n_aux_buffers(gdkGLConfig);
325 * Gets the number of multisample buffers.
326 * glconfig:
327 * a GdkGLConfig.
328 * Returns:
329 * number of multisample buffers.
331 public int getNSampleBuffers()
333 // gint gdk_gl_config_get_n_sample_buffers (GdkGLConfig *glconfig);
334 return gdk_gl_config_get_n_sample_buffers(gdkGLConfig);
338 * Returns whether the configured frame buffer is RGBA mode.
339 * glconfig:
340 * a GdkGLConfig.
341 * Returns:
342 * TRUE if the configured frame buffer is RGBA mode, FALSE
343 * otherwise.
345 public int isRgba()
347 // gboolean gdk_gl_config_is_rgba (GdkGLConfig *glconfig);
348 return gdk_gl_config_is_rgba(gdkGLConfig);
352 * Returns whether the configuration supports the double-buffered visual.
353 * glconfig:
354 * a GdkGLConfig.
355 * Returns:
356 * TRUE if the double-buffered visual is supported, FALSE
357 * otherwise.
359 public int isDoubleBuffered()
361 // gboolean gdk_gl_config_is_double_buffered (GdkGLConfig *glconfig);
362 return gdk_gl_config_is_double_buffered(gdkGLConfig);
366 * Returns whether the configuration supports the stereo visual.
367 * glconfig:
368 * a GdkGLConfig.
369 * Returns:
370 * TRUE if the stereo visual is supported, FALSE otherwise.
372 public int isStereo()
374 // gboolean gdk_gl_config_is_stereo (GdkGLConfig *glconfig);
375 return gdk_gl_config_is_stereo(gdkGLConfig);
379 * Returns whether the configured color buffer has alpha bits.
380 * glconfig:
381 * a GdkGLConfig.
382 * Returns:
383 * TRUE if the color buffer has alpha bits, FALSE otherwise.
385 public int hasAlpha()
387 // gboolean gdk_gl_config_has_alpha (GdkGLConfig *glconfig);
388 return gdk_gl_config_has_alpha(gdkGLConfig);
392 * Returns whether the configured frame buffer has depth buffer.
393 * glconfig:
394 * a GdkGLConfig.
395 * Returns:
396 * TRUE if the frame buffer has depth buffer, FALSE otherwise.
398 public int hasDepthBuffer()
400 // gboolean gdk_gl_config_has_depth_buffer (GdkGLConfig *glconfig);
401 return gdk_gl_config_has_depth_buffer(gdkGLConfig);
405 * Returns whether the configured frame buffer has stencil buffer.
406 * glconfig:
407 * a GdkGLConfig.
408 * Returns:
409 * TRUE if the frame buffer has stencil buffer, FALSE otherwise.
411 public int hasStencilBuffer()
413 // gboolean gdk_gl_config_has_stencil_buffer (GdkGLConfig *glconfig);
414 return gdk_gl_config_has_stencil_buffer(gdkGLConfig);
418 * Returns whether the configured frame buffer has accumulation buffer.
419 * glconfig:
420 * a GdkGLConfig.
421 * Returns:
422 * TRUE if the frame buffer has accumulation buffer, FALSE
423 * otherwise.
424 * <<Query
425 * Rendering Context>>
427 public int hasAccumBuffer()
429 // gboolean gdk_gl_config_has_accum_buffer (GdkGLConfig *glconfig);
430 return gdk_gl_config_has_accum_buffer(gdkGLConfig);