Mx support.
[girtod.git] / gtk2 / cogl.d
blob570c15bc381da12810b6917c9a812d66ed62dc81
1 // *** DO NOT EDIT ***
2 // Automatically generated from "/usr/share/gir-1.0/Cogl-1.0.gir"
4 module Cogl;
5 public import gtk2.gl;
6 alias gtk2.gl GL;
7 public import gtk2.glib2;
8 alias gtk2.glib2 GLib2;
9 public import gtk2.gobject2;
10 alias gtk2.gobject2 GObject2;
12 // package: "cogl-1.0";
13 // C header: "cogl/cogl.h";
15 // c:symbol-prefixes: ["cogl"]
16 // c:identifier-prefixes: ["Cogl"]
18 // module Cogl;
20 // --- mixin/Cogl__MODULE_HEAD.d --->
22 // Cogl-1.0.gir as of 1.9.4 is missing some things;
23 // let's add just enough to make it usable:
25 // Really X11, but this will do for now.
27 private alias void XVisualInfo;
28 private alias void XEvent;
30 // <--- mixin/Cogl__MODULE_HEAD.d ---
33 // Integer representation of an angle such that 1024 corresponds to
34 // full circle (i.e., 2 * pi).
35 alias int Angle;
37 // Type used for storing references to cogl objects, the CoglHandle is
38 // a fully opaque type without any public data members.
39 alias void* Handle;
40 enum int AFIRST_BIT = 64;
41 enum int A_BIT = 16;
42 struct Attribute {
44 // Unintrospectable method: get_buffer() / cogl_attribute_get_buffer()
45 // VERSION: 1.10
46 // cogl_attribute_set_buffer() or cogl_attribute_new().
47 // RETURNS: the #CoglAttributeBuffer that was set with
48 AttributeBuffer* get_buffer()() {
49 return cogl_attribute_get_buffer(&this);
52 // VERSION: 1.10
53 // cogl_attribute_set_normalized().
54 // RETURNS: the value of the normalized property set with
55 int get_normalized()() {
56 return cogl_attribute_get_normalized(&this);
59 // VERSION: 1.10
60 // Sets a new #CoglAttributeBuffer for the attribute.
61 // <attribute_buffer>: A #CoglAttributeBuffer
62 void set_buffer()(AttributeBuffer* attribute_buffer) {
63 cogl_attribute_set_buffer(&this, attribute_buffer);
66 // VERSION: 1.10
67 // Sets whether fixed point attribute types are mapped to the range
68 // 0→1. For example when this property is TRUE and a
69 // %COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE type is used then the value 255
70 // will be mapped to 1.0.
71 //
72 // The default value of this property depends on the name of the
73 // attribute. For the builtin properties cogl_color_in and
74 // cogl_normal_in it will default to TRUE and for all other names it
75 // will default to FALSE.
76 // <normalized>: The new value for the normalized property.
77 void set_normalized()(int normalized) {
78 cogl_attribute_set_normalized(&this, normalized);
81 // Unintrospectable function: new() / cogl_attribute_new()
82 // VERSION: 1.4
83 // Describes the layout for a list of vertex attribute values (For
84 // example, a list of texture coordinates or colors).
85 //
86 // The @name is used to access the attribute inside a GLSL vertex
87 // shader and there are some special names you should use if they are
88 // applicable:
89 // <itemizedlist>
90 // <listitem>"cogl_position_in" (used for vertex positions)</listitem>
91 // <listitem>"cogl_color_in" (used for vertex colors)</listitem>
92 // <listitem>"cogl_tex_coord0_in", "cogl_tex_coord1", ...
93 // (used for vertex texture coordinates)</listitem>
94 // <listitem>"cogl_normal_in" (used for vertex normals)</listitem>
95 // </itemizedlist>
96 //
97 // The attribute values corresponding to different vertices can either
98 // be tightly packed or interleaved with other attribute values. For
99 // example it's common to define a structure for a single vertex like:
100 // |[
101 // typedef struct
102 // {
103 // float x, y, z; /<!-- -->* position attribute *<!-- -->/
104 // float s, t; /<!-- -->* texture coordinate attribute *<!-- -->/
105 // } MyVertex;
106 // ]|
108 // And then create an array of vertex data something like:
109 // |[
110 // MyVertex vertices[100] = { .... }
111 // ]|
113 // In this case, to describe either the position or texture coordinate
114 // attribute you have to move <pre>sizeof (MyVertex)</pre> bytes to
115 // move from one vertex to the next. This is called the attribute
116 // @stride. If you weren't interleving attributes and you instead had
117 // a packed array of float x, y pairs then the attribute stride would
118 // be <pre>(2 * sizeof (float))</pre>. So the @stride is the number of
119 // bytes to move to find the attribute value of the next vertex.
121 // Normally a list of attributes starts at the beginning of an array.
122 // So for the <pre>MyVertex</pre> example above the @offset is the
123 // offset inside the <pre>MyVertex</pre> structure to the first
124 // component of the attribute. For the texture coordinate attribute
125 // the offset would be <pre>offsetof (MyVertex, s)</pre> or instead of
126 // using the offsetof macro you could use <pre>sizeof (float) * 3</pre>.
127 // If you've divided your @array into blocks of non-interleved
128 // attributes then you will need to calculate the @offset as the
129 // number of bytes in blocks preceding the attribute you're
130 // describing.
132 // An attribute often has more than one component. For example a color
133 // is often comprised of 4 red, green, blue and alpha @components, and a
134 // position may be comprised of 2 x and y @components. You should aim
135 // to keep the number of components to a minimum as more components
136 // means more data needs to be mapped into the GPU which can be a
137 // bottlneck when dealing with a large number of vertices.
139 // Finally you need to specify the component data type. Here you
140 // should aim to use the smallest type that meets your precision
141 // requirements. Again the larger the type then more data needs to be
142 // mapped into the GPU which can be a bottlneck when dealing with
143 // a large number of vertices.
145 // layout for a list of attribute values stored in @array.
146 // RETURNS: A newly allocated #CoglAttribute describing the
147 // <attribute_buffer>: The #CoglAttributeBuffer containing the actual attribute data
148 // <name>: The name of the attribute (used to reference it from GLSL)
149 // <stride>: The number of bytes to jump to get to the next attribute value for the next vertex. (Usually <pre>sizeof (MyVertex)</pre>)
150 // <offset>: The byte offset from the start of @attribute_buffer for the first attribute value. (Usually <pre>offsetof (MyVertex, component0)</pre>
151 // <components>: The number of components (e.g. 4 for an rgba color or 3 for and (x,y,z) position)
152 // <type>: FIXME
153 static Attribute* new_()(AttributeBuffer* attribute_buffer, char* name, size_t stride, size_t offset, int components, AttributeType type) {
154 return cogl_attribute_new(attribute_buffer, name, stride, offset, components, type);
158 struct AttributeBuffer {
160 // Unintrospectable function: new() / cogl_attribute_buffer_new()
161 // VERSION: 1.4
162 // Declares a new #CoglAttributeBuffer of @size bytes to contain arrays of vertex
163 // attribute data. Once declared, data can be set using cogl_buffer_set_data()
164 // or by mapping it into the application's address space using cogl_buffer_map().
166 // If @data isn't %NULL then @size bytes will be read from @data and
167 // immediately copied into the new buffer.
168 // <bytes>: The number of bytes to allocate for vertex attribute data.
169 // <data>: An optional pointer to vertex data to upload immediately.
170 static AttributeBuffer* new_()(size_t bytes, void* data) {
171 return cogl_attribute_buffer_new(bytes, data);
175 // Data types for the components of a vertex attribute.
176 enum AttributeType /* Version 1.0 */ {
177 BYTE = 5120,
178 UNSIGNED_BYTE = 5121,
179 SHORT = 5122,
180 UNSIGNED_SHORT = 5123,
181 FLOAT = 5126
183 enum int BGR_BIT = 32;
184 struct Bitmap {
186 // VERSION: 1.0
187 // Parses an image file enough to extract the width and height
188 // of the bitmap.
189 // RETURNS: %TRUE if the image was successfully parsed
190 // <filename>: the file to check
191 // <width>: return location for the bitmap width, or %NULL
192 // <height>: return location for the bitmap height, or %NULL
193 static int get_size_from_file()(char* filename, /*out*/ int* width, /*out*/ int* height) {
194 return cogl_bitmap_get_size_from_file(filename, width, height);
197 // Unintrospectable function: new_from_buffer() / cogl_bitmap_new_from_buffer()
198 // VERSION: 1.8
199 // Wraps some image data that has been uploaded into a #CoglBuffer as
200 // a #CoglBitmap. The data is not copied in this process.
201 // RETURNS: a #CoglBitmap encapsulating the given @buffer.
202 // <buffer>: A #CoglBuffer containing image data
203 // <format>: The #CoglPixelFormat defining the format of the image data in the given @buffer.
204 // <width>: The width of the image data in the given @buffer.
205 // <height>: The height of the image data in the given @buffer.
206 // <rowstride>: The rowstride in bytes of the image data in the given @buffer.
207 // <offset>: The offset into the given @buffer to the first pixel that should be considered part of the #CoglBitmap.
208 static Bitmap* new_from_buffer()(Buffer* buffer, PixelFormat format, int width, int height, int rowstride, int offset) {
209 return cogl_bitmap_new_from_buffer(buffer, format, width, height, rowstride, offset);
212 // Unintrospectable function: new_from_file() / cogl_bitmap_new_from_file()
213 // VERSION: 1.0
214 // Loads an image file from disk. This function can be safely called from
215 // within a thread.
217 // %NULL if loading the image failed.
218 // RETURNS: a #CoglBitmap to the new loaded image data, or
219 // <filename>: the file to load.
220 static Bitmap* new_from_file()(char* filename, GLib2.Error** error=null) {
221 return cogl_bitmap_new_from_file(filename, error);
226 // Error codes that can be thrown when performing bitmap
227 // operations. Note that gdk_pixbuf_new_from_file() can also throw
228 // errors directly from the underlying image loading library. For
229 // example, if GdkPixbuf is used then errors #GdkPixbufError<!-- -->s
230 // will be used directly.
231 enum BitmapError /* Version 1.4 */ {
232 FAILED = 0,
233 UNKNOWN_TYPE = 1,
234 CORRUPT_IMAGE = 2
236 // Error enumeration for the blend strings parser
237 enum BlendStringError /* Version 1.0 */ {
238 PARSE_ERROR = 0,
239 ARGUMENT_PARSE_ERROR = 1,
240 INVALID_ERROR = 2,
241 GPU_UNSUPPORTED_ERROR = 3
243 struct Buffer {
245 // VERSION: 1.2
246 // Retrieves the size of buffer
247 // RETURNS: the size of the buffer in bytes
248 uint get_size()() {
249 return cogl_buffer_get_size(&this);
252 // VERSION: 1.2
253 // Retrieves the update hints set using cogl_buffer_set_update_hint()
254 // RETURNS: the #CoglBufferUpdateHint currently used by the buffer
255 BufferUpdateHint get_update_hint()() {
256 return cogl_buffer_get_update_hint(&this);
259 // Unintrospectable method: map() / cogl_buffer_map()
260 // VERSION: 1.2
261 // Maps the buffer into the application address space for direct access.
263 // It is strongly recommended that you pass
264 // %COGL_BUFFER_MAP_HINT_DISCARD as a hint if you are going to replace
265 // all the buffer's data. This way if the buffer is currently being
266 // used by the GPU then the driver won't have to stall the CPU and
267 // wait for the hardware to finish because it can instead allocate a
268 // new buffer to map.
270 // The behaviour is undefined if you access the buffer in a way
271 // conflicting with the @access mask you pass. It is also an error to
272 // release your last reference while the buffer is mapped.
273 // RETURNS: A pointer to the mapped memory or %NULL is the call fails
274 // <access>: how the mapped buffer will be used by the application
275 // <hints>: A mask of #CoglBufferMapHint<!-- -->s that tell Cogl how the data will be modified once mapped.
276 void* map()(BufferAccess access, BufferMapHint hints) {
277 return cogl_buffer_map(&this, access, hints);
280 // VERSION: 1.2
281 // Updates part of the buffer with new data from @data. Where to put this new
282 // data is controlled by @offset and @offset + @data should be less than the
283 // buffer size.
284 // RETURNS: %TRUE is the operation succeeded, %FALSE otherwise
285 // <offset>: destination offset (in bytes) in the buffer
286 // <data>: a pointer to the data to be copied into the buffer
287 // <size>: number of bytes to copy
288 int set_data()(size_t offset, void* data, size_t size) {
289 return cogl_buffer_set_data(&this, offset, data, size);
292 // VERSION: 1.2
293 // Sets the update hint on a buffer. See #CoglBufferUpdateHint for a description
294 // of the available hints.
295 // <hint>: the new hint
296 void set_update_hint()(BufferUpdateHint hint) {
297 cogl_buffer_set_update_hint(&this, hint);
300 // VERSION: 1.2
301 // Unmaps a buffer previously mapped by cogl_buffer_map().
302 void unmap()() {
303 cogl_buffer_unmap(&this);
307 // The access hints for cogl_buffer_set_update_hint()
308 enum BufferAccess /* Version 1.2 */ {
309 READ = 1,
310 WRITE = 2,
311 READ_WRITE = 3
313 // Types of auxiliary buffers
314 enum BufferBit /* Version 1.0 */ {
315 COLOR = 1,
316 DEPTH = 2,
317 STENCIL = 4
320 // Hints to Cogl about how you are planning to modify the data once it
321 // is mapped.
322 enum BufferMapHint /* Version 1.4 */ {
323 DISCARD = 1
325 // Target flags for FBOs.
326 enum BufferTarget /* Version 0.8 */ {
327 WINDOW_BUFFER = 2,
328 OFFSCREEN_BUFFER = 4
331 // The update hint on a buffer allows the user to give some detail on how often
332 // the buffer data is going to be updated.
333 enum BufferUpdateHint /* Version 1.2 */ {
334 STATIC = 0,
335 DYNAMIC = 1,
336 STREAM = 2
339 // A structure for holding a color definition. The contents of
340 // the CoglColor structure are private and should never by accessed
341 // directly.
342 struct Color /* Version 1.0 */ {
343 private ubyte red, green, blue, alpha;
344 private uint padding0, padding1, padding2;
347 // Unintrospectable method: copy() / cogl_color_copy()
348 // VERSION: 1.0
349 // Creates a copy of @color
351 // to free the allocate resources
352 // RETURNS: a newly-allocated #CoglColor. Use cogl_color_free()
353 Color* copy()() {
354 return cogl_color_copy(&this);
357 // VERSION: 1.0
358 // Frees the resources allocated by cogl_color_new() and cogl_color_copy()
359 void free()() {
360 cogl_color_free(&this);
363 // VERSION: 1.0
364 // Retrieves the alpha channel of @color as a fixed point
365 // value between 0 and %1.0.
366 // RETURNS: the alpha channel of the passed color
367 float get_alpha()() {
368 return cogl_color_get_alpha(&this);
371 // VERSION: 1.0
372 // Retrieves the alpha channel of @color as a byte value
373 // between 0 and 255
374 // RETURNS: the alpha channel of the passed color
375 ubyte get_alpha_byte()() {
376 return cogl_color_get_alpha_byte(&this);
379 // VERSION: 1.0
380 // Retrieves the alpha channel of @color as a floating point
381 // value between 0.0 and 1.0
382 // RETURNS: the alpha channel of the passed color
383 float get_alpha_float()() {
384 return cogl_color_get_alpha_float(&this);
387 // VERSION: 1.0
388 // Retrieves the blue channel of @color as a fixed point
389 // value between 0 and %1.0.
390 // RETURNS: the blue channel of the passed color
391 float get_blue()() {
392 return cogl_color_get_blue(&this);
395 // VERSION: 1.0
396 // Retrieves the blue channel of @color as a byte value
397 // between 0 and 255
398 // RETURNS: the blue channel of the passed color
399 ubyte get_blue_byte()() {
400 return cogl_color_get_blue_byte(&this);
403 // VERSION: 1.0
404 // Retrieves the blue channel of @color as a floating point
405 // value between 0.0 and 1.0
406 // RETURNS: the blue channel of the passed color
407 float get_blue_float()() {
408 return cogl_color_get_blue_float(&this);
411 // VERSION: 1.0
412 // Retrieves the green channel of @color as a fixed point
413 // value between 0 and %1.0.
414 // RETURNS: the green channel of the passed color
415 float get_green()() {
416 return cogl_color_get_green(&this);
419 // VERSION: 1.0
420 // Retrieves the green channel of @color as a byte value
421 // between 0 and 255
422 // RETURNS: the green channel of the passed color
423 ubyte get_green_byte()() {
424 return cogl_color_get_green_byte(&this);
427 // VERSION: 1.0
428 // Retrieves the green channel of @color as a floating point
429 // value between 0.0 and 1.0
430 // RETURNS: the green channel of the passed color
431 float get_green_float()() {
432 return cogl_color_get_green_float(&this);
435 // VERSION: 1.0
436 // Retrieves the red channel of @color as a fixed point
437 // value between 0 and %1.0.
438 // RETURNS: the red channel of the passed color
439 float get_red()() {
440 return cogl_color_get_red(&this);
443 // VERSION: 1.0
444 // Retrieves the red channel of @color as a byte value
445 // between 0 and 255
446 // RETURNS: the red channel of the passed color
447 ubyte get_red_byte()() {
448 return cogl_color_get_red_byte(&this);
451 // VERSION: 1.0
452 // Retrieves the red channel of @color as a floating point
453 // value between 0.0 and 1.0
454 // RETURNS: the red channel of the passed color
455 float get_red_float()() {
456 return cogl_color_get_red_float(&this);
459 // VERSION: 1.4
460 // Sets the values of the passed channels into a #CoglColor
461 // <red>: value of the red channel, between 0 and %1.0
462 // <green>: value of the green channel, between 0 and %1.0
463 // <blue>: value of the blue channel, between 0 and %1.0
464 // <alpha>: value of the alpha channel, between 0 and %1.0
465 void init_from_4f()(float red, float green, float blue, float alpha) {
466 cogl_color_init_from_4f(&this, red, green, blue, alpha);
469 // VERSION: 1.4
470 // Sets the values of the passed channels into a #CoglColor
471 // <color_array>: a pointer to an array of 4 float color components
472 void init_from_4fv()(float* color_array) {
473 cogl_color_init_from_4fv(&this, color_array);
476 // VERSION: 1.4
477 // Sets the values of the passed channels into a #CoglColor.
478 // <red>: value of the red channel, between 0 and 255
479 // <green>: value of the green channel, between 0 and 255
480 // <blue>: value of the blue channel, between 0 and 255
481 // <alpha>: value of the alpha channel, between 0 and 255
482 void init_from_4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) {
483 cogl_color_init_from_4ub(&this, red, green, blue, alpha);
486 // VERSION: 1.0
487 // Converts a non-premultiplied color to a pre-multiplied color. For
488 // example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied
489 // and (0.5, 0, 0, 0.5) when premultiplied.
490 void premultiply()() {
491 cogl_color_premultiply(&this);
494 // VERSION: 1.4
495 // Sets the alpha channel of @color to @alpha.
496 // <alpha>: a float value between 0.0f and 1.0f
497 void set_alpha()(float alpha) {
498 cogl_color_set_alpha(&this, alpha);
501 // VERSION: 1.4
502 // Sets the alpha channel of @color to @alpha.
503 // <alpha>: a byte value between 0 and 255
504 void set_alpha_byte()(ubyte alpha) {
505 cogl_color_set_alpha_byte(&this, alpha);
508 // VERSION: 1.4
509 // Sets the alpha channel of @color to @alpha.
510 // <alpha>: a float value between 0.0f and 1.0f
511 void set_alpha_float()(float alpha) {
512 cogl_color_set_alpha_float(&this, alpha);
515 // VERSION: 1.4
516 // Sets the blue channel of @color to @blue.
517 // <blue>: a float value between 0.0f and 1.0f
518 void set_blue()(float blue) {
519 cogl_color_set_blue(&this, blue);
522 // VERSION: 1.4
523 // Sets the blue channel of @color to @blue.
524 // <blue>: a byte value between 0 and 255
525 void set_blue_byte()(ubyte blue) {
526 cogl_color_set_blue_byte(&this, blue);
529 // VERSION: 1.4
530 // Sets the blue channel of @color to @blue.
531 // <blue>: a float value between 0.0f and 1.0f
532 void set_blue_float()(float blue) {
533 cogl_color_set_blue_float(&this, blue);
536 // VERSION: 1.0
537 // DEPRECATED (v1.4) method: set_from_4f - Use cogl_color_init_from_4f instead.
538 // Sets the values of the passed channels into a #CoglColor
539 // <red>: value of the red channel, between 0 and %1.0
540 // <green>: value of the green channel, between 0 and %1.0
541 // <blue>: value of the blue channel, between 0 and %1.0
542 // <alpha>: value of the alpha channel, between 0 and %1.0
543 void set_from_4f()(float red, float green, float blue, float alpha) {
544 cogl_color_set_from_4f(&this, red, green, blue, alpha);
547 // VERSION: 1.0
548 // DEPRECATED (v1.4) method: set_from_4ub - Use cogl_color_init_from_4ub instead.
549 // Sets the values of the passed channels into a #CoglColor.
550 // <red>: value of the red channel, between 0 and 255
551 // <green>: value of the green channel, between 0 and 255
552 // <blue>: value of the blue channel, between 0 and 255
553 // <alpha>: value of the alpha channel, between 0 and 255
554 void set_from_4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) {
555 cogl_color_set_from_4ub(&this, red, green, blue, alpha);
558 // VERSION: 1.4
559 // Sets the green channel of @color to @green.
560 // <green>: a float value between 0.0f and 1.0f
561 void set_green()(float green) {
562 cogl_color_set_green(&this, green);
565 // VERSION: 1.4
566 // Sets the green channel of @color to @green.
567 // <green>: a byte value between 0 and 255
568 void set_green_byte()(ubyte green) {
569 cogl_color_set_green_byte(&this, green);
572 // VERSION: 1.4
573 // Sets the green channel of @color to @green.
574 // <green>: a float value between 0.0f and 1.0f
575 void set_green_float()(float green) {
576 cogl_color_set_green_float(&this, green);
579 // VERSION: 1.4
580 // Sets the red channel of @color to @red.
581 // <red>: a float value between 0.0f and 1.0f
582 void set_red()(float red) {
583 cogl_color_set_red(&this, red);
586 // VERSION: 1.4
587 // Sets the red channel of @color to @red.
588 // <red>: a byte value between 0 and 255
589 void set_red_byte()(ubyte red) {
590 cogl_color_set_red_byte(&this, red);
593 // VERSION: 1.4
594 // Sets the red channel of @color to @red.
595 // <red>: a float value between 0.0f and 1.0f
596 void set_red_float()(float red) {
597 cogl_color_set_red_float(&this, red);
600 // VERSION: 1.4
601 // Converts a pre-multiplied color to a non-premultiplied color. For
602 // example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied
603 // and (1.0, 0, 0, 0.5) when non-premultiplied.
604 void unpremultiply()() {
605 cogl_color_unpremultiply(&this);
608 // VERSION: 1.0
609 // Compares two #CoglColor<!-- -->s and checks if they are the same.
611 // This function can be passed to g_hash_table_new() as the @key_equal_func
612 // parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
613 // RETURNS: %TRUE if the two colors are the same.
614 // <v1>: a #CoglColor
615 // <v2>: a #CoglColor
616 static int equal()(const(void)* v1, const(void)* v2) {
617 return cogl_color_equal(v1, v2);
620 // Unintrospectable function: new() / cogl_color_new()
621 // VERSION: 1.0
622 // Creates a new (empty) color
624 // to free the allocated resources
625 // RETURNS: a newly-allocated #CoglColor. Use cogl_color_free()
626 static Color* new_()() {
627 return cogl_color_new();
632 // Defines a bit mask of color channels. This can be used with
633 // cogl_pipeline_set_color_mask() for example to define which color
634 // channels should be written to the current framebuffer when
635 // drawing something.
636 enum ColorMask {
637 NONE = 0,
638 RED = 1,
639 GREEN = 2,
640 BLUE = 4,
641 ALPHA = 8,
642 ALL = 15
644 struct Context {
646 // VERSION: 1.8
647 // Retrieves the #CoglDisplay that is internally associated with the
648 // given @context. This will return the same #CoglDisplay that was
649 // passed to cogl_context_new() or if %NULL was passed to
650 // cogl_context_new() then this function returns a pointer to the
651 // display that was automatically setup internally.
653 // given @context.
654 // RETURNS: The #CoglDisplay associated with the
655 Cogl.Display* get_display()() {
656 return cogl_context_get_display(&this);
659 // Unintrospectable function: new() / cogl_context_new()
660 // VERSION: 1.8
661 // Creates a new #CoglContext which acts as an application sandbox
662 // for any state objects that are allocated.
663 // RETURNS: A newly allocated #CoglContext
664 // <display>: A #CoglDisplay pointer
665 static Cogl.Context* /*new*/ new_()(Cogl.Display* display, GLib2.Error** error=null) {
666 return cogl_context_new(display, error);
671 // VERSION: 1.8
672 // A callback function to use for cogl_debug_object_foreach_type().
673 // <info>: A pointer to a struct containing information about the type.
674 extern (C) alias void function (DebugObjectTypeInfo* info, void* user_data) DebugObjectForeachTypeCallback;
677 // This struct is used to pass information to the callback when
678 // cogl_debug_object_foreach_type() is called.
679 struct DebugObjectTypeInfo /* Version 1.8 */ {
680 char* name;
681 uint instance_count;
684 struct DepthState {
685 uint magic;
686 int test_enabled;
687 DepthTestFunction test_function;
688 int write_enabled;
689 float range_near, range_far;
690 uint padding0, padding1, padding2, padding3, padding4, padding5, padding6, padding7, padding8, padding9;
693 // VERSION: 2.0
694 // Gets the current range to which normalized depth values are mapped
695 // before writing to the depth buffer. This corresponds to the range
696 // set with cogl_pipeline_set_depth_range().
697 // <near_val>: A pointer to store the near component of the depth range
698 // <far_val>: A pointer to store the far component of the depth range
699 void get_range()(float* near_val, float* far_val) {
700 cogl_depth_state_get_range(&this, near_val, far_val);
703 // VERSION: 2.0
704 // Gets the current depth test enabled state as previously set by
705 // cogl_depth_state_set_test_enabled().
706 // RETURNS: The pipeline's current depth test enabled state.
707 int get_test_enabled()() {
708 return cogl_depth_state_get_test_enabled(&this);
711 // VERSION: 2.0
712 // Gets the current depth test enable state as previously set via
713 // cogl_pipeline_set_depth_test_enabled().
714 // RETURNS: The current depth test enable state.
715 DepthTestFunction get_test_function()() {
716 return cogl_depth_state_get_test_function(&this);
719 // VERSION: 2.0
720 // Gets the depth writing enable state as set by the corresponding
721 // cogl_pipeline_set_depth_writing_enabled.
722 // RETURNS: The current depth writing enable state
723 int get_write_enabled()() {
724 return cogl_depth_state_get_write_enabled(&this);
727 // VERSION: 2.0
728 // Initializes the members of @state to their default values.
730 // You should never pass an un initialized #CoglDepthState structure
731 // to cogl_pipeline_set_depth_state().
732 void init()() {
733 cogl_depth_state_init(&this);
736 // VERSION: 2.0
737 // Sets the range to map depth values in normalized device coordinates
738 // to before writing out to a depth buffer.
740 // After your geometry has be transformed, clipped and had perspective
741 // division applied placing it in normalized device
742 // coordinates all depth values between the near and far z clipping
743 // planes are in the range -1 to 1. Before writing any depth value to
744 // the depth buffer though the value is mapped into the range [0, 1].
746 // With this function you can change the range which depth values are
747 // mapped too although the range must still lye within the range [0,
748 // 1].
750 // If your driver does not support this feature (for example you are
751 // using GLES 1 drivers) then if you don't use the default range
752 // values you will get an error reported when calling
753 // cogl_pipeline_set_depth_state (). You can check ahead of time for
754 // the %COGL_FEATURE_ID_DEPTH_RANGE feature with
755 // cogl_has_feature() to know if this function will succeed.
757 // By default normalized device coordinate depth values are mapped to
758 // the full range of depth buffer values, [0, 1].
760 // NB: this won't directly affect the state of the GPU. You have
761 // to then set the state on a #CoglPipeline using
762 // cogl_pipeline_set_depth_state().
763 // <near_val>: The near component of the desired depth range which will be clamped to the range [0, 1]
764 // <far_val>: The far component of the desired depth range which will be clamped to the range [0, 1]
765 void set_range()(float near_val, float far_val) {
766 cogl_depth_state_set_range(&this, near_val, far_val);
769 // VERSION: 2.0
770 // Enables or disables depth testing according to the value of
771 // @enable.
773 // If depth testing is enable then the #CoglDepthTestFunction set
774 // using cogl_pipeline_set_depth_test_function() us used to evaluate
775 // the depth value of incoming fragments against the corresponding
776 // value stored in the current depth buffer, and if the test passes
777 // then the fragments depth value is used to update the depth buffer.
778 // (unless you have disabled depth writing via
779 // cogl_pipeline_set_depth_writing_enabled ())
781 // By default depth testing is disabled.
783 // NB: this won't directly affect the state of the GPU. You have
784 // to then set the state on a #CoglPipeline using
785 // cogl_pipeline_set_depth_state()
786 // <enable>: The enable state you want
787 void set_test_enabled()(int enable) {
788 cogl_depth_state_set_test_enabled(&this, enable);
791 // VERSION: 2.0
792 // Sets the #CoglDepthTestFunction used to compare the depth value of
793 // an incoming fragment against the corresponding value in the current
794 // depth buffer.
796 // By default the depth test function is %COGL_DEPTH_TEST_FUNCTION_LESS
798 // NB: this won't directly affect the state of the GPU. You have
799 // to then set the state on a #CoglPipeline using
800 // cogl_pipeline_set_depth_state()
801 // <function>: The #CoglDepthTestFunction to set
802 void set_test_function()(DepthTestFunction function_) {
803 cogl_depth_state_set_test_function(&this, function_);
806 // VERSION: 2.0
807 // Enables or disables depth buffer writing according to the value of
808 // @enable. Normally when depth testing is enabled and the comparison
809 // between a fragment's depth value and the corresponding depth buffer
810 // value passes then the fragment's depth is written to the depth
811 // buffer unless writing is disabled here.
813 // By default depth writing is enabled
815 // NB: this won't directly affect the state of the GPU. You have
816 // to then set the state on a #CoglPipeline using
817 // cogl_pipeline_set_depth_state()
818 // <enable>: The enable state you want
819 void set_write_enabled()(int enable) {
820 cogl_depth_state_set_write_enabled(&this, enable);
825 // When using depth testing one of these functions is used to compare
826 // the depth of an incoming fragment against the depth value currently
827 // stored in the depth buffer. The function is changed using
828 // cogl_material_set_depth_test_function().
830 // The test is only done when depth testing is explicitly enabled. (See
831 // cogl_material_set_depth_test_enabled())
832 enum DepthTestFunction {
833 NEVER = 512,
834 LESS = 513,
835 EQUAL = 514,
836 LEQUAL = 515,
837 GREATER = 516,
838 NOTEQUAL = 517,
839 GEQUAL = 518,
840 ALWAYS = 519
842 struct Display {
843 // Unintrospectable method: get_renderer_EXP() / cogl_display_get_renderer_EXP()
844 Cogl.Renderer* get_renderer_EXP()() {
845 return cogl_display_get_renderer_EXP(&this);
847 int setup_EXP()(GLib2.Error** error=null) {
848 return cogl_display_setup_EXP(&this, error);
850 // Unintrospectable function: new_EXP() / cogl_display_new_EXP()
851 static Cogl.Display* new_EXP()(Cogl.Renderer* renderer, OnscreenTemplate* onscreen_template) {
852 return cogl_display_new_EXP(renderer, onscreen_template);
857 // Error enumeration for Cogl
859 // The @COGL_ERROR_UNSUPPORTED error can be thrown for a variety of
860 // reasons. For example:
862 // <itemizedlist>
863 // <listitem><para>You've tried to use a feature that is not
864 // advertised by cogl_get_features(). This could happen if you create
865 // a 2d texture with a non-power-of-two size when
866 // %COGL_FEATURE_TEXTURE_NPOT is not advertised.</para></listitem>
867 // <listitem><para>The GPU can not handle the configuration you have
868 // requested. An example might be if you try to use too many texture
869 // layers in a single #CoglPipeline</para></listitem>
870 // <listitem><para>The driver does not support some
871 // configuration.</para></listiem>
872 // </itemizedlist>
874 // Currently this is only used by Cogl API marked as experimental so
875 // this enum should also be considered experimental.
876 enum Error /* Version 1.4 */ {
877 UNSUPPORTED = 0,
878 NO_MEMORY = 1
881 // Represents an ordered rotation first of @heading degrees around an
882 // object's y axis, then @pitch degrees around an object's x axis and
883 // finally @roll degrees around an object's z axis.
885 // <note>It's important to understand the that axis are associated
886 // with the object being rotated, so the axis also rotate in sequence
887 // with the rotations being applied.</note>
889 // The members of a #CoglEuler can be initialized, for example, with
890 // cogl_euler_init() and cogl_euler_init_from_quaternion ().
892 // You may also want to look at cogl_quaternion_init_from_euler() if
893 // you want to do interpolation between 3d rotations.
894 struct Euler /* Version 2.0 */ {
895 float heading, pitch, roll;
896 private float padding0, padding1, padding2, padding3, padding4;
899 // Unintrospectable method: copy() / cogl_euler_copy()
900 // VERSION: 2.0
901 // Allocates a new #CoglEuler and initilizes it with the component
902 // angles of @src. The newly allocated euler should be freed using
903 // cogl_euler_free().
904 // RETURNS: A newly allocated #CoglEuler
905 Euler* copy()() {
906 return cogl_euler_copy(&this);
909 // VERSION: 2.0
910 // Frees a #CoglEuler that was previously allocated using
911 // cogl_euler_copy().
912 void free()() {
913 cogl_euler_free(&this);
916 // VERSION: 2.0
917 // Initializes @euler to represent a rotation of @x_angle degrees
918 // around the x axis, then @y_angle degrees around the y_axis and
919 // @z_angle degrees around the z axis.
920 // <heading>: Angle to rotate around an object's y axis
921 // <pitch>: Angle to rotate around an object's x axis
922 // <roll>: Angle to rotate around an object's z axis
923 void init()(float heading, float pitch, float roll) {
924 cogl_euler_init(&this, heading, pitch, roll);
927 // Extracts a euler rotation from the given @matrix and
928 // initializses @euler with the component x, y and z rotation angles.
929 // <matrix>: A #CoglMatrix containing a rotation, but no scaling, mirroring or skewing.
930 void init_from_matrix()(Matrix* matrix) {
931 cogl_euler_init_from_matrix(&this, matrix);
934 // Initializes a @euler rotation with the equivalent rotation
935 // represented by the given @quaternion.
936 // <quaternion>: A #CoglEuler with the rotation to initialize with
937 void init_from_quaternion()(Quaternion* quaternion) {
938 cogl_euler_init_from_quaternion(&this, quaternion);
941 // VERSION: 2.0
942 // Compares the two given euler angles @v1 and @v1 and it they are
943 // equal returns %TRUE else %FALSE.
945 // <note>This function only checks that all three components rotations
946 // are numerically equal, it does not consider that some rotations
947 // can be represented with different component rotations</note>
948 // RETURNS: %TRUE if @v1 and @v2 are equal else %FALSE.
949 // <v1>: The second euler angle to compare
950 static int equal()(const(void)* v1, const(void)* v2) {
951 return cogl_euler_equal(v1, v2);
955 enum int FIXED_0_5 = 32768;
956 enum int FIXED_1 = 1;
957 enum int FIXED_2_PI = 411775;
958 enum int FIXED_BITS = 32;
959 enum int FIXED_EPSILON = 1;
960 enum int FIXED_MAX = 2147483647;
961 enum int FIXED_MIN = cast(int)2147483648;
962 enum int FIXED_PI = 205887;
963 enum int FIXED_PI_2 = 102944;
964 enum int FIXED_PI_4 = 51472;
965 enum int FIXED_Q = -16;
967 // VERSION: 1.10
968 // A callback used with cogl_foreach_feature() for enumerating all
969 // context level features supported by Cogl.
970 // <feature>: A single feature currently supported by Cogl
971 // <user_data>: A private pointer passed to cogl_foreach_feature().
972 extern (C) alias void function (FeatureID feature, void* user_data) FeatureCallback;
974 // Flags for the supported features.
975 enum FeatureFlags /* Version 0.8 */ {
976 TEXTURE_RECTANGLE = 2,
977 TEXTURE_NPOT = 4,
978 TEXTURE_YUV = 8,
979 TEXTURE_READ_PIXELS = 16,
980 SHADERS_GLSL = 32,
981 OFFSCREEN = 64,
982 OFFSCREEN_MULTISAMPLE = 128,
983 OFFSCREEN_BLIT = 256,
984 FOUR_CLIP_PLANES = 512,
985 STENCIL_BUFFER = 1024,
986 VBOS = 2048,
987 PBOS = 4096,
988 UNSIGNED_INT_INDICES = 8192,
989 DEPTH_RANGE = 16384,
990 TEXTURE_NPOT_BASIC = 32768,
991 TEXTURE_NPOT_MIPMAP = 65536,
992 TEXTURE_NPOT_REPEAT = 131072,
993 POINT_SPRITE = 262144,
994 TEXTURE_3D = 524288,
995 SHADERS_ARBFP = 1048576,
996 MAP_BUFFER_FOR_READ = 2097152,
997 MAP_BUFFER_FOR_WRITE = 4194304,
998 ONSCREEN_MULTIPLE = 8388608
1001 // All the capabilities that can vary between different GPUs supported
1002 // by Cogl. Applications that depend on any of these features should explicitly
1003 // check for them using cogl_has_feature() or cogl_has_features().
1004 enum FeatureID /* Version 1.10 */ {
1005 COGL_FEATURE_ID_TEXTURE_NPOT_BASIC = 1,
1006 COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP = 2,
1007 COGL_FEATURE_ID_TEXTURE_NPOT_REPEAT = 3,
1008 COGL_FEATURE_ID_TEXTURE_NPOT = 4,
1009 COGL_FEATURE_ID_TEXTURE_RECTANGLE = 5,
1010 COGL_FEATURE_ID_TEXTURE_3D = 6,
1011 COGL_FEATURE_ID_GLSL = 7,
1012 COGL_FEATURE_ID_ARBFP = 8,
1013 COGL_FEATURE_ID_OFFSCREEN = 9,
1014 COGL_FEATURE_ID_OFFSCREEN_MULTISAMPLE = 10,
1015 COGL_FEATURE_ID_ONSCREEN_MULTIPLE = 11,
1016 COGL_FEATURE_ID_UNSIGNED_INT_INDICES = 12,
1017 COGL_FEATURE_ID_DEPTH_RANGE = 13,
1018 COGL_FEATURE_ID_POINT_SPRITE = 14,
1019 COGL_FEATURE_ID_MAP_BUFFER_FOR_READ = 15,
1020 COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE = 16,
1021 COGL_FEATURE_ID_MIRRORED_REPEAT = 17,
1022 COGL_FEATURE_ID_SWAP_BUFFERS_EVENT = 18,
1023 _COGL_N_FEATURE_IDS = 19
1025 enum FilterReturn {
1026 CONTINUE = 0,
1027 REMOVE = 1
1029 // Fixed point number using a (16.16) notation.
1030 struct Fixed {
1032 // Unintrospectable function: log2() / cogl_fixed_log2()
1033 // VERSION: 1.0
1034 // Calculates base 2 logarithm.
1036 // This function is some 2.5 times faster on x86, and over 12 times faster on
1037 // fpu-less arm, than using libc log().
1038 // RETURNS: base 2 logarithm.
1039 // <x>: value to calculate base 2 logarithm from
1040 static Fixed log2()(uint x) {
1041 return cogl_fixed_log2(x);
1044 // VERSION: 1.0
1045 // Calculates @x to the @y power.
1046 // RETURNS: the power of @x to the @y
1047 // <x>: base
1048 // <y>: #CoglFixed exponent
1049 static uint pow()(uint x, Fixed y) {
1050 return cogl_fixed_pow(x, y);
1053 // Unintrospectable method: atan() / cogl_fixed_atan()
1054 // VERSION: 1.0
1055 // Computes the arc tangent of @a.
1056 // RETURNS: the arc tangent of the passed value, in fixed point notation
1057 Fixed atan()() {
1058 return cogl_fixed_atan(&this);
1061 // Unintrospectable method: atan2() / cogl_fixed_atan2()
1062 // VERSION: 1.0
1063 // Computes the arc tangent of @a / @b but uses the sign of both
1064 // arguments to return the angle in right quadrant.
1066 // notation
1067 // RETURNS: the arc tangent of the passed fraction, in fixed point
1068 // <b>: the denominator as a #CoglFixed number
1069 Fixed atan2()(Fixed b) {
1070 return cogl_fixed_atan2(&this, b);
1073 // Unintrospectable method: cos() / cogl_fixed_cos()
1074 // VERSION: 1.0
1075 // Computes the cosine of @angle.
1076 // RETURNS: the cosine of the passed angle, in fixed point notation
1077 Fixed cos()() {
1078 return cogl_fixed_cos(&this);
1080 // Unintrospectable method: div() / cogl_fixed_div()
1081 Fixed div()(Fixed b) {
1082 return cogl_fixed_div(&this, b);
1084 // Unintrospectable method: mul() / cogl_fixed_mul()
1085 Fixed mul()(Fixed b) {
1086 return cogl_fixed_mul(&this, b);
1088 // Unintrospectable method: mul_div() / cogl_fixed_mul_div()
1089 Fixed mul_div()(Fixed b, Fixed c) {
1090 return cogl_fixed_mul_div(&this, b, c);
1093 // VERSION: 1.0
1094 // Calculates 2 to the @x power.
1096 // This function is around 11 times faster on x86, and around 22 times faster
1097 // on fpu-less arm than libc pow(2, x).
1098 // RETURNS: the power of 2 to the passed value
1099 uint pow2()() {
1100 return cogl_fixed_pow2(&this);
1103 // Unintrospectable method: sin() / cogl_fixed_sin()
1104 // VERSION: 1.0
1105 // Computes the sine of @angle.
1106 // RETURNS: the sine of the passed angle, in fixed point notation
1107 Fixed sin()() {
1108 return cogl_fixed_sin(&this);
1111 // Unintrospectable method: sqrt() / cogl_fixed_sqrt()
1112 // VERSION: 1.0
1113 // Computes the square root of @x.
1115 // notation
1116 // RETURNS: the square root of the passed value, in floating point
1117 Fixed sqrt()() {
1118 return cogl_fixed_sqrt(&this);
1121 // Unintrospectable method: tan() / cogl_fixed_tan()
1122 // VERSION: 1.0
1123 // Computes the tangent of @angle.
1124 // RETURNS: the tangent of the passed angle, in fixed point notation
1125 Fixed tan()() {
1126 return cogl_fixed_tan(&this);
1131 // The fog mode determines the equation used to calculate the fogging blend
1132 // factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
1133 // determines f as:
1135 // |[
1136 // f = end - eye_distance / end - start
1137 // ]|
1139 // Where eye_distance is the distance of the current fragment in eye
1140 // coordinates from the origin.
1141 enum FogMode /* Version 1.0 */ {
1142 LINEAR = 0,
1143 EXPONENTIAL = 1,
1144 EXPONENTIAL_SQUARED = 2
1146 struct Framebuffer {
1148 // Unintrospectable method: add_swap_buffers_callback() / cogl_framebuffer_add_swap_buffers_callback()
1149 // VERSION: 1.10
1150 // Installs a @callback function that should be called whenever a swap buffers
1151 // request (made using cogl_framebuffer_swap_buffers()) for the given
1152 // @framebuffer completes.
1154 // <note>Applications should check for the %COGL_FEATURE_ID_SWAP_BUFFERS_EVENT
1155 // feature before using this API. It's currently undefined when and if
1156 // registered callbacks will be called if this feature is not supported.</note>
1158 // We recommend using this mechanism when available to manually throttle your
1159 // applications (in conjunction with cogl_onscreen_set_swap_throttled()) so
1160 // your application will be able to avoid long blocks in the driver caused by
1161 // throttling when you request to swap buffers too quickly.
1163 // the callback later.
1164 // RETURNS: a unique identifier that can be used to remove to remove
1165 // <callback>: A callback function to call when a swap has completed
1166 // <user_data>: A private pointer to be passed to @callback
1167 uint add_swap_buffers_callback()(SwapBuffersNotify callback, void* user_data) {
1168 return cogl_framebuffer_add_swap_buffers_callback(&this, callback, user_data);
1171 // VERSION: 1.8
1172 // Explicitly allocates a configured #CoglFramebuffer allowing developers to
1173 // check and handle any errors that might arise from an unsupported
1174 // configuration so that fallback configurations may be tried.
1176 // <note>Many applications don't support any fallback options at least when
1177 // they are initially developed and in that case the don't need to use this API
1178 // since Cogl will automatically allocate a framebuffer when it first gets
1179 // used. The disadvantage of relying on automatic allocation is that the
1180 // program will abort with an error message if there is an error during
1181 // automatic allocation.<note>
1182 // RETURNS: %TRUE if there were no error allocating the framebuffer, else %FALSE.
1183 int allocate()(GLib2.Error** error=null) {
1184 return cogl_framebuffer_allocate(&this, error);
1187 // VERSION: 1.8
1188 // Clears all the auxiliary buffers identified in the @buffers mask, and if
1189 // that includes the color buffer then the specified @color is used.
1190 // <buffers>: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary buffers to clear
1191 // <color>: The color to clear the color buffer too if specified in @buffers.
1192 void clear()(c_ulong buffers, Color* color) {
1193 cogl_framebuffer_clear(&this, buffers, color);
1196 // VERSION: 1.8
1197 // Clears all the auxiliary buffers identified in the @buffers mask, and if
1198 // that includes the color buffer then the specified @color is used.
1199 // <buffers>: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary buffers to clear
1200 // <red>: The red component of color to clear the color buffer too if specified in @buffers.
1201 // <green>: The green component of color to clear the color buffer too if specified in @buffers.
1202 // <blue>: The blue component of color to clear the color buffer too if specified in @buffers.
1203 // <alpha>: The alpha component of color to clear the color buffer too if specified in @buffers.
1204 void clear4f()(c_ulong buffers, float red, float green, float blue, float alpha) {
1205 cogl_framebuffer_clear4f(&this, buffers, red, green, blue, alpha);
1208 // VERSION: 1.8
1209 // Declares that the specified @buffers no longer need to be referenced
1210 // by any further rendering commands. This can be an important
1211 // optimization to avoid subsequent frames of rendering depending on
1212 // the results of a previous frame.
1214 // For example; some tile-based rendering GPUs are able to avoid allocating and
1215 // accessing system memory for the depth and stencil buffer so long as these
1216 // buffers are not required as input for subsequent frames and that can save a
1217 // significant amount of memory bandwidth used to save and restore their
1218 // contents to system memory between frames.
1220 // It is currently considered an error to try and explicitly discard the color
1221 // buffer by passing %COGL_BUFFER_BIT_COLOR. This is because the color buffer is
1222 // already implicitly discard when you finish rendering to a #CoglOnscreen
1223 // framebuffer, and it's not meaningful to try and discard the color buffer of
1224 // a #CoglOffscreen framebuffer since they are single-buffered.
1225 // <buffers>: A #CoglBufferBit mask of which ancillary buffers you want to discard.
1226 void discard_buffers()(c_ulong buffers) {
1227 cogl_framebuffer_discard_buffers(&this, buffers);
1230 // VERSION: 1.10
1231 // This blocks the CPU until all pending rendering associated with the
1232 // specified framebuffer has completed. It's very rare that developers should
1233 // ever need this level of synchronization with the GPU and should never be
1234 // used unless you clearly understand why you need to explicitly force
1235 // synchronization.
1237 // One example might be for benchmarking purposes to be sure timing
1238 // measurements reflect the time that the GPU is busy for not just the time it
1239 // takes to queue rendering commands.
1240 void finish()() {
1241 cogl_framebuffer_finish(&this);
1244 // VERSION: 1.10
1245 // Replaces the current projection matrix with a perspective matrix
1246 // for a given viewing frustum defined by 4 side clip planes that
1247 // all cross through the origin and 2 near and far clip planes.
1248 // <left>: X position of the left clipping plane where it intersects the near clipping plane
1249 // <right>: X position of the right clipping plane where it intersects the near clipping plane
1250 // <bottom>: Y position of the bottom clipping plane where it intersects the near clipping plane
1251 // <top>: Y position of the top clipping plane where it intersects the near clipping plane
1252 // <z_near>: The distance to the near clipping plane (Must be positive)
1253 // <z_far>: The distance to the far clipping plane (Must be positive)
1254 void frustum()(float left, float right, float bottom, float top, float z_near, float z_far) {
1255 cogl_framebuffer_frustum(&this, left, right, bottom, top, z_near, z_far);
1258 // VERSION: 1.8
1259 // Retrieves the number of alpha bits of @framebuffer
1260 // RETURNS: the number of bits
1261 int get_alpha_bits()() {
1262 return cogl_framebuffer_get_alpha_bits(&this);
1265 // VERSION: 1.8
1266 // Retrieves the number of blue bits of @framebuffer
1267 // RETURNS: the number of bits
1268 int get_blue_bits()() {
1269 return cogl_framebuffer_get_blue_bits(&this);
1272 // VERSION: 1.8
1273 // Queries the common #CoglPixelFormat of all color buffers attached
1274 // to this framebuffer. For an offscreen framebuffer created with
1275 // cogl_offscreen_new_to_texture() this will correspond to the format
1276 // of the texture.
1277 PixelFormat get_color_format()() {
1278 return cogl_framebuffer_get_color_format(&this);
1281 // VERSION: 1.8
1282 // Gets the current #CoglColorMask of which channels would be written to the
1283 // current framebuffer. Each bit set in the mask means that the
1284 // corresponding color would be written.
1285 // RETURNS: A #CoglColorMask
1286 ColorMask get_color_mask()() {
1287 return cogl_framebuffer_get_color_mask(&this);
1289 // Unintrospectable method: get_context() / cogl_framebuffer_get_context()
1290 Cogl.Context* get_context()() {
1291 return cogl_framebuffer_get_context(&this);
1294 // VERSION: 1.8
1295 // Returns whether dithering has been requested for the given @framebuffer.
1296 // See cogl_framebuffer_set_dither_enabled() for more details about dithering.
1298 // <note>This may return %TRUE even when the underlying @framebuffer
1299 // display pipeline does not support dithering. This value only represents
1300 // the user's request for dithering.</note>
1301 // RETURNS: %TRUE if dithering has been requested or %FALSE if not.
1302 int get_dither_enabled()() {
1303 return cogl_framebuffer_get_dither_enabled(&this);
1306 // VERSION: 1.8
1307 // Retrieves the number of green bits of @framebuffer
1308 // RETURNS: the number of bits
1309 int get_green_bits()() {
1310 return cogl_framebuffer_get_green_bits(&this);
1313 // VERSION: 1.8
1314 // Queries the current height of the given @framebuffer.
1315 // RETURNS: The height of @framebuffer.
1316 int get_height()() {
1317 return cogl_framebuffer_get_height(&this);
1320 // VERSION: 1.10
1321 // Stores the current model-view matrix in @matrix.
1322 // <matrix>: return location for the model-view matrix
1323 void get_modelview_matrix()(/*out*/ Matrix* matrix) {
1324 cogl_framebuffer_get_modelview_matrix(&this, matrix);
1327 // VERSION: 1.10
1328 // Stores the current projection matrix in @matrix.
1329 // <matrix>: return location for the projection matrix
1330 void get_projection_matrix()(/*out*/ Matrix* matrix) {
1331 cogl_framebuffer_get_projection_matrix(&this, matrix);
1334 // VERSION: 1.8
1335 // Retrieves the number of red bits of @framebuffer
1336 // RETURNS: the number of bits
1337 int get_red_bits()() {
1338 return cogl_framebuffer_get_red_bits(&this);
1341 // VERSION: 1.10
1342 // Gets the number of points that are sampled per-pixel when
1343 // rasterizing geometry. Usually by default this will return 0 which
1344 // means that single-sample not multisample rendering has been chosen.
1345 // When using a GPU supporting multisample rendering it's possible to
1346 // increase the number of samples per pixel using
1347 // cogl_framebuffer_set_samples_per_pixel().
1349 // Calling cogl_framebuffer_get_samples_per_pixel() before the
1350 // framebuffer has been allocated will simply return the value set
1351 // using cogl_framebuffer_set_samples_per_pixel(). After the
1352 // framebuffer has been allocated the value will reflect the actual
1353 // number of samples that will be made by the GPU.
1355 // rasterizing geometry or 0 if single-sample rendering
1356 // has been chosen.
1357 // RETURNS: The number of point samples made per pixel when
1358 int get_samples_per_pixel()() {
1359 return cogl_framebuffer_get_samples_per_pixel(&this);
1362 // VERSION: 1.8
1363 // Queries the x, y, width and height components of the current viewport as set
1364 // using cogl_framebuffer_set_viewport() or the default values which are 0, 0,
1365 // framebuffer_width and framebuffer_height. The values are written into the
1366 // given @viewport array.
1367 // <viewport>: A pointer to an array of 4 floats to receive the (x, y, width, height) components of the current viewport.
1368 void get_viewport4fv()(float* viewport) {
1369 cogl_framebuffer_get_viewport4fv(&this, viewport);
1372 // VERSION: 1.8
1373 // Queries the height of the viewport as set using cogl_framebuffer_set_viewport()
1374 // or the default value which is the height of the framebuffer.
1375 // RETURNS: The height of the viewport.
1376 float get_viewport_height()() {
1377 return cogl_framebuffer_get_viewport_height(&this);
1380 // VERSION: 1.8
1381 // Queries the width of the viewport as set using cogl_framebuffer_set_viewport()
1382 // or the default value which is the width of the framebuffer.
1383 // RETURNS: The width of the viewport.
1384 float get_viewport_width()() {
1385 return cogl_framebuffer_get_viewport_width(&this);
1388 // VERSION: 1.8
1389 // Queries the x coordinate of the viewport origin as set using cogl_framebuffer_set_viewport()
1390 // or the default value which is %0.
1391 // RETURNS: The x coordinate of the viewport origin.
1392 float get_viewport_x()() {
1393 return cogl_framebuffer_get_viewport_x(&this);
1396 // VERSION: 1.8
1397 // Queries the y coordinate of the viewport origin as set using cogl_framebuffer_set_viewport()
1398 // or the default value which is %0.
1399 // RETURNS: The y coordinate of the viewport origin.
1400 float get_viewport_y()() {
1401 return cogl_framebuffer_get_viewport_y(&this);
1404 // VERSION: 1.8
1405 // Queries the current width of the given @framebuffer.
1406 // RETURNS: The width of @framebuffer.
1407 int get_width()() {
1408 return cogl_framebuffer_get_width(&this);
1411 // VERSION: 1.10
1412 // Resets the current model-view matrix to the identity matrix.
1413 void identity_matrix()() {
1414 cogl_framebuffer_identity_matrix(&this);
1417 // VERSION: 1.0
1418 // Replaces the current projection matrix with an orthographic projection
1419 // matrix.
1420 // <x_1>: The x coordinate for the first vertical clipping plane
1421 // <y_1>: The y coordinate for the first horizontal clipping plane
1422 // <x_2>: The x coordinate for the second vertical clipping plane
1423 // <y_2>: The y coordinate for the second horizontal clipping plane
1424 // <near>: The <emphasis>distance</emphasis> to the near clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
1425 // <far>: The <emphasis>distance</emphasis> to the far clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
1426 void orthographic()(float x_1, float y_1, float x_2, float y_2, float near, float far) {
1427 cogl_framebuffer_orthographic(&this, x_1, y_1, x_2, y_2, near, far);
1430 // VERSION: 1.10
1431 // Replaces the current projection matrix with a perspective matrix
1432 // based on the provided values.
1434 // <note>You should be careful not to have to great a @z_far / @z_near
1435 // ratio since that will reduce the effectiveness of depth testing
1436 // since there wont be enough precision to identify the depth of
1437 // objects near to each other.</note>
1438 // <aspect>: The (width over height) aspect ratio for display
1439 // <z_near>: The distance to the near clipping plane (Must be positive, and must not be 0)
1440 // <z_far>: The distance to the far clipping plane (Must be positive)
1441 void perspective()(float fov_y, float aspect, float z_near, float z_far) {
1442 cogl_framebuffer_perspective(&this, fov_y, aspect, z_near, z_far);
1445 // VERSION: 1.10
1446 // Reverts the clipping region to the state before the last call to
1447 // cogl_framebuffer_push_clip().
1448 void pop_clip()() {
1449 cogl_framebuffer_pop_clip(&this);
1452 // VERSION: 1.10
1453 // Restores the model-view matrix on the top of the matrix stack.
1454 void pop_matrix()() {
1455 cogl_framebuffer_pop_matrix(&this);
1458 // VERSION: 1.10
1459 // Copies the current model-view matrix onto the matrix stack. The matrix
1460 // can later be restored with cogl_framebuffer_pop_matrix().
1461 void push_matrix()() {
1462 cogl_framebuffer_push_matrix(&this);
1465 // VERSION: 1.0
1466 // Sets a new clipping area using the silhouette of the specified,
1467 // filled @path. The clipping area is intersected with the previous
1468 // clipping area. To restore the previous clipping area, call
1469 // cogl_framebuffer_pop_clip().
1470 // <path>: The path to clip with.
1471 void push_path_clip()(Path* path) {
1472 cogl_framebuffer_push_path_clip(&this, path);
1475 // VERSION: 1.10
1476 // Sets a new clipping area using a 2D shaped described with a
1477 // #CoglPrimitive. The shape must not contain self overlapping
1478 // geometry and must lie on a single 2D plane. A bounding box of the
1479 // 2D shape in local coordinates (the same coordinates used to
1480 // describe the shape) must be given. It is acceptable for the bounds
1481 // to be larger than the true bounds but behaviour is undefined if the
1482 // bounds are smaller than the true bounds.
1484 // The primitive is transformed by the current model-view matrix and
1485 // the silhouette is intersected with the previous clipping area. To
1486 // restore the previous clipping area, call
1487 // cogl_framebuffer_pop_clip().
1488 // <primitive>: A #CoglPrimitive describing a flat 2D shape
1489 // <bounds_x1>: y coordinate for the bottom-right corner of the primitives bounds.
1490 // <bounds_y1>: y coordinate for the top-left corner of the primitives bounds
1491 // <bounds_x2>: x coordinate for the top-left corner of the primitives bounds
1492 // <bounds_y2>: x coordinate for the bottom-right corner of the primitives bounds.
1493 void push_primitive_clip()(Primitive* primitive, float bounds_x1, float bounds_y1, float bounds_x2, float bounds_y2) {
1494 cogl_framebuffer_push_primitive_clip(&this, primitive, bounds_x1, bounds_y1, bounds_x2, bounds_y2);
1497 // VERSION: 1.10
1498 // Specifies a modelview transformed rectangular clipping area for all
1499 // subsequent drawing operations. Any drawing commands that extend
1500 // outside the rectangle will be clipped so that only the portion
1501 // inside the rectangle will be displayed. The rectangle dimensions
1502 // are transformed by the current model-view matrix.
1504 // The rectangle is intersected with the current clip region. To undo
1505 // the effect of this function, call cogl_framebuffer_pop_clip().
1506 // <x_1>: x coordinate for top left corner of the clip rectangle
1507 // <y_1>: y coordinate for top left corner of the clip rectangle
1508 // <x_2>: x coordinate for bottom right corner of the clip rectangle
1509 // <y_2>: y coordinate for bottom right corner of the clip rectangle
1510 void push_rectangle_clip()(float x_1, float y_1, float x_2, float y_2) {
1511 cogl_framebuffer_push_rectangle_clip(&this, x_1, y_1, x_2, y_2);
1514 // VERSION: 1.10
1515 // Specifies a rectangular clipping area for all subsequent drawing
1516 // operations. Any drawing commands that extend outside the rectangle
1517 // will be clipped so that only the portion inside the rectangle will
1518 // be displayed. The rectangle dimensions are not transformed by the
1519 // current model-view matrix.
1521 // The rectangle is intersected with the current clip region. To undo
1522 // the effect of this function, call cogl_framebuffer_pop_clip().
1523 // <x>: left edge of the clip rectangle in window coordinates
1524 // <y>: top edge of the clip rectangle in window coordinates
1525 // <width>: width of the clip rectangle
1526 // <height>: height of the clip rectangle
1527 void push_scissor_clip()(int x, int y, int width, int height) {
1528 cogl_framebuffer_push_scissor_clip(&this, x, y, width, height);
1531 // VERSION: 1.10
1532 // Removes a callback that was previously registered
1533 // using cogl_framebuffer_add_swap_buffers_callback().
1534 // <id>: An identifier returned from cogl_framebuffer_add_swap_buffers_callback()
1535 void remove_swap_buffers_callback()(uint id) {
1536 cogl_framebuffer_remove_swap_buffers_callback(&this, id);
1539 // VERSION: 1.8
1540 // When point sample rendering (also known as multisample rendering)
1541 // has been enabled via cogl_framebuffer_set_samples_per_pixel()
1542 // then you can optionally call this function (or
1543 // cogl_framebuffer_resolve_samples_region()) to explicitly resolve
1544 // the point samples into values for the final color buffer.
1546 // Some GPUs will implicitly resolve the point samples during
1547 // rendering and so this function is effectively a nop, but with other
1548 // architectures it is desirable to defer the resolve step until the
1549 // end of the frame.
1551 // Since Cogl will automatically ensure samples are resolved if the
1552 // target color buffer is used as a source this API only needs to be
1553 // used if explicit control is desired - perhaps because you want to
1554 // ensure that the resolve is completed in advance to avoid later
1555 // having to wait for the resolve to complete.
1557 // If you are performing incremental updates to a framebuffer you
1558 // should consider using cogl_framebuffer_resolve_samples_region()
1559 // instead to avoid resolving redundant pixels.
1560 void resolve_samples()() {
1561 cogl_framebuffer_resolve_samples(&this);
1564 // VERSION: 1.8
1565 // When point sample rendering (also known as multisample rendering)
1566 // has been enabled via cogl_framebuffer_set_samples_per_pixel()
1567 // then you can optionally call this function (or
1568 // cogl_framebuffer_resolve_samples()) to explicitly resolve the point
1569 // samples into values for the final color buffer.
1571 // Some GPUs will implicitly resolve the point samples during
1572 // rendering and so this function is effectively a nop, but with other
1573 // architectures it is desirable to defer the resolve step until the
1574 // end of the frame.
1576 // Use of this API is recommended if incremental, small updates to
1577 // a framebuffer are being made because by default Cogl will
1578 // implicitly resolve all the point samples of the framebuffer which
1579 // can result in redundant work if only a small number of samples have
1580 // changed.
1582 // Because some GPUs implicitly resolve point samples this function
1583 // only guarantees that at-least the region specified will be resolved
1584 // and if you have rendered to a larger region then it's possible that
1585 // other samples may be implicitly resolved.
1586 // <x>: top-left x coordinate of region to resolve
1587 // <y>: top-left y coordinate of region to resolve
1588 // <width>: width of region to resolve
1589 // <height>: height of region to resolve
1590 void resolve_samples_region()(int x, int y, int width, int height) {
1591 cogl_framebuffer_resolve_samples_region(&this, x, y, width, height);
1594 // VERSION: 1.10
1595 // Multiplies the current model-view matrix by one that rotates the
1596 // model around the vertex specified by @x, @y and @z. The rotation
1597 // follows the right-hand thumb rule so for example rotating by 10
1598 // degrees about the vertex (0, 0, 1) causes a small counter-clockwise
1599 // rotation.
1600 // <angle>: Angle in degrees to rotate.
1601 // <x>: X-component of vertex to rotate around.
1602 // <y>: Y-component of vertex to rotate around.
1603 // <z>: Z-component of vertex to rotate around.
1604 void rotate()(float angle, float x, float y, float z) {
1605 cogl_framebuffer_rotate(&this, angle, x, y, z);
1608 // VERSION: 1.10
1609 // Multiplies the current model-view matrix by one that scales the x,
1610 // y and z axes by the given values.
1611 // <x>: Amount to scale along the x-axis
1612 // <y>: Amount to scale along the y-axis
1613 // <z>: Amount to scale along the z-axis
1614 void scale()(float x, float y, float z) {
1615 cogl_framebuffer_scale(&this, x, y, z);
1618 // VERSION: 1.8
1619 // Defines a bit mask of which color channels should be written to the
1620 // given @framebuffer. If a bit is set in @color_mask that means that
1621 // color will be written.
1622 // <color_mask>: A #CoglColorMask of which color channels to write to the current framebuffer.
1623 void set_color_mask()(ColorMask color_mask) {
1624 cogl_framebuffer_set_color_mask(&this, color_mask);
1627 // VERSION: 1.8
1628 // Enables or disabled dithering if supported by the hardware.
1630 // Dithering is a hardware dependent technique to increase the visible
1631 // color resolution beyond what the underlying hardware supports by playing
1632 // tricks with the colors placed into the framebuffer to give the illusion
1633 // of other colors. (For example this can be compared to half-toning used
1634 // by some news papers to show varying levels of grey even though their may
1635 // only be black and white are available).
1637 // If the current display pipeline for @framebuffer does not support dithering
1638 // then this has no affect.
1640 // Dithering is enabled by default.
1641 // <dither_enabled>: %TRUE to enable dithering or %FALSE to disable
1642 void set_dither_enabled()(int dither_enabled) {
1643 cogl_framebuffer_set_dither_enabled(&this, dither_enabled);
1646 // VERSION: 1.10
1647 // Sets @matrix as the new model-view matrix.
1648 // <matrix>: the new model-view matrix
1649 void set_modelview_matrix()(Matrix* matrix) {
1650 cogl_framebuffer_set_modelview_matrix(&this, matrix);
1652 void set_projection_matrix()(Matrix* matrix) {
1653 cogl_framebuffer_set_projection_matrix(&this, matrix);
1656 // VERSION: 1.8
1657 // Requires that when rendering to @framebuffer then @n point samples
1658 // should be made per pixel which will all contribute to the final
1659 // resolved color for that pixel. The idea is that the hardware aims
1660 // to get quality similar to what you would get if you rendered
1661 // everything twice as big (for 4 samples per pixel) and then scaled
1662 // that image back down with filtering. It can effectively remove the
1663 // jagged edges of polygons and should be more efficient than if you
1664 // were to manually render at a higher resolution and downscale
1665 // because the hardware is often able to take some shortcuts. For
1666 // example the GPU may only calculate a single texture sample for all
1667 // points of a single pixel, and for tile based architectures all the
1668 // extra sample data (such as depth and stencil samples) may be
1669 // handled on-chip and so avoid increased demand on system memory
1670 // bandwidth.
1672 // By default this value is usually set to 0 and that is referred to
1673 // as "single-sample" rendering. A value of 1 or greater is referred
1674 // to as "multisample" rendering.
1676 // <note>There are some semantic differences between single-sample
1677 // rendering and multisampling with just 1 point sample such as it
1678 // being redundant to use the cogl_framebuffer_resolve_samples() and
1679 // cogl_framebuffer_resolve_samples_region() apis with single-sample
1680 // rendering.</note>
1682 // <note>It's recommended that
1683 // cogl_framebuffer_resolve_samples_region() be explicitly used at the
1684 // end of rendering to a point sample buffer to minimize the number of
1685 // samples that get resolved. By default Cogl will implicitly resolve
1686 // all framebuffer samples but if only a small region of a
1687 // framebuffer has changed this can lead to redundant work being
1688 // done.</note>
1689 void set_samples_per_pixel()(int samples_per_pixel) {
1690 cogl_framebuffer_set_samples_per_pixel(&this, samples_per_pixel);
1693 // VERSION: 1.8
1694 // Defines a scale and offset for everything rendered relative to the
1695 // top-left of the destination framebuffer.
1697 // By default the viewport has an origin of (0,0) and width and height
1698 // that match the framebuffer's size. Assuming a default projection and
1699 // modelview matrix then you could translate the contents of a window
1700 // down and right by leaving the viewport size unchanged by moving the
1701 // offset to (10,10). The viewport coordinates are measured in pixels.
1702 // If you left the x and y origin as (0,0) you could scale the windows
1703 // contents down by specify and width and height that's half the real
1704 // size of the framebuffer.
1706 // <note>Although the function takes floating point arguments, existing
1707 // drivers only allow the use of integer values. In the future floating
1708 // point values will be exposed via a checkable feature.</note>
1709 // <x>: The top-left x coordinate of the viewport origin (only integers supported currently)
1710 // <y>: The top-left y coordinate of the viewport origin (only integers supported currently)
1711 // <width>: The width of the viewport (only integers supported currently)
1712 // <height>: The height of the viewport (only integers supported currently)
1713 void set_viewport()(float x, float y, float width, float height) {
1714 cogl_framebuffer_set_viewport(&this, x, y, width, height);
1717 // VERSION: 1.8
1718 // Swaps the current back buffer being rendered too, to the front for display.
1720 // This function also implicitly discards the contents of the color, depth and
1721 // stencil buffers as if cogl_framebuffer_discard_buffers() were used. The
1722 // significance of the discard is that you should not expect to be able to
1723 // start a new frame that incrementally builds on the contents of the previous
1724 // frame.
1725 void swap_buffers()() {
1726 cogl_framebuffer_swap_buffers(&this);
1729 // VERSION: 1.8
1730 // Swaps a region of the back buffer being rendered too, to the front for
1731 // display. @rectangles represents the region as array of @n_rectangles each
1732 // defined by 4 sequential (x, y, width, height) integers.
1734 // This function also implicitly discards the contents of the color, depth and
1735 // stencil buffers as if cogl_framebuffer_discard_buffers() were used. The
1736 // significance of the discard is that you should not expect to be able to
1737 // start a new frame that incrementally builds on the contents of the previous
1738 // frame.
1739 // <rectangles>: An array of integer 4-tuples representing rectangles as (x, y, width, height) tuples.
1740 // <n_rectangles>: The number of 4-tuples to be read from @rectangles
1741 void swap_region()(int* rectangles, int n_rectangles) {
1742 cogl_framebuffer_swap_region(&this, rectangles, n_rectangles);
1745 // VERSION: 1.10
1746 // Multiplies the current model-view matrix by the given matrix.
1747 // <matrix>: the matrix to multiply with the current model-view
1748 void transform()(Matrix* matrix) {
1749 cogl_framebuffer_transform(&this, matrix);
1752 // VERSION: 1.10
1753 // Multiplies the current model-view matrix by one that translates the
1754 // model along all three axes according to the given values.
1755 // <x>: Distance to translate along the x-axis
1756 // <y>: Distance to translate along the y-axis
1757 // <z>: Distance to translate along the z-axis
1758 void translate()(float x, float y, float z) {
1759 cogl_framebuffer_translate(&this, x, y, z);
1763 enum FramebufferError {
1764 ALLOCATE = 0
1767 // The type used by cogl for function pointers, note that this type
1768 // is used as a generic catch-all cast for function pointers and the
1769 // actual arguments and return type may be different.
1770 extern (C) alias void function () FuncPtr;
1772 struct IndexBuffer {
1774 // Unintrospectable function: new() / cogl_index_buffer_new()
1775 // VERSION: 1.4
1776 // Declares a new #CoglIndexBuffer of @size bytes to contain vertex
1777 // indices. Once declared, data can be set using
1778 // cogl_buffer_set_data() or by mapping it into the application's
1779 // address space using cogl_buffer_map().
1780 // <bytes>: The number of bytes to allocate for vertex attribute data.
1781 static IndexBuffer* new_()(size_t bytes) {
1782 return cogl_index_buffer_new(bytes);
1786 struct Indices {
1787 // Unintrospectable method: get_buffer() / cogl_indices_get_buffer()
1788 IndexBuffer* get_buffer()() {
1789 return cogl_indices_get_buffer(&this);
1791 size_t get_offset()() {
1792 return cogl_indices_get_offset(&this);
1794 void set_offset()(size_t offset) {
1795 cogl_indices_set_offset(&this, offset);
1797 // Unintrospectable function: new() / cogl_indices_new()
1798 static Indices* new_()(IndicesType type, void* indices_data, int n_indices) {
1799 return cogl_indices_new(type, indices_data, n_indices);
1801 // Unintrospectable function: new_for_buffer() / cogl_indices_new_for_buffer()
1802 static Indices* new_for_buffer()(IndicesType type, IndexBuffer* buffer, size_t offset) {
1803 return cogl_indices_new_for_buffer(type, buffer, offset);
1808 // You should aim to use the smallest data type that gives you enough
1809 // range, since it reduces the size of your index array and can help
1810 // reduce the demand on memory bandwidth.
1812 // Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the
1813 // %COGL_FEATURE_UNSIGNED_INT_INDICES feature is available. This
1814 // should always be available on OpenGL but on OpenGL ES it will only
1815 // be available if the GL_OES_element_index_uint extension is
1816 // advertized.
1817 enum IndicesType {
1818 BYTE = 0,
1819 SHORT = 1,
1820 INT = 2
1822 struct Material {
1824 // Unintrospectable method: copy() / cogl_material_copy()
1825 // VERSION: 1.2
1826 // Creates a new material with the configuration copied from the
1827 // source material.
1829 // We would strongly advise developers to always aim to use
1830 // cogl_material_copy() instead of cogl_material_new() whenever there will
1831 // be any similarity between two materials. Copying a material helps Cogl
1832 // keep track of a materials ancestry which we may use to help minimize GPU
1833 // state changes.
1834 // RETURNS: a pointer to the newly allocated #CoglMaterial
1835 Material* copy()() {
1836 return cogl_material_copy(&this);
1839 // Unintrospectable method: foreach_layer() / cogl_material_foreach_layer()
1840 // VERSION: 1.4
1841 // Iterates all the layer indices of the given @material.
1842 // <callback>: A #CoglMaterialLayerCallback to be called for each layer index
1843 // <user_data>: Private data that will be passed to the callback
1844 void foreach_layer()(MaterialLayerCallback callback, void* user_data) {
1845 cogl_material_foreach_layer(&this, callback, user_data);
1848 // VERSION: 1.0
1849 // Retrieves the current ambient color for @material
1850 // <ambient>: The location to store the ambient color
1851 void get_ambient()(Color* ambient) {
1852 cogl_material_get_ambient(&this, ambient);
1855 // VERSION: 1.0
1856 // Retrieves the current material color.
1857 // <color>: The location to store the color
1858 void get_color()(/*out*/ Color* color) {
1859 cogl_material_get_color(&this, color);
1862 // VERSION: 2.0
1863 // Retrieves the current depth state configuration for the given
1864 // @pipeline as previously set using cogl_pipeline_set_depth_state().
1865 void get_depth_state()(DepthState* state_out) {
1866 cogl_material_get_depth_state(&this, state_out);
1869 // VERSION: 1.0
1870 // Retrieves the current diffuse color for @material
1871 // <diffuse>: The location to store the diffuse color
1872 void get_diffuse()(Color* diffuse) {
1873 cogl_material_get_diffuse(&this, diffuse);
1876 // VERSION: 1.0
1877 // Retrieves the materials current emission color.
1878 // <emission>: The location to store the emission color
1879 void get_emission()(Color* emission) {
1880 cogl_material_get_emission(&this, emission);
1883 // VERSION: 1.4
1884 // Gets whether point sprite coordinate generation is enabled for this
1885 // texture layer.
1887 // point sprite coordinates.
1888 // RETURNS: whether the texture coordinates will be replaced with
1889 // <layer_index>: the layer number to check.
1890 int get_layer_point_sprite_coords_enabled()(int layer_index) {
1891 return cogl_material_get_layer_point_sprite_coords_enabled(&this, layer_index);
1894 // VERSION: 1.6
1895 // Returns the wrap mode for the 'p' coordinate of texture lookups on this
1896 // layer.
1898 // this layer.
1899 // RETURNS: the wrap mode for the 'p' coordinate of texture lookups on
1900 // <layer_index>: the layer number to change.
1901 MaterialWrapMode get_layer_wrap_mode_p()(int layer_index) {
1902 return cogl_material_get_layer_wrap_mode_p(&this, layer_index);
1905 // VERSION: 1.6
1906 // Returns the wrap mode for the 's' coordinate of texture lookups on this
1907 // layer.
1909 // this layer.
1910 // RETURNS: the wrap mode for the 's' coordinate of texture lookups on
1911 // <layer_index>: the layer number to change.
1912 MaterialWrapMode get_layer_wrap_mode_s()(int layer_index) {
1913 return cogl_material_get_layer_wrap_mode_s(&this, layer_index);
1916 // VERSION: 1.6
1917 // Returns the wrap mode for the 't' coordinate of texture lookups on this
1918 // layer.
1920 // this layer.
1921 // RETURNS: the wrap mode for the 't' coordinate of texture lookups on
1922 // <layer_index>: the layer number to change.
1923 MaterialWrapMode get_layer_wrap_mode_t()(int layer_index) {
1924 return cogl_material_get_layer_wrap_mode_t(&this, layer_index);
1927 // This function lets you access a material's internal list of layers
1928 // for iteration.
1930 // <note>You should avoid using this API if possible since it was only
1931 // made public by mistake and will be deprecated when we have
1932 // suitable alternative.</note>
1934 // <note>It's important to understand that the list returned may not
1935 // remain valid if you modify the material or any of the layers in any
1936 // way and so you would have to re-get the list in that
1937 // situation.</note>
1939 // list of #CoglMaterialLayer<!-- -->'s that can be passed to the
1940 // cogl_material_layer_* functions. The list is owned by Cogl and it
1941 // should not be modified or freed
1942 // RETURNS: A
1943 GLib2.List* get_layers()() {
1944 return cogl_material_get_layers(&this);
1947 // VERSION: 1.0
1948 // Retrieves the number of layers defined for the given @material
1949 // RETURNS: the number of layers
1950 int get_n_layers()() {
1951 return cogl_material_get_n_layers(&this);
1954 // VERSION: 1.4
1955 // Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is
1956 // used with the vertex buffer API.
1957 // RETURNS: the point size of the material.
1958 float get_point_size()() {
1959 return cogl_material_get_point_size(&this);
1962 // VERSION: 1.0
1963 // Retrieves the materials current emission color.
1964 // RETURNS: The materials current shininess value
1965 float get_shininess()() {
1966 return cogl_material_get_shininess(&this);
1969 // VERSION: 1.0
1970 // Retrieves the materials current specular color.
1971 // <specular>: The location to store the specular color
1972 void get_specular()(Color* specular) {
1973 cogl_material_get_specular(&this, specular);
1976 // VERSION: 1.4
1977 // Queries what user program has been associated with the given
1978 // @material using cogl_material_set_user_program().
1980 // or %COGL_INVALID_HANDLE.
1981 // RETURNS: The current user program
1982 Handle get_user_program()() {
1983 return cogl_material_get_user_program(&this);
1986 // This function removes a layer from your material
1987 // <layer_index>: Specifies the layer you want to remove
1988 void remove_layer()(int layer_index) {
1989 cogl_material_remove_layer(&this, layer_index);
1992 // VERSION: 1.0
1993 // Before a primitive is blended with the framebuffer, it goes through an
1994 // alpha test stage which lets you discard fragments based on the current
1995 // alpha value. This function lets you change the function used to evaluate
1996 // the alpha channel, and thus determine which fragments are discarded
1997 // and which continue on to the blending stage.
1999 // The default is %COGL_MATERIAL_ALPHA_FUNC_ALWAYS
2000 // <alpha_func>: A @CoglMaterialAlphaFunc constant
2001 // <alpha_reference>: A reference point that the chosen alpha function uses to compare incoming fragments to.
2002 void set_alpha_test_function()(MaterialAlphaFunc alpha_func, float alpha_reference) {
2003 cogl_material_set_alpha_test_function(&this, alpha_func, alpha_reference);
2006 // VERSION: 1.0
2007 // Sets the material's ambient color, in the standard OpenGL lighting
2008 // model. The ambient color affects the overall color of the object.
2010 // Since the diffuse color will be intense when the light hits the surface
2011 // directly, the ambient will be most apparent where the light hits at a
2012 // slant.
2014 // The default value is (0.2, 0.2, 0.2, 1.0)
2015 // <ambient>: The components of the desired ambient color
2016 void set_ambient()(Color* ambient) {
2017 cogl_material_set_ambient(&this, ambient);
2020 // VERSION: 1.0
2021 // Conveniently sets the diffuse and ambient color of @material at the same
2022 // time. See cogl_material_set_ambient() and cogl_material_set_diffuse().
2024 // The default ambient color is (0.2, 0.2, 0.2, 1.0)
2026 // The default diffuse color is (0.8, 0.8, 0.8, 1.0)
2027 // <color>: The components of the desired ambient and diffuse colors
2028 void set_ambient_and_diffuse()(Color* color) {
2029 cogl_material_set_ambient_and_diffuse(&this, color);
2032 // VERSION: 1.0
2033 // If not already familiar; please refer <link linkend="cogl-Blend-Strings">here</link>
2034 // for an overview of what blend strings are, and their syntax.
2036 // Blending occurs after the alpha test function, and combines fragments with
2037 // the framebuffer.
2038 // Currently the only blend function Cogl exposes is ADD(). So any valid
2039 // blend statements will be of the form:
2041 // |[
2042 // &lt;channel-mask&gt;=ADD(SRC_COLOR*(&lt;factor&gt;), DST_COLOR*(&lt;factor&gt;))
2043 // ]|
2045 // <warning>The brackets around blend factors are currently not
2046 // optional!</warning>
2048 // This is the list of source-names usable as blend factors:
2049 // <itemizedlist>
2050 // <listitem><para>SRC_COLOR: The color of the in comming fragment</para></listitem>
2051 // <listitem><para>DST_COLOR: The color of the framebuffer</para></listitem>
2052 // <listitem><para>CONSTANT: The constant set via cogl_material_set_blend_constant()</para></listitem>
2053 // </itemizedlist>
2055 // The source names can be used according to the
2056 // <link linkend="cogl-Blend-String-syntax">color-source and factor syntax</link>,
2057 // so for example "(1-SRC_COLOR[A])" would be a valid factor, as would
2058 // "(CONSTANT[RGB])"
2060 // These can also be used as factors:
2061 // <itemizedlist>
2062 // <listitem>0: (0, 0, 0, 0)</listitem>
2063 // <listitem>1: (1, 1, 1, 1)</listitem>
2064 // <listitem>SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])</listitem>
2065 // </itemizedlist>
2067 // <note>Remember; all color components are normalized to the range [0, 1]
2068 // before computing the result of blending.</note>
2070 // <example id="cogl-Blend-Strings-blend-unpremul">
2071 // <title>Blend Strings/1</title>
2072 // <para>Blend a non-premultiplied source over a destination with
2073 // premultiplied alpha:</para>
2074 // <programlisting>
2075 // "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
2076 // "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
2077 // </programlisting>
2078 // </example>
2080 // <example id="cogl-Blend-Strings-blend-premul">
2081 // <title>Blend Strings/2</title>
2082 // <para>Blend a premultiplied source over a destination with
2083 // premultiplied alpha</para>
2084 // <programlisting>
2085 // "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
2086 // </programlisting>
2087 // </example>
2089 // The default blend string is:
2090 // |[
2091 // RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
2092 // ]|
2094 // That gives normal alpha-blending when the calculated color for the material
2095 // is in premultiplied form.
2097 // described blending is supported by the underlying driver/hardware. If
2098 // there was an error, %FALSE is returned and @error is set accordingly (if
2099 // present).
2100 // RETURNS: %TRUE if the blend string was successfully parsed, and the
2101 // <blend_string>: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired blend function.
2102 int set_blend()(char* blend_string, GLib2.Error** error=null) {
2103 return cogl_material_set_blend(&this, blend_string, error);
2106 // VERSION: 1.0
2107 // When blending is setup to reference a CONSTANT blend factor then
2108 // blending will depend on the constant set with this function.
2109 // <constant_color>: The constant color you want
2110 void set_blend_constant()(Color* constant_color) {
2111 cogl_material_set_blend_constant(&this, constant_color);
2114 // VERSION: 1.0
2115 // Sets the basic color of the material, used when no lighting is enabled.
2117 // Note that if you don't add any layers to the material then the color
2118 // will be blended unmodified with the destination; the default blend
2119 // expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for
2120 // semi-transparent red. See cogl_color_premultiply().
2122 // The default value is (1.0, 1.0, 1.0, 1.0)
2123 // <color>: The components of the color
2124 void set_color()(Color* color) {
2125 cogl_material_set_color(&this, color);
2128 // VERSION: 1.0
2129 // Sets the basic color of the material, used when no lighting is enabled.
2131 // The default value is (1.0, 1.0, 1.0, 1.0)
2132 // <red>: The red component
2133 // <green>: The green component
2134 // <blue>: The blue component
2135 // <alpha>: The alpha component
2136 void set_color4f()(float red, float green, float blue, float alpha) {
2137 cogl_material_set_color4f(&this, red, green, blue, alpha);
2140 // VERSION: 1.0
2141 // Sets the basic color of the material, used when no lighting is enabled.
2143 // The default value is (0xff, 0xff, 0xff, 0xff)
2144 // <red>: The red component
2145 // <green>: The green component
2146 // <blue>: The blue component
2147 // <alpha>: The alpha component
2148 void set_color4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) {
2149 cogl_material_set_color4ub(&this, red, green, blue, alpha);
2152 // VERSION: 1.8
2153 // This commits all the depth state configured in @state struct to the
2154 // given @material. The configuration values are copied into the
2155 // material so there is no requirement to keep the #CoglDepthState
2156 // struct around if you don't need it any more.
2158 // Note: Since some platforms do not support the depth range feature
2159 // it is possible for this function to fail and report an @error.
2161 // and returns an @error.
2162 // RETURNS: TRUE if the GPU supports all the given @state else %FALSE
2163 // <state>: A #CoglDepthState struct
2164 int set_depth_state()(DepthState* state, GLib2.Error** error=null) {
2165 return cogl_material_set_depth_state(&this, state, error);
2168 // VERSION: 1.0
2169 // Sets the material's diffuse color, in the standard OpenGL lighting
2170 // model. The diffuse color is most intense where the light hits the
2171 // surface directly - perpendicular to the surface.
2173 // The default value is (0.8, 0.8, 0.8, 1.0)
2174 // <diffuse>: The components of the desired diffuse color
2175 void set_diffuse()(Color* diffuse) {
2176 cogl_material_set_diffuse(&this, diffuse);
2179 // VERSION: 1.0
2180 // Sets the material's emissive color, in the standard OpenGL lighting
2181 // model. It will look like the surface is a light source emitting this
2182 // color.
2184 // The default value is (0.0, 0.0, 0.0, 1.0)
2185 // <emission>: The components of the desired emissive color
2186 void set_emission()(Color* emission) {
2187 cogl_material_set_emission(&this, emission);
2190 // VERSION: 1.0
2191 // In addition to the standard OpenGL lighting model a Cogl material may have
2192 // one or more layers comprised of textures that can be blended together in
2193 // order, with a number of different texture combine modes. This function
2194 // defines a new texture layer.
2196 // The index values of multiple layers do not have to be consecutive; it is
2197 // only their relative order that is important.
2199 // <note>In the future, we may define other types of material layers, such
2200 // as purely GLSL based layers.</note>
2201 // <layer_index>: the index of the layer
2202 // <texture>: a #CoglHandle for the layer object
2203 void set_layer()(int layer_index, Handle texture) {
2204 cogl_material_set_layer(&this, layer_index, texture);
2207 // VERSION: 1.0
2208 // If not already familiar; you can refer
2209 // <link linkend="cogl-Blend-Strings">here</link> for an overview of what blend
2210 // strings are and there syntax.
2212 // These are all the functions available for texture combining:
2213 // <itemizedlist>
2214 // <listitem>REPLACE(arg0) = arg0</listitem>
2215 // <listitem>MODULATE(arg0, arg1) = arg0 x arg1</listitem>
2216 // <listitem>ADD(arg0, arg1) = arg0 + arg1</listitem>
2217 // <listitem>ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5</listitem>
2218 // <listitem>INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)</listitem>
2219 // <listitem>SUBTRACT(arg0, arg1) = arg0 - arg1</listitem>
2220 // <listitem>
2221 // <programlisting>
2222 // DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
2223 // (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
2224 // (arg0[B] - 0.5)) * (arg1[B] - 0.5))
2225 // </programlisting>
2226 // </listitem>
2227 // <listitem>
2228 // <programlisting>
2229 // DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
2230 // (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
2231 // (arg0[B] - 0.5)) * (arg1[B] - 0.5))
2232 // </programlisting>
2233 // </listitem>
2234 // </itemizedlist>
2236 // Refer to the
2237 // <link linkend="cogl-Blend-String-syntax">color-source syntax</link> for
2238 // describing the arguments. The valid source names for texture combining
2239 // are:
2240 // <variablelist>
2241 // <varlistentry>
2242 // <term>TEXTURE</term>
2243 // <listitem>Use the color from the current texture layer</listitem>
2244 // </varlistentry>
2245 // <varlistentry>
2246 // <term>TEXTURE_0, TEXTURE_1, etc</term>
2247 // <listitem>Use the color from the specified texture layer</listitem>
2248 // </varlistentry>
2249 // <varlistentry>
2250 // <term>CONSTANT</term>
2251 // <listitem>Use the color from the constant given with
2252 // cogl_material_set_layer_constant()</listitem>
2253 // </varlistentry>
2254 // <varlistentry>
2255 // <term>PRIMARY</term>
2256 // <listitem>Use the color of the material as set with
2257 // cogl_material_set_color()</listitem>
2258 // </varlistentry>
2259 // <varlistentry>
2260 // <term>PREVIOUS</term>
2261 // <listitem>Either use the texture color from the previous layer, or
2262 // if this is layer 0, use the color of the material as set with
2263 // cogl_material_set_color()</listitem>
2264 // </varlistentry>
2265 // </variablelist>
2267 // <refsect2 id="cogl-Layer-Combine-Examples">
2268 // <title>Layer Combine Examples</title>
2269 // <para>This is effectively what the default blending is:</para>
2270 // <informalexample><programlisting>
2271 // RGBA = MODULATE (PREVIOUS, TEXTURE)
2272 // </programlisting></informalexample>
2273 // <para>This could be used to cross-fade between two images, using
2274 // the alpha component of a constant as the interpolator. The constant
2275 // color is given by calling cogl_material_set_layer_constant.</para>
2276 // <informalexample><programlisting>
2277 // RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
2278 // </programlisting></informalexample>
2279 // </refsect2>
2281 // <note>You can't give a multiplication factor for arguments as you can
2282 // with blending.</note>
2284 // described texture combining is supported by the underlying driver and
2285 // or hardware. On failure, %FALSE is returned and @error is set
2286 // RETURNS: %TRUE if the blend string was successfully parsed, and the
2287 // <layer_index>: Specifies the layer you want define a combine function for
2288 // <blend_string>: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired texture combine function.
2289 int set_layer_combine()(int layer_index, char* blend_string, GLib2.Error** error=null) {
2290 return cogl_material_set_layer_combine(&this, layer_index, blend_string, error);
2293 // VERSION: 1.0
2294 // When you are using the 'CONSTANT' color source in a layer combine
2295 // description then you can use this function to define its value.
2296 // <layer_index>: Specifies the layer you want to specify a constant used for texture combining
2297 // <constant>: The constant color you want
2298 void set_layer_combine_constant()(int layer_index, Color* constant) {
2299 cogl_material_set_layer_combine_constant(&this, layer_index, constant);
2302 // Changes the decimation and interpolation filters used when a texture is
2303 // drawn at other scales than 100%.
2304 // <layer_index>: the layer number to change.
2305 // <min_filter>: the filter used when scaling a texture down.
2306 // <mag_filter>: the filter used when magnifying a texture.
2307 void set_layer_filters()(int layer_index, MaterialFilter min_filter, MaterialFilter mag_filter) {
2308 cogl_material_set_layer_filters(&this, layer_index, min_filter, mag_filter);
2311 // This function lets you set a matrix that can be used to e.g. translate
2312 // and rotate a single layer of a material used to fill your geometry.
2313 // <layer_index>: the index for the layer inside @material
2314 // <matrix>: the transformation matrix for the layer
2315 void set_layer_matrix()(int layer_index, Matrix* matrix) {
2316 cogl_material_set_layer_matrix(&this, layer_index, matrix);
2319 // VERSION: 1.4
2320 // When rendering points, if @enable is %TRUE then the texture
2321 // coordinates for this layer will be replaced with coordinates that
2322 // vary from 0.0 to 1.0 across the primitive. The top left of the
2323 // point will have the coordinates 0.0,0.0 and the bottom right will
2324 // have 1.0,1.0. If @enable is %FALSE then the coordinates will be
2325 // fixed for the entire point.
2327 // This function will only work if %COGL_FEATURE_POINT_SPRITE is
2328 // available. If the feature is not available then the function will
2329 // return %FALSE and set @error.
2330 // RETURNS: %TRUE if the function succeeds, %FALSE otherwise.
2331 // <layer_index>: the layer number to change.
2332 // <enable>: whether to enable point sprite coord generation.
2333 int set_layer_point_sprite_coords_enabled()(int layer_index, int enable, GLib2.Error** error=null) {
2334 return cogl_material_set_layer_point_sprite_coords_enabled(&this, layer_index, enable, error);
2337 // VERSION: 1.4
2338 // Sets the wrap mode for all three coordinates of texture lookups on
2339 // this layer. This is equivalent to calling
2340 // cogl_material_set_layer_wrap_mode_s(),
2341 // cogl_material_set_layer_wrap_mode_t() and
2342 // cogl_material_set_layer_wrap_mode_p() separately.
2343 // <layer_index>: the layer number to change.
2344 // <mode>: the new wrap mode
2345 void set_layer_wrap_mode()(int layer_index, MaterialWrapMode mode) {
2346 cogl_material_set_layer_wrap_mode(&this, layer_index, mode);
2349 // VERSION: 1.4
2350 // Sets the wrap mode for the 'p' coordinate of texture lookups on
2351 // this layer. 'p' is the third coordinate.
2352 // <layer_index>: the layer number to change.
2353 // <mode>: the new wrap mode
2354 void set_layer_wrap_mode_p()(int layer_index, MaterialWrapMode mode) {
2355 cogl_material_set_layer_wrap_mode_p(&this, layer_index, mode);
2358 // VERSION: 1.4
2359 // Sets the wrap mode for the 's' coordinate of texture lookups on this layer.
2360 // <layer_index>: the layer number to change.
2361 // <mode>: the new wrap mode
2362 void set_layer_wrap_mode_s()(int layer_index, MaterialWrapMode mode) {
2363 cogl_material_set_layer_wrap_mode_s(&this, layer_index, mode);
2366 // VERSION: 1.4
2367 // Sets the wrap mode for the 't' coordinate of texture lookups on this layer.
2368 // <layer_index>: the layer number to change.
2369 // <mode>: the new wrap mode
2370 void set_layer_wrap_mode_t()(int layer_index, MaterialWrapMode mode) {
2371 cogl_material_set_layer_wrap_mode_t(&this, layer_index, mode);
2374 // VERSION: 1.4
2375 // Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is
2376 // used with the vertex buffer API. Note that typically the GPU will
2377 // only support a limited minimum and maximum range of point sizes. If
2378 // the chosen point size is outside that range then the nearest value
2379 // within that range will be used instead. The size of a point is in
2380 // screen space so it will be the same regardless of any
2381 // transformations. The default point size is 1.0.
2382 // <point_size>: the new point size.
2383 void set_point_size()(float point_size) {
2384 cogl_material_set_point_size(&this, point_size);
2387 // VERSION: 1.0
2388 // Sets the shininess of the material, in the standard OpenGL lighting
2389 // model, which determines the size of the specular highlights. A
2390 // higher @shininess will produce smaller highlights which makes the
2391 // object appear more shiny.
2393 // The default value is 0.0
2394 // <shininess>: The desired shininess; must be >= 0.0
2395 void set_shininess()(float shininess) {
2396 cogl_material_set_shininess(&this, shininess);
2399 // VERSION: 1.0
2400 // Sets the material's specular color, in the standard OpenGL lighting
2401 // model. The intensity of the specular color depends on the viewport
2402 // position, and is brightest along the lines of reflection.
2404 // The default value is (0.0, 0.0, 0.0, 1.0)
2405 // <specular>: The components of the desired specular color
2406 void set_specular()(Color* specular) {
2407 cogl_material_set_specular(&this, specular);
2410 // VERSION: 1.4
2411 // Associates a linked CoglProgram with the given material so that the
2412 // program can take full control of vertex and/or fragment processing.
2414 // This is an example of how it can be used to associate an ARBfp
2415 // program with a #CoglMaterial:
2416 // |[
2417 // CoglHandle shader;
2418 // CoglHandle program;
2419 // CoglMaterial *material;
2421 // shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
2422 // cogl_shader_source (shader,
2423 // "!!ARBfp1.0\n"
2424 // "MOV result.color,fragment.color;\n"
2425 // "END\n");
2426 // cogl_shader_compile (shader);
2428 // program = cogl_create_program ();
2429 // cogl_program_attach_shader (program, shader);
2430 // cogl_program_link (program);
2432 // material = cogl_material_new ();
2433 // cogl_material_set_user_program (material, program);
2435 // cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
2436 // cogl_rectangle (0, 0, 100, 100);
2437 // ]|
2439 // It is possibly worth keeping in mind that this API is not part of
2440 // the long term design for how we want to expose shaders to Cogl
2441 // developers (We are planning on deprecating the cogl_program and
2442 // cogl_shader APIs in favour of a "snippet" framework) but in the
2443 // meantime we hope this will handle most practical GLSL and ARBfp
2444 // requirements.
2446 // Also remember you need to check for either the
2447 // %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
2448 // using the cogl_program or cogl_shader API.
2449 // <program>: A #CoglHandle to a linked CoglProgram
2450 void set_user_program()(Handle program) {
2451 cogl_material_set_user_program(&this, program);
2454 // Unintrospectable function: new() / cogl_material_new()
2455 // Allocates and initializes a blank white material
2456 // RETURNS: a pointer to a new #CoglMaterial
2457 static Material* new_()() {
2458 return cogl_material_new();
2461 // Unintrospectable function: ref() / cogl_material_ref()
2462 // VERSION: 1.0
2463 // DEPRECATED (v1.2) function: ref - Use cogl_object_ref() instead
2464 // Increment the reference count for a #CoglMaterial.
2465 // RETURNS: the @material.
2466 // <material>: a #CoglMaterial object.
2467 static Handle ref_()(Handle material) {
2468 return cogl_material_ref(material);
2471 // VERSION: 1.0
2472 // DEPRECATED (v1.2) function: unref - Use cogl_object_unref() instead
2473 // Decrement the reference count for a #CoglMaterial.
2474 // <material>: a #CoglMaterial object.
2475 static void unref()(Handle material) {
2476 cogl_material_unref(material);
2481 // Alpha testing happens before blending primitives with the framebuffer and
2482 // gives an opportunity to discard fragments based on a comparison with the
2483 // incoming alpha value and a reference alpha value. The #CoglMaterialAlphaFunc
2484 // determines how the comparison is done.
2485 enum MaterialAlphaFunc {
2486 NEVER = 512,
2487 LESS = 513,
2488 EQUAL = 514,
2489 LEQUAL = 515,
2490 GREATER = 516,
2491 NOTEQUAL = 517,
2492 GEQUAL = 518,
2493 ALWAYS = 519
2496 // Texture filtering is used whenever the current pixel maps either to more
2497 // than one texture element (texel) or less than one. These filter enums
2498 // correspond to different strategies used to come up with a pixel color, by
2499 // possibly referring to multiple neighbouring texels and taking a weighted
2500 // average or simply using the nearest texel.
2501 enum MaterialFilter {
2502 NEAREST = 9728,
2503 LINEAR = 9729,
2504 NEAREST_MIPMAP_NEAREST = 9984,
2505 LINEAR_MIPMAP_NEAREST = 9985,
2506 NEAREST_MIPMAP_LINEAR = 9986,
2507 LINEAR_MIPMAP_LINEAR = 9987
2509 struct MaterialLayer {
2511 // Queries the currently set downscaling filter for a material later
2512 // RETURNS: the current downscaling filter
2513 MaterialFilter get_mag_filter()() {
2514 return cogl_material_layer_get_mag_filter(&this);
2517 // Queries the currently set downscaling filter for a material layer
2518 // RETURNS: the current downscaling filter
2519 MaterialFilter get_min_filter()() {
2520 return cogl_material_layer_get_min_filter(&this);
2523 // Extracts a texture handle for a specific layer.
2525 // <note>In the future Cogl may support purely GLSL based layers; for those
2526 // layers this function which will likely return %COGL_INVALID_HANDLE if you
2527 // try to get the texture handle from them. Considering this scenario, you
2528 // should call cogl_material_layer_get_type() first in order check it is of
2529 // type %COGL_MATERIAL_LAYER_TYPE_TEXTURE before calling this function.</note>
2530 // RETURNS: a #CoglHandle for the texture inside the layer
2531 Handle get_texture()() {
2532 return cogl_material_layer_get_texture(&this);
2535 // VERSION: 1.4
2536 // Gets the wrap mode for the 'p' coordinate of texture lookups on
2537 // this layer. 'p' is the third coordinate.
2538 // RETURNS: the wrap mode value for the p coordinate.
2539 MaterialWrapMode get_wrap_mode_p()() {
2540 return cogl_material_layer_get_wrap_mode_p(&this);
2543 // VERSION: 1.4
2544 // Gets the wrap mode for the 's' coordinate of texture lookups on this layer.
2545 // RETURNS: the wrap mode value for the s coordinate.
2546 MaterialWrapMode get_wrap_mode_s()() {
2547 return cogl_material_layer_get_wrap_mode_s(&this);
2550 // VERSION: 1.4
2551 // Gets the wrap mode for the 't' coordinate of texture lookups on this layer.
2552 // RETURNS: the wrap mode value for the t coordinate.
2553 MaterialWrapMode get_wrap_mode_t()() {
2554 return cogl_material_layer_get_wrap_mode_t(&this);
2559 // VERSION: 1.4
2560 // The callback prototype used with cogl_material_foreach_layer() for
2561 // iterating all the layers of a @material.
2562 // <material>: The #CoglMaterial whos layers are being iterated
2563 // <layer_index>: The current layer index
2564 // <user_data>: The private data passed to cogl_material_foreach_layer()
2565 extern (C) alias int function (Material* material, int layer_index, void* user_data) MaterialLayerCallback;
2568 // Available types of layers for a #CoglMaterial. This enumeration
2569 // might be expanded in later versions.
2570 enum MaterialLayerType /* Version 1.0 */ {
2571 TEXTURE = 0
2574 // The wrap mode specifies what happens when texture coordinates
2575 // outside the range 0→1 are used. Note that if the filter mode is
2576 // anything but %COGL_MATERIAL_FILTER_NEAREST then texels outside the
2577 // range 0→1 might be used even when the coordinate is exactly 0 or 1
2578 // because OpenGL will try to sample neighbouring pixels. For example
2579 // if you are trying to render the full texture then you may get
2580 // artifacts around the edges when the pixels from the other side are
2581 // merged in if the wrap mode is set to repeat.
2582 enum MaterialWrapMode /* Version 1.4 */ {
2583 REPEAT = 10497,
2584 CLAMP_TO_EDGE = 33071,
2585 AUTOMATIC = 519
2588 // A CoglMatrix holds a 4x4 transform matrix. This is a single precision,
2589 // column-major matrix which means it is compatible with what OpenGL expects.
2591 // A CoglMatrix can represent transforms such as, rotations, scaling,
2592 // translation, sheering, and linear projections. You can combine these
2593 // transforms by multiplying multiple matrices in the order you want them
2594 // applied.
2596 // The transformation of a vertex (x, y, z, w) by a CoglMatrix is given by:
2598 // |[
2599 // x_new = xx * x + xy * y + xz * z + xw * w
2600 // y_new = yx * x + yy * y + yz * z + yw * w
2601 // z_new = zx * x + zy * y + zz * z + zw * w
2602 // w_new = wx * x + wy * y + wz * z + ww * w
2603 // ]|
2605 // Where w is normally 1
2607 // <note>You must consider the members of the CoglMatrix structure read only,
2608 // and all matrix modifications must be done via the cogl_matrix API. This
2609 // allows Cogl to annotate the matrices internally. Violation of this will give
2610 // undefined results. If you need to initialize a matrix with a constant other
2611 // than the identity matrix you can use cogl_matrix_init_from_array().</note>
2612 struct Matrix {
2613 float xx, yx, zx, wx, xy, yy, zy, wy, xz, yz, zz, wz, xw, yw, zw, ww;
2614 private float[16] inv;
2615 private uint type, flags, _padding3;
2618 // Unintrospectable method: copy() / cogl_matrix_copy()
2619 // VERSION: 1.6
2620 // Allocates a new #CoglMatrix on the heap and initializes it with
2621 // the same values as @matrix.
2623 // cogl_matrix_free()
2624 // RETURNS: A newly allocated #CoglMatrix which should be freed using
2625 Matrix* copy()() {
2626 return cogl_matrix_copy(&this);
2629 // VERSION: 1.6
2630 // Frees a #CoglMatrix that was previously allocated via a call to
2631 // cogl_matrix_copy().
2632 void free()() {
2633 cogl_matrix_free(&this);
2636 // Multiplies @matrix by the given frustum perspective matrix.
2637 // <left>: X position of the left clipping plane where it intersects the near clipping plane
2638 // <right>: X position of the right clipping plane where it intersects the near clipping plane
2639 // <bottom>: Y position of the bottom clipping plane where it intersects the near clipping plane
2640 // <top>: Y position of the top clipping plane where it intersects the near clipping plane
2641 // <z_near>: The distance to the near clipping plane (Must be positive)
2642 // <z_far>: The distance to the far clipping plane (Must be positive)
2643 void frustum()(float left, float right, float bottom, float top, float z_near, float z_far) {
2644 cogl_matrix_frustum(&this, left, right, bottom, top, z_near, z_far);
2647 // Casts @matrix to a float array which can be directly passed to OpenGL.
2648 // RETURNS: a pointer to the float array
2649 float* get_array()() {
2650 return cogl_matrix_get_array(&this);
2653 // VERSION: 1.2
2654 // Gets the inverse transform of a given matrix and uses it to initialize
2655 // a new #CoglMatrix.
2657 // <note>Although the first parameter is annotated as const to indicate
2658 // that the transform it represents isn't modified this function may
2659 // technically save a copy of the inverse transform within the given
2660 // #CoglMatrix so that subsequent requests for the inverse transform may
2661 // avoid costly inversion calculations.</note>
2663 // for degenerate transformations that can't be inverted (in this case the
2664 // @inverse matrix will simply be initialized with the identity matrix)
2665 // RETURNS: %TRUE if the inverse was successfully calculated or %FALSE
2666 // <inverse>: The destination for a 4x4 inverse transformation matrix
2667 int get_inverse()(/*out*/ Matrix* inverse) {
2668 return cogl_matrix_get_inverse(&this, inverse);
2671 // Initializes @matrix with the contents of @array
2672 // <array>: A linear array of 16 floats (column-major order)
2673 void init_from_array()(float* array) {
2674 cogl_matrix_init_from_array(&this, array);
2677 // Initializes @matrix from a #CoglQuaternion rotation.
2678 // RETURNS: a pointer to the float array
2679 // <quaternion>: A #CoglQuaternion
2680 void init_from_quaternion()(Quaternion* quaternion) {
2681 cogl_matrix_init_from_quaternion(&this, quaternion);
2684 // Resets matrix to the identity matrix:
2686 // |[
2687 // .xx=1; .xy=0; .xz=0; .xw=0;
2688 // .yx=0; .yy=1; .yz=0; .yw=0;
2689 // .zx=0; .zy=0; .zz=1; .zw=0;
2690 // .wx=0; .wy=0; .wz=0; .ww=1;
2691 // ]|
2692 void init_identity()() {
2693 cogl_matrix_init_identity(&this);
2696 // VERSION: 1.8
2697 // Determines if the given matrix is an identity matrix.
2698 // RETURNS: %TRUE if @matrix is an identity matrix else %FALSE
2699 int is_identity()() {
2700 return cogl_matrix_is_identity(&this);
2703 // VERSION: 1.8
2704 // Applies a view transform @matrix that positions the camera at
2705 // the coordinate (@eye_position_x, @eye_position_y, @eye_position_z)
2706 // looking towards an object at the coordinate (@object_x, @object_y,
2707 // @object_z). The top of the camera is aligned to the given world up
2708 // vector, which is normally simply (0, 1, 0) to map up to the
2709 // positive direction of the y axis.
2711 // Because there is a lot of missleading documentation online for
2712 // gluLookAt regarding the up vector we want to try and be a bit
2713 // clearer here.
2715 // The up vector should simply be relative to your world coordinates
2716 // and does not need to change as you move the eye and object
2717 // positions. Many online sources may claim that the up vector needs
2718 // to be perpendicular to the vector between the eye and object
2719 // position (partly because the man page is somewhat missleading) but
2720 // that is not necessary for this function.
2722 // <note>You should never look directly along the world-up
2723 // vector.</note>
2725 // <note>It is assumed you are using a typical projection matrix where
2726 // your origin maps to the center of your viewport.</note>
2728 // <note>Almost always when you use this function it should be the first
2729 // transform applied to a new modelview transform</note>
2730 // <eye_position_x>: The X coordinate to look from
2731 // <eye_position_y>: The Y coordinate to look from
2732 // <eye_position_z>: The Z coordinate to look from
2733 // <object_x>: The X coordinate of the object to look at
2734 // <object_y>: The Y coordinate of the object to look at
2735 // <object_z>: The Z coordinate of the object to look at
2736 // <world_up_x>: The X component of the world's up direction vector
2737 // <world_up_y>: The Y component of the world's up direction vector
2738 // <world_up_z>: The Z component of the world's up direction vector
2739 void look_at()(float eye_position_x, float eye_position_y, float eye_position_z, float object_x, float object_y, float object_z, float world_up_x, float world_up_y, float world_up_z) {
2740 cogl_matrix_look_at(&this, eye_position_x, eye_position_y, eye_position_z, object_x, object_y, object_z, world_up_x, world_up_y, world_up_z);
2743 // Multiplies the two supplied matrices together and stores
2744 // the resulting matrix inside @result.
2746 // <note>It is possible to multiply the @a matrix in-place, so
2747 // @result can be equal to @a but can't be equal to @b.</note>
2748 // <a>: A 4x4 transformation matrix
2749 // <b>: A 4x4 transformation matrix
2750 void multiply()(Matrix* a, Matrix* b) {
2751 cogl_matrix_multiply(&this, a, b);
2754 // DEPRECATED (v1.10) method: ortho - Use cogl_matrix_orthographic()
2755 // Multiplies @matrix by a parallel projection matrix.
2756 // <left>: The coordinate for the left clipping plane
2757 // <right>: The coordinate for the right clipping plane
2758 // <bottom>: The coordinate for the bottom clipping plane
2759 // <top>: The coordinate for the top clipping plane
2760 // <near>: The <emphasis>distance</emphasis> to the near clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
2761 // <far>: The <emphasis>distance</emphasis> to the far clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
2762 void ortho()(float left, float right, float bottom, float top, float near, float far) {
2763 cogl_matrix_ortho(&this, left, right, bottom, top, near, far);
2766 // VERSION: 1.10
2767 // Multiplies @matrix by a parallel projection matrix.
2768 // <x_1>: The x coordinate for the first vertical clipping plane
2769 // <y_1>: The y coordinate for the first horizontal clipping plane
2770 // <x_2>: The x coordinate for the second vertical clipping plane
2771 // <y_2>: The y coordinate for the second horizontal clipping plane
2772 // <near>: The <emphasis>distance</emphasis> to the near clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
2773 // <far>: The <emphasis>distance</emphasis> to the far clipping plane (will be <emphasis>negative</emphasis> if the plane is behind the viewer)
2774 void orthographic()(float x_1, float y_1, float x_2, float y_2, float near, float far) {
2775 cogl_matrix_orthographic(&this, x_1, y_1, x_2, y_2, near, far);
2778 // Multiplies @matrix by the described perspective matrix
2780 // <note>You should be careful not to have to great a @z_far / @z_near
2781 // ratio since that will reduce the effectiveness of depth testing
2782 // since there wont be enough precision to identify the depth of
2783 // objects near to each other.</note>
2784 // <aspect>: The (width over height) aspect ratio for display
2785 // <z_near>: The distance to the near clipping plane (Must be positive, and must not be 0)
2786 // <z_far>: The distance to the far clipping plane (Must be positive)
2787 void perspective()(float fov_y, float aspect, float z_near, float z_far) {
2788 cogl_matrix_perspective(&this, fov_y, aspect, z_near, z_far);
2791 // Projects an array of input points and writes the result to another
2792 // array of output points. The input points can either have 2, 3 or 4
2793 // components each. The output points always have 4 components (known
2794 // as homogenous coordinates). The output array can simply point to
2795 // the input array to do the transform in-place.
2797 // Here's an example with differing input/output strides:
2798 // |[
2799 // typedef struct {
2800 // float x,y;
2801 // guint8 r,g,b,a;
2802 // float s,t,p;
2803 // } MyInVertex;
2804 // typedef struct {
2805 // guint8 r,g,b,a;
2806 // float x,y,z;
2807 // } MyOutVertex;
2808 // MyInVertex vertices[N_VERTICES];
2809 // MyOutVertex results[N_VERTICES];
2810 // CoglMatrix matrix;
2812 // my_load_vertices (vertices);
2813 // my_get_matrix (&matrix);
2815 // cogl_matrix_project_points (&matrix,
2816 // 2,
2817 // sizeof (MyInVertex),
2818 // &vertices[0].x,
2819 // sizeof (MyOutVertex),
2820 // &results[0].x,
2821 // N_VERTICES);
2822 // ]|
2823 // <n_components>: The number of position components for each input point. (either 2, 3 or 4)
2824 // <stride_in>: The stride in bytes between input points.
2825 // <points_in>: A pointer to the first component of the first input point.
2826 // <stride_out>: The stride in bytes between output points.
2827 // <points_out>: A pointer to the first component of the first output point.
2828 // <n_points>: The number of points to transform.
2829 void project_points()(int n_components, size_t stride_in, void* points_in, size_t stride_out, void* points_out, int n_points) {
2830 cogl_matrix_project_points(&this, n_components, stride_in, points_in, stride_out, points_out, n_points);
2833 // Multiplies @matrix with a rotation matrix that applies a rotation
2834 // of @angle degrees around the specified 3D vector.
2835 // <angle>: The angle you want to rotate in degrees
2836 // <x>: X component of your rotation vector
2837 // <y>: Y component of your rotation vector
2838 // <z>: Z component of your rotation vector
2839 void rotate()(float angle, float x, float y, float z) {
2840 cogl_matrix_rotate(&this, angle, x, y, z);
2843 // Multiplies @matrix with a transform matrix that scales along the X,
2844 // Y and Z axis.
2845 // <sx>: The X scale factor
2846 // <sy>: The Y scale factor
2847 // <sz>: The Z scale factor
2848 void scale()(float sx, float sy, float sz) {
2849 cogl_matrix_scale(&this, sx, sy, sz);
2852 // Transforms a point whos position is given and returned as four float
2853 // components.
2854 // <x>: The X component of your points position
2855 // <y>: The Y component of your points position
2856 // <z>: The Z component of your points position
2857 // <w>: The W component of your points position
2858 void transform_point()(/*inout*/ float* x, /*inout*/ float* y, /*inout*/ float* z, /*inout*/ float* w) {
2859 cogl_matrix_transform_point(&this, x, y, z, w);
2862 // Transforms an array of input points and writes the result to
2863 // another array of output points. The input points can either have 2
2864 // or 3 components each. The output points always have 3 components.
2865 // The output array can simply point to the input array to do the
2866 // transform in-place.
2868 // If you need to transform 4 component points see
2869 // cogl_matrix_project_points().
2871 // Here's an example with differing input/output strides:
2872 // |[
2873 // typedef struct {
2874 // float x,y;
2875 // guint8 r,g,b,a;
2876 // float s,t,p;
2877 // } MyInVertex;
2878 // typedef struct {
2879 // guint8 r,g,b,a;
2880 // float x,y,z;
2881 // } MyOutVertex;
2882 // MyInVertex vertices[N_VERTICES];
2883 // MyOutVertex results[N_VERTICES];
2884 // CoglMatrix matrix;
2886 // my_load_vertices (vertices);
2887 // my_get_matrix (&matrix);
2889 // cogl_matrix_transform_points (&matrix,
2890 // 2,
2891 // sizeof (MyInVertex),
2892 // &vertices[0].x,
2893 // sizeof (MyOutVertex),
2894 // &results[0].x,
2895 // N_VERTICES);
2896 // ]|
2897 // <n_components>: The number of position components for each input point. (either 2 or 3)
2898 // <stride_in>: The stride in bytes between input points.
2899 // <points_in>: A pointer to the first component of the first input point.
2900 // <stride_out>: The stride in bytes between output points.
2901 // <points_out>: A pointer to the first component of the first output point.
2902 // <n_points>: The number of points to transform.
2903 void transform_points()(int n_components, size_t stride_in, void* points_in, size_t stride_out, void* points_out, int n_points) {
2904 cogl_matrix_transform_points(&this, n_components, stride_in, points_in, stride_out, points_out, n_points);
2907 // Multiplies @matrix with a transform matrix that translates along
2908 // the X, Y and Z axis.
2909 // <x>: The X translation you want to apply
2910 // <y>: The Y translation you want to apply
2911 // <z>: The Z translation you want to apply
2912 void translate()(float x, float y, float z) {
2913 cogl_matrix_translate(&this, x, y, z);
2916 // VERSION: 1.10
2917 // Replaces @matrix with its transpose. Ie, every element (i,j) in the
2918 // new matrix is taken from element (j,i) in the old matrix.
2919 void transpose()() {
2920 cogl_matrix_transpose(&this);
2923 // VERSION: 1.8
2924 // Multiplies @matrix by a view transform that maps the 2D coordinates
2925 // (0,0) top left and (@width_2d,@height_2d) bottom right the full viewport
2926 // size. Geometry at a depth of 0 will now lie on this 2D plane.
2928 // Note: this doesn't multiply the matrix by any projection matrix,
2929 // but it assumes you have a perspective projection as defined by
2930 // passing the corresponding arguments to cogl_matrix_frustum().
2931 // Toolkits such as Clutter that mix 2D and 3D drawing can use this to
2932 // create a 2D coordinate system within a 3D perspective projected
2933 // view frustum.
2934 // <left>: coord of left vertical clipping plane
2935 // <right>: coord of right vertical clipping plane
2936 // <bottom>: coord of bottom horizontal clipping plane
2937 // <top>: coord of top horizontal clipping plane
2938 // <z_near>: The distance to the near clip plane. Never pass 0 and always pass a positive number.
2939 // <z_2d>: The distance to the 2D plane. (Should always be positive and be between @z_near and the z_far value that was passed to cogl_matrix_frustum())
2940 // <width_2d>: The width of the 2D coordinate system
2941 // <height_2d>: The height of the 2D coordinate system
2942 void view_2d_in_frustum()(float left, float right, float bottom, float top, float z_near, float z_2d, float width_2d, float height_2d) {
2943 cogl_matrix_view_2d_in_frustum(&this, left, right, bottom, top, z_near, z_2d, width_2d, height_2d);
2946 // VERSION: 1.8
2947 // Multiplies @matrix by a view transform that maps the 2D coordinates
2948 // (0,0) top left and (@width_2d,@height_2d) bottom right the full viewport
2949 // size. Geometry at a depth of 0 will now lie on this 2D plane.
2951 // Note: this doesn't multiply the matrix by any projection matrix,
2952 // but it assumes you have a perspective projection as defined by
2953 // passing the corresponding arguments to cogl_matrix_perspective().
2955 // Toolkits such as Clutter that mix 2D and 3D drawing can use this to
2956 // create a 2D coordinate system within a 3D perspective projected
2957 // view frustum.
2958 // <fov_y>: A field of view angle for the Y axis
2959 // <aspect>: The ratio of width to height determining the field of view angle for the x axis.
2960 // <z_near>: The distance to the near clip plane. Never pass 0 and always pass a positive number.
2961 // <z_2d>: The distance to the 2D plane. (Should always be positive and be between @z_near and the z_far value that was passed to cogl_matrix_frustum())
2962 // <width_2d>: The width of the 2D coordinate system
2963 // <height_2d>: The height of the 2D coordinate system
2964 void view_2d_in_perspective()(float fov_y, float aspect, float z_near, float z_2d, float width_2d, float height_2d) {
2965 cogl_matrix_view_2d_in_perspective(&this, fov_y, aspect, z_near, z_2d, width_2d, height_2d);
2968 // VERSION: 1.4
2969 // Compares two matrices to see if they represent the same
2970 // transformation. Although internally the matrices may have different
2971 // annotations associated with them and may potentially have a cached
2972 // inverse matrix these are not considered in the comparison.
2973 // <v1>: A 4x4 transformation matrix
2974 // <v2>: A 4x4 transformation matrix
2975 static int equal()(const(void)* v1, const(void)* v2) {
2976 return cogl_matrix_equal(v1, v2);
2980 struct MetaTexture {
2982 // Unintrospectable method: foreach_in_region() / cogl_meta_texture_foreach_in_region()
2983 // VERSION: 1.10
2984 // Allows you to manually iterate the low-level textures that define a
2985 // given region of a high-level #CoglMetaTexture.
2987 // For example cogl_texture_2d_sliced_new_with_size() can be used to
2988 // create a meta texture that may slice a large image into multiple,
2989 // smaller power-of-two sized textures. These high level textures are
2990 // not directly understood by a GPU and so this API must be used to
2991 // manually resolve the underlying textures for drawing.
2993 // All high level textures (#CoglAtlasTexture, #CoglSubTexture,
2994 // #CoglTexturePixmapX11, and #CoglTexture2DSliced) can be handled
2995 // consistently using this interface which greately simplifies
2996 // implementing primitives that support all texture types.
2998 // For example if you use the cogl_rectangle() API then Cogl will
2999 // internally use this API to resolve the low level textures of any
3000 // meta textures you have associated with CoglPipeline layers.
3002 // <note>The low level drawing APIs such as cogl_draw_attributes()
3003 // don't understand the #CoglMetaTexture interface and so it is your
3004 // responsibility to use this API to resolve all CoglPipeline
3005 // textures into low-level textures before drawing.</note>
3007 // For each low-level texture that makes up part of the given region
3008 // of the @meta_texture, @callback is called specifying how the
3009 // low-level texture maps to the original region.
3010 // <tx_1>: The top-left x coordinate of the region to iterate
3011 // <ty_1>: The top-left y coordinate of the region to iterate
3012 // <tx_2>: The bottom-right x coordinate of the region to iterate
3013 // <ty_2>: The bottom-right y coordinate of the region to iterate
3014 // <callback>: A #CoglMetaTextureCallback pointer to be called for each low-level texture within the specified region.
3015 // <user_data>: A private pointer that is passed to @callback.
3016 void foreach_in_region()(float tx_1, float ty_1, float tx_2, float ty_2, PipelineWrapMode wrap_s, PipelineWrapMode wrap_t, MetaTextureCallback callback, void* user_data) {
3017 cogl_meta_texture_foreach_in_region(&this, tx_1, ty_1, tx_2, ty_2, wrap_s, wrap_t, callback, user_data);
3022 // VERSION: 1.10
3023 // A callback used with cogl_meta_texture_foreach_in_region() to
3024 // retrieve details of all the low-level #CoglTexture<!-- -->s that
3025 // make up a given #CoglMetaTexture.
3026 // <sub_texture>: A low-level #CoglTexture making up part of a #CoglMetaTexture.
3027 // <sub_texture_coords>: A float 4-tuple ordered like (tx1,ty1,tx2,ty2) defining what region of the current @sub_texture maps to a sub-region of a #CoglMetaTexture. (tx1,ty1) is the top-left sub-region coordinate and (tx2,ty2) is the bottom-right. These are low-level texture coordinates.
3028 // <meta_coords>: A float 4-tuple ordered like (tx1,ty1,tx2,ty2) defining what sub-region of a #CoglMetaTexture this low-level @sub_texture maps too. (tx1,ty1) is the top-left sub-region coordinate and (tx2,ty2) is the bottom-right. These are high-level meta-texture coordinates.
3029 // <user_data>: A private pointer passed to cogl_meta_texture_foreach_in_region().
3030 extern (C) alias void function (Texture* sub_texture, float* sub_texture_coords, float* meta_coords, void* user_data) MetaTextureCallback;
3032 struct Object {
3034 // Unintrospectable method: get_user_data() / cogl_object_get_user_data()
3035 // VERSION: 1.4
3036 // Finds the user data previously associated with @object using
3037 // the given @key. If no user data has been associated with @object
3038 // for the given @key this function returns NULL.
3040 // with @object using the given @key; or %NULL if no associated
3041 // data is found.
3042 // RETURNS: The user data previously associated
3043 // <key>: The address of a #CoglUserDataKey which provides a unique value with which to index the private data.
3044 void* get_user_data()(UserDataKey* key) {
3045 return cogl_object_get_user_data(&this, key);
3048 // Unintrospectable method: set_user_data() / cogl_object_set_user_data()
3049 // VERSION: 1.4
3050 // Associates some private @user_data with a given #CoglObject. To
3051 // later remove the association call cogl_object_set_user_data() with
3052 // the same @key but NULL for the @user_data.
3053 // <key>: The address of a #CoglUserDataKey which provides a unique value with which to index the private data.
3054 // <user_data>: The data to associate with the given object, or %NULL to remove a previous association.
3055 // <destroy>: A #CoglUserDataDestroyCallback to call if the object is destroyed or if the association is removed by later setting %NULL data for the same key.
3056 void set_user_data()(UserDataKey* key, void* user_data, UserDataDestroyCallback destroy) {
3057 cogl_object_set_user_data(&this, key, user_data, destroy);
3060 // Unintrospectable function: ref() / cogl_object_ref()
3061 // Increases the reference count of @handle by 1
3062 // RETURNS: the @object, with its reference count increased
3063 // <object>: a #CoglObject
3064 static void* ref_()(void* object) {
3065 return cogl_object_ref(object);
3068 // Unintrospectable function: unref() / cogl_object_unref()
3069 // Drecreases the reference count of @object by 1; if the reference
3070 // count reaches 0, the resources allocated by @object will be freed
3071 // <object>: a #CoglObject
3072 static void unref()(void* object) {
3073 cogl_object_unref(object);
3077 struct Onscreen {
3079 // VERSION: 2.0
3080 // This requests to make @onscreen invisible to the user.
3082 // Actually the precise semantics of this function depend on the
3083 // window system currently in use, and if you don't have a
3084 // multi-windowining system this function may in-fact do nothing.
3086 // This function does not implicitly allocate the given @onscreen
3087 // framebuffer before hiding it.
3089 // <note>Since Cogl doesn't explicitly track the visibility status of
3090 // onscreen framebuffers it wont try to avoid redundant window system
3091 // requests e.g. to show an already visible window. This also means
3092 // that it's acceptable to alternatively use native APIs to show and
3093 // hide windows without confusing Cogl.</note>
3094 void hide()() {
3095 cogl_onscreen_hide(&this);
3098 // VERSION: 1.8
3099 // Requests that the given @onscreen framebuffer should have swap buffer
3100 // requests (made using cogl_framebuffer_swap_buffers()) throttled either by a
3101 // displays vblank period or perhaps some other mechanism in a composited
3102 // environment.
3103 // <throttled>: Whether swap throttling is wanted or not.
3104 void set_swap_throttled()(int throttled) {
3105 cogl_onscreen_set_swap_throttled(&this, throttled);
3108 // VERSION: 2.0
3109 // This requests to make @onscreen visible to the user.
3111 // Actually the precise semantics of this function depend on the
3112 // window system currently in use, and if you don't have a
3113 // multi-windowining system this function may in-fact do nothing.
3115 // This function will implicitly allocate the given @onscreen
3116 // framebuffer before showing it if it hasn't already been allocated.
3118 // <note>Since Cogl doesn't explicitly track the visibility status of
3119 // onscreen framebuffers it wont try to avoid redundant window system
3120 // requests e.g. to show an already visible window. This also means
3121 // that it's acceptable to alternatively use native APIs to show and
3122 // hide windows without confusing Cogl.</note>
3123 void show()() {
3124 cogl_onscreen_show(&this);
3126 static void clutter_backend_set_size_CLUTTER()(int width, int height) {
3127 cogl_onscreen_clutter_backend_set_size_CLUTTER(width, height);
3130 // Unintrospectable function: new() / cogl_onscreen_new()
3131 // VERSION: 1.8
3132 // Instantiates an "unallocated" #CoglOnscreen framebuffer that may be
3133 // configured before later being allocated, either implicitly when
3134 // it is first used or explicitly via cogl_framebuffer_allocate().
3135 // RETURNS: A newly instantiated #CoglOnscreen framebuffer
3136 // <context>: A #CoglContext
3137 // <width>: The desired framebuffer width
3138 // <height>: The desired framebuffer height
3139 static Onscreen* new_()(Cogl.Context* context, int width, int height) {
3140 return cogl_onscreen_new(context, width, height);
3144 struct OnscreenTemplate {
3146 // VERSION: 1.10
3147 // Requires that any future CoglOnscreen framebuffers derived from
3148 // this template must support making at least @n samples per pixel
3149 // which will all contribute to the final resolved color for that
3150 // pixel.
3152 // By default this value is usually set to 0 and that is referred to
3153 // as "single-sample" rendering. A value of 1 or greater is referred
3154 // to as "multisample" rendering.
3156 // <note>There are some semantic differences between single-sample
3157 // rendering and multisampling with just 1 point sample such as it
3158 // being redundant to use the cogl_framebuffer_resolve_samples() and
3159 // cogl_framebuffer_resolve_samples_region() apis with single-sample
3160 // rendering.</note>
3161 // <n>: The minimum number of samples per pixel
3162 void set_samples_per_pixel()(int n) {
3163 cogl_onscreen_template_set_samples_per_pixel(&this, n);
3166 // VERSION: 1.10
3167 // Requests that any future #CoglOnscreen framebuffers derived from this
3168 // template should enable or disable swap throttling according to the given
3169 // @throttled argument.
3170 // <throttled>: Whether throttling should be enabled
3171 void set_swap_throttled()(int throttled) {
3172 cogl_onscreen_template_set_swap_throttled(&this, throttled);
3174 // Unintrospectable function: new_EXP() / cogl_onscreen_template_new_EXP()
3175 static OnscreenTemplate* new_EXP()(SwapChain* swap_chain) {
3176 return cogl_onscreen_template_new_EXP(swap_chain);
3180 extern (C) alias void function (Onscreen* onscreen, uint event_mask, void* user_data) OnscreenX11MaskCallback;
3182 enum int PIXEL_FORMAT_24 = 2;
3183 enum int PIXEL_FORMAT_32 = 3;
3184 enum int PREMULT_BIT = 128;
3185 struct Path {
3187 // Unintrospectable method: copy() / cogl_path_copy()
3188 // VERSION: 2.0
3189 // Returns a new copy of the path in @path. The new path has a
3190 // reference count of 1 so you should unref it with
3191 // cogl_object_unref() if you no longer need it.
3193 // Internally the path will share the data until one of the paths is
3194 // modified so copying paths should be relatively cheap.
3195 // RETURNS: a copy of the path in @path.
3196 Path* copy()() {
3197 return cogl_path_copy(&this);
3200 // VERSION: 2.0
3201 // Adds an elliptical arc segment to the current path. A straight line
3202 // segment will link the current pen location with the first vertex
3203 // of the arc. If you perform a move_to to the arcs start just before
3204 // drawing it you create a free standing arc.
3206 // The angles are measured in degrees where 0° is in the direction of
3207 // the positive X axis and 90° is in the direction of the positive Y
3208 // axis. The angle of the arc begins at @angle_1 and heads towards
3209 // @angle_2 (so if @angle_2 is less than @angle_1 it will decrease,
3210 // otherwise it will increase).
3211 // <center_x>: X coordinate of the elliptical arc center
3212 // <center_y>: Y coordinate of the elliptical arc center
3213 // <radius_x>: X radius of the elliptical arc
3214 // <radius_y>: Y radius of the elliptical arc
3215 // <angle_1>: Angle in degrees at which the arc begin
3216 // <angle_2>: Angle in degrees at which the arc ends
3217 static void arc()(float center_x, float center_y, float radius_x, float radius_y, float angle_1, float angle_2) {
3218 cogl_path_arc(center_x, center_y, radius_x, radius_y, angle_1, angle_2);
3221 // VERSION: 2.0
3222 // Closes the path being constructed by adding a straight line segment
3223 // to it that ends at the first vertex of the path.
3224 static void close()() {
3225 cogl_path_close();
3228 // VERSION: 2.0
3229 // Adds a cubic bezier curve segment to the current path with the given
3230 // second, third and fourth control points and using current pen location
3231 // as the first control point.
3232 // <x_1>: X coordinate of the second bezier control point
3233 // <y_1>: Y coordinate of the second bezier control point
3234 // <x_2>: X coordinate of the third bezier control point
3235 // <y_2>: Y coordinate of the third bezier control point
3236 // <x_3>: X coordinate of the fourth bezier control point
3237 // <y_3>: Y coordinate of the fourth bezier control point
3238 static void curve_to()(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3) {
3239 cogl_path_curve_to(x_1, y_1, x_2, y_2, x_3, y_3);
3242 // VERSION: 2.0
3243 // Constructs an ellipse shape. If there is an existing path this will
3244 // start a new disjoint sub-path.
3245 // <center_x>: X coordinate of the ellipse center
3246 // <center_y>: Y coordinate of the ellipse center
3247 // <radius_x>: X radius of the ellipse
3248 // <radius_y>: Y radius of the ellipse
3249 static void ellipse()(float center_x, float center_y, float radius_x, float radius_y) {
3250 cogl_path_ellipse(center_x, center_y, radius_x, radius_y);
3253 // VERSION: 2.0
3254 // Fills the interior of the constructed shape using the current
3255 // drawing color.
3257 // The interior of the shape is determined using the fill rule of the
3258 // path. See %CoglPathFillRule for details.
3260 // <note>The result of referencing sliced textures in your current
3261 // pipeline when filling a path are undefined. You should pass
3262 // the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
3263 // use while filling a path.</note>
3264 static void fill()() {
3265 cogl_path_fill();
3268 // VERSION: 1.0
3269 // Fills the interior of the constructed shape using the current
3270 // drawing color and preserves the path to be used again. See
3271 // cogl_path_fill() for a description what is considered the interior
3272 // of the shape.
3273 static void fill_preserve()() {
3274 cogl_path_fill_preserve();
3277 // VERSION: 2.0
3278 // Retrieves the fill rule set using cogl_path_set_fill_rule().
3279 // RETURNS: the fill rule that is used for the current path.
3280 static PathFillRule get_fill_rule()() {
3281 return cogl_path_get_fill_rule();
3284 // VERSION: 2.0
3285 // Constructs a straight line shape starting and ending at the given
3286 // coordinates. If there is an existing path this will start a new
3287 // disjoint sub-path.
3288 // <x_1>: X coordinate of the start line vertex
3289 // <y_1>: Y coordinate of the start line vertex
3290 // <x_2>: X coordinate of the end line vertex
3291 // <y_2>: Y coordinate of the end line vertex
3292 static void line()(float x_1, float y_1, float x_2, float y_2) {
3293 cogl_path_line(x_1, y_1, x_2, y_2);
3296 // VERSION: 2.0
3297 // Adds a straight line segment to the current path that ends at the
3298 // given coordinates.
3299 // <x>: X coordinate of the end line vertex
3300 // <y>: Y coordinate of the end line vertex
3301 static void line_to()(float x, float y) {
3302 cogl_path_line_to(x, y);
3305 // VERSION: 2.0
3306 // Moves the pen to the given location. If there is an existing path
3307 // this will start a new disjoint subpath.
3308 // <x>: X coordinate of the pen location to move to.
3309 // <y>: Y coordinate of the pen location to move to.
3310 static void move_to()(float x, float y) {
3311 cogl_path_move_to(x, y);
3314 // VERSION: 2.0
3315 // Creates a new, empty path object. The default fill rule is
3316 // %COGL_PATH_FILL_RULE_EVEN_ODD.
3318 // be freed using cogl_object_unref().
3319 // RETURNS: A pointer to a newly allocated #CoglPath, which can
3320 static void new_()() {
3321 cogl_path_new();
3324 // VERSION: 2.0
3325 // Constructs a polygonal shape of the given number of vertices. If
3326 // there is an existing path this will start a new disjoint sub-path.
3328 // The coords array must contain 2 * num_points values. The first value
3329 // represents the X coordinate of the first vertex, the second value
3330 // represents the Y coordinate of the first vertex, continuing in the same
3331 // fashion for the rest of the vertices.
3332 // <coords>: A pointer to the first element of an array of fixed-point values that specify the vertex coordinates.
3333 // <num_points>: The total number of vertices.
3334 static void polygon()(float* coords, int num_points) {
3335 cogl_path_polygon(coords, num_points);
3338 // VERSION: 2.0
3339 // Constructs a series of straight line segments, starting from the
3340 // first given vertex coordinate. If there is an existing path this
3341 // will start a new disjoint sub-path. Each subsequent segment starts
3342 // where the previous one ended and ends at the next given vertex
3343 // coordinate.
3345 // The coords array must contain 2 * num_points values. The first value
3346 // represents the X coordinate of the first vertex, the second value
3347 // represents the Y coordinate of the first vertex, continuing in the same
3348 // fashion for the rest of the vertices. (num_points - 1) segments will
3349 // be constructed.
3350 // <coords>: A pointer to the first element of an array of fixed-point values that specify the vertex coordinates.
3351 // <num_points>: The total number of vertices.
3352 static void polyline()(float* coords, int num_points) {
3353 cogl_path_polyline(coords, num_points);
3356 // VERSION: 2.0
3357 // Constructs a rectangular shape at the given coordinates. If there
3358 // is an existing path this will start a new disjoint sub-path.
3359 // <x_1>: X coordinate of the top-left corner.
3360 // <y_1>: Y coordinate of the top-left corner.
3361 // <x_2>: X coordinate of the bottom-right corner.
3362 // <y_2>: Y coordinate of the bottom-right corner.
3363 static void rectangle()(float x_1, float y_1, float x_2, float y_2) {
3364 cogl_path_rectangle(x_1, y_1, x_2, y_2);
3367 // VERSION: 2.0
3368 // Adds a cubic bezier curve segment to the current path with the given
3369 // second, third and fourth control points and using current pen location
3370 // as the first control point. The given coordinates are relative to the
3371 // current pen location.
3372 // <x_1>: X coordinate of the second bezier control point
3373 // <y_1>: Y coordinate of the second bezier control point
3374 // <x_2>: X coordinate of the third bezier control point
3375 // <y_2>: Y coordinate of the third bezier control point
3376 // <x_3>: X coordinate of the fourth bezier control point
3377 // <y_3>: Y coordinate of the fourth bezier control point
3378 static void rel_curve_to()(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3) {
3379 cogl_path_rel_curve_to(x_1, y_1, x_2, y_2, x_3, y_3);
3382 // VERSION: 2.0
3383 // Adds a straight line segment to the current path that ends at the
3384 // given coordinates relative to the current pen location.
3385 // <x>: X offset from the current pen location of the end line vertex
3386 // <y>: Y offset from the current pen location of the end line vertex
3387 static void rel_line_to()(float x, float y) {
3388 cogl_path_rel_line_to(x, y);
3391 // VERSION: 2.0
3392 // Moves the pen to the given offset relative to the current pen
3393 // location. If there is an existing path this will start a new
3394 // disjoint subpath.
3395 // <x>: X offset from the current pen location to move the pen to.
3396 // <y>: Y offset from the current pen location to move the pen to.
3397 static void rel_move_to()(float x, float y) {
3398 cogl_path_rel_move_to(x, y);
3401 // VERSION: 2.0
3402 // Constructs a rectangular shape with rounded corners. If there is an
3403 // existing path this will start a new disjoint sub-path.
3404 // <x_1>: X coordinate of the top-left corner.
3405 // <y_1>: Y coordinate of the top-left corner.
3406 // <x_2>: X coordinate of the bottom-right corner.
3407 // <y_2>: Y coordinate of the bottom-right corner.
3408 // <radius>: Radius of the corner arcs.
3409 // <arc_step>: Angle increment resolution for subdivision of the corner arcs.
3410 static void round_rectangle()(float x_1, float y_1, float x_2, float y_2, float radius, float arc_step) {
3411 cogl_path_round_rectangle(x_1, y_1, x_2, y_2, radius, arc_step);
3414 // VERSION: 2.0
3415 // Sets the fill rule of the current path to @fill_rule. This will
3416 // affect how the path is filled when cogl_path_fill() is later
3417 // called. Note that the fill rule state is attached to the path so
3418 // calling cogl_get_path() will preserve the fill rule and calling
3419 // cogl_path_new() will reset the fill rule back to the default.
3420 // <fill_rule>: The new fill rule.
3421 static void set_fill_rule()(PathFillRule fill_rule) {
3422 cogl_path_set_fill_rule(fill_rule);
3425 // VERSION: 2.0
3426 // Strokes the constructed shape using the current drawing color and a
3427 // width of 1 pixel (regardless of the current transformation
3428 // matrix).
3429 static void stroke()() {
3430 cogl_path_stroke();
3433 // VERSION: 1.0
3434 // Strokes the constructed shape using the current drawing color and
3435 // preserves the path to be used again.
3436 static void stroke_preserve()() {
3437 cogl_path_stroke_preserve();
3442 // #CoglPathFillRule is used to determine how a path is filled. There
3443 // are two options - 'non-zero' and 'even-odd'. To work out whether any
3444 // point will be filled imagine drawing an infinetely long line in any
3445 // direction from that point. The number of times and the direction
3446 // that the edges of the path crosses this line determines whether the
3447 // line is filled as described below. Any open sub paths are treated
3448 // as if there was an extra line joining the first point and the last
3449 // point.
3451 // The default fill rule is %COGL_PATH_FILL_RULE_EVEN_ODD. The fill
3452 // rule is attached to the current path so preserving a path with
3453 // cogl_get_path() also preserves the fill rule. Calling
3454 // cogl_path_new() resets the current fill rule to the default.
3456 // <figure id="fill-rule-non-zero">
3457 // <title>Example of filling various paths using the non-zero rule</title>
3458 // <graphic fileref="fill-rule-non-zero.png" format="PNG"/>
3459 // </figure>
3461 // <figure id="fill-rule-even-odd">
3462 // <title>Example of filling various paths using the even-odd rule</title>
3463 // <graphic fileref="fill-rule-even-odd.png" format="PNG"/>
3464 // </figure>
3465 enum PathFillRule /* Version 1.4 */ {
3466 NON_ZERO = 0,
3467 EVEN_ODD = 1
3469 struct Pipeline {
3471 // VERSION: 1.10
3472 // Adds a shader snippet that will hook on to the given layer of the
3473 // pipeline. The exact part of the pipeline that the snippet wraps
3474 // around depends on the hook that is given to
3475 // cogl_snippet_new(). Note that some hooks can't be used with a layer
3476 // and need to be added with cogl_pipeline_add_snippet() instead.
3477 // <layer>: The layer to hook the snippet to
3478 // <snippet>: A #CoglSnippet
3479 void add_layer_snippet()(int layer, Snippet* snippet) {
3480 cogl_pipeline_add_layer_snippet(&this, layer, snippet);
3483 // VERSION: 1.10
3484 // Adds a shader snippet to @pipeline. The snippet will wrap around or
3485 // replace some part of the pipeline as defined by the hook point in
3486 // @snippet. Note that some hook points are specific to a layer and
3487 // must be added with cogl_pipeline_add_layer_snippet() instead.
3488 // <snippet>: The #CoglSnippet to add to the vertex processing hook
3489 void add_snippet()(Snippet* snippet) {
3490 cogl_pipeline_add_snippet(&this, snippet);
3493 // Unintrospectable method: copy() / cogl_pipeline_copy()
3494 // VERSION: 2.0
3495 // Creates a new pipeline with the configuration copied from the
3496 // source pipeline.
3498 // We would strongly advise developers to always aim to use
3499 // cogl_pipeline_copy() instead of cogl_pipeline_new() whenever there will
3500 // be any similarity between two pipelines. Copying a pipeline helps Cogl
3501 // keep track of a pipelines ancestry which we may use to help minimize GPU
3502 // state changes.
3503 // RETURNS: a pointer to the newly allocated #CoglPipeline
3504 Pipeline* copy()() {
3505 return cogl_pipeline_copy(&this);
3508 // Unintrospectable method: foreach_layer() / cogl_pipeline_foreach_layer()
3509 // VERSION: 2.0
3510 // Iterates all the layer indices of the given @pipeline.
3511 // <callback>: A #CoglPipelineLayerCallback to be called for each layer index
3512 // <user_data>: Private data that will be passed to the callback
3513 void foreach_layer()(PipelineLayerCallback callback, void* user_data) {
3514 cogl_pipeline_foreach_layer(&this, callback, user_data);
3517 // VERSION: 2.0
3519 // RETURNS: The alpha test function of @pipeline.
3520 PipelineAlphaFunc get_alpha_test_function()() {
3521 return cogl_pipeline_get_alpha_test_function(&this);
3524 // VERSION: 2.0
3526 // RETURNS: The alpha test reference value of @pipeline.
3527 float get_alpha_test_reference()() {
3528 return cogl_pipeline_get_alpha_test_reference(&this);
3531 // VERSION: 2.0
3532 // Retrieves the current ambient color for @pipeline
3533 // <ambient>: The location to store the ambient color
3534 void get_ambient()(Color* ambient) {
3535 cogl_pipeline_get_ambient(&this, ambient);
3538 // VERSION: 2.0
3539 // Retrieves the current pipeline color.
3540 // <color>: The location to store the color
3541 void get_color()(/*out*/ Color* color) {
3542 cogl_pipeline_get_color(&this, color);
3545 // VERSION: 1.8
3546 // Gets the current #CoglColorMask of which channels would be written to the
3547 // current framebuffer. Each bit set in the mask means that the
3548 // corresponding color would be written.
3549 // RETURNS: A #CoglColorMask
3550 ColorMask get_color_mask()() {
3551 return cogl_pipeline_get_color_mask(&this);
3554 // VERSION: 2.0
3555 // cogl_pipeline_set_cull_face_mode().
3557 // Status: Unstable
3558 // RETURNS: the cull face mode that was previously set with
3559 PipelineCullFaceMode get_cull_face_mode()() {
3560 return cogl_pipeline_get_cull_face_mode(&this);
3563 // VERSION: 2.0
3564 // Retrieves the current depth state configuration for the given
3565 // @pipeline as previously set using cogl_pipeline_set_depth_state().
3566 void get_depth_state()(DepthState* state_out) {
3567 cogl_pipeline_get_depth_state(&this, state_out);
3570 // VERSION: 2.0
3571 // Retrieves the current diffuse color for @pipeline
3572 // <diffuse>: The location to store the diffuse color
3573 void get_diffuse()(Color* diffuse) {
3574 cogl_pipeline_get_diffuse(&this, diffuse);
3577 // VERSION: 2.0
3578 // Retrieves the pipelines current emission color.
3579 // <emission>: The location to store the emission color
3580 void get_emission()(Color* emission) {
3581 cogl_pipeline_get_emission(&this, emission);
3583 Winding get_front_face_winding()() {
3584 return cogl_pipeline_get_front_face_winding(&this);
3587 // VERSION: 2.0
3588 // Gets whether point sprite coordinate generation is enabled for this
3589 // texture layer.
3591 // point sprite coordinates.
3592 // RETURNS: whether the texture coordinates will be replaced with
3593 // <layer_index>: the layer number to check.
3594 int get_layer_point_sprite_coords_enabled()(int layer_index) {
3595 return cogl_pipeline_get_layer_point_sprite_coords_enabled(&this, layer_index);
3598 // VERSION: 1.6
3599 // Returns the wrap mode for the 'p' coordinate of texture lookups on this
3600 // layer.
3602 // this layer.
3603 // RETURNS: the wrap mode for the 'p' coordinate of texture lookups on
3604 // <layer_index>: the layer number to change.
3605 PipelineWrapMode get_layer_wrap_mode_p()(int layer_index) {
3606 return cogl_pipeline_get_layer_wrap_mode_p(&this, layer_index);
3609 // VERSION: 1.6
3610 // Returns the wrap mode for the 's' coordinate of texture lookups on this
3611 // layer.
3613 // this layer.
3614 // RETURNS: the wrap mode for the 's' coordinate of texture lookups on
3615 // <layer_index>: the layer number to change.
3616 PipelineWrapMode get_layer_wrap_mode_s()(int layer_index) {
3617 return cogl_pipeline_get_layer_wrap_mode_s(&this, layer_index);
3620 // VERSION: 1.6
3621 // Returns the wrap mode for the 't' coordinate of texture lookups on this
3622 // layer.
3624 // this layer.
3625 // RETURNS: the wrap mode for the 't' coordinate of texture lookups on
3626 // <layer_index>: the layer number to change.
3627 PipelineWrapMode get_layer_wrap_mode_t()(int layer_index) {
3628 return cogl_pipeline_get_layer_wrap_mode_t(&this, layer_index);
3631 // VERSION: 2.0
3632 // Retrieves the number of layers defined for the given @pipeline
3633 // RETURNS: the number of layers
3634 int get_n_layers()() {
3635 return cogl_pipeline_get_n_layers(&this);
3638 // VERSION: 2.0
3639 // Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is
3640 // used with the vertex buffer API.
3641 // RETURNS: the point size of the @pipeline.
3642 float get_point_size()() {
3643 return cogl_pipeline_get_point_size(&this);
3646 // VERSION: 2.0
3647 // Retrieves the pipelines current emission color.
3648 // RETURNS: The pipelines current shininess value
3649 float get_shininess()() {
3650 return cogl_pipeline_get_shininess(&this);
3653 // VERSION: 2.0
3654 // Retrieves the pipelines current specular color.
3655 // <specular>: The location to store the specular color
3656 void get_specular()(Color* specular) {
3657 cogl_pipeline_get_specular(&this, specular);
3660 // VERSION: 2.0
3661 // This is used to get an integer representing the uniform with the
3662 // name @uniform_name. The integer can be passed to functions such as
3663 // cogl_pipeline_set_uniform_1f() to set the value of a uniform.
3665 // This function will always return a valid integer. Ie, unlike
3666 // OpenGL, it does not return -1 if the uniform is not available in
3667 // this pipeline so it can not be used to test whether uniforms are
3668 // present. It is not necessary to set the program on the pipeline
3669 // before calling this function.
3670 // RETURNS: A integer representing the location of the given uniform.
3671 // <uniform_name>: The name of a uniform
3672 int get_uniform_location()(char* uniform_name) {
3673 return cogl_pipeline_get_uniform_location(&this, uniform_name);
3676 // Unintrospectable method: get_user_program() / cogl_pipeline_get_user_program()
3677 // VERSION: 2.0
3678 // Queries what user program has been associated with the given
3679 // @pipeline using cogl_pipeline_set_user_program().
3680 // RETURNS: The current user program or %COGL_INVALID_HANDLE.
3681 Handle get_user_program()() {
3682 return cogl_pipeline_get_user_program(&this);
3685 // VERSION: 1.10
3686 // This function removes a layer from your pipeline
3687 // <layer_index>: Specifies the layer you want to remove
3688 void remove_layer()(int layer_index) {
3689 cogl_pipeline_remove_layer(&this, layer_index);
3692 // VERSION: 2.0
3693 // Before a primitive is blended with the framebuffer, it goes through an
3694 // alpha test stage which lets you discard fragments based on the current
3695 // alpha value. This function lets you change the function used to evaluate
3696 // the alpha channel, and thus determine which fragments are discarded
3697 // and which continue on to the blending stage.
3699 // The default is %COGL_PIPELINE_ALPHA_FUNC_ALWAYS
3700 // <alpha_func>: A @CoglPipelineAlphaFunc constant
3701 // <alpha_reference>: A reference point that the chosen alpha function uses to compare incoming fragments to.
3702 void set_alpha_test_function()(PipelineAlphaFunc alpha_func, float alpha_reference) {
3703 cogl_pipeline_set_alpha_test_function(&this, alpha_func, alpha_reference);
3706 // VERSION: 2.0
3707 // Sets the pipeline's ambient color, in the standard OpenGL lighting
3708 // model. The ambient color affects the overall color of the object.
3710 // Since the diffuse color will be intense when the light hits the surface
3711 // directly, the ambient will be most apparent where the light hits at a
3712 // slant.
3714 // The default value is (0.2, 0.2, 0.2, 1.0)
3715 // <ambient>: The components of the desired ambient color
3716 void set_ambient()(Color* ambient) {
3717 cogl_pipeline_set_ambient(&this, ambient);
3720 // VERSION: 2.0
3721 // Conveniently sets the diffuse and ambient color of @pipeline at the same
3722 // time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse().
3724 // The default ambient color is (0.2, 0.2, 0.2, 1.0)
3726 // The default diffuse color is (0.8, 0.8, 0.8, 1.0)
3727 // <color>: The components of the desired ambient and diffuse colors
3728 void set_ambient_and_diffuse()(Color* color) {
3729 cogl_pipeline_set_ambient_and_diffuse(&this, color);
3732 // VERSION: 2.0
3733 // If not already familiar; please refer <link linkend="cogl-Blend-Strings">here</link>
3734 // for an overview of what blend strings are, and their syntax.
3736 // Blending occurs after the alpha test function, and combines fragments with
3737 // the framebuffer.
3738 // Currently the only blend function Cogl exposes is ADD(). So any valid
3739 // blend statements will be of the form:
3741 // |[
3742 // &lt;channel-mask&gt;=ADD(SRC_COLOR*(&lt;factor&gt;), DST_COLOR*(&lt;factor&gt;))
3743 // ]|
3745 // This is the list of source-names usable as blend factors:
3746 // <itemizedlist>
3747 // <listitem><para>SRC_COLOR: The color of the in comming fragment</para></listitem>
3748 // <listitem><para>DST_COLOR: The color of the framebuffer</para></listitem>
3749 // <listitem><para>CONSTANT: The constant set via cogl_pipeline_set_blend_constant()</para></listitem>
3750 // </itemizedlist>
3752 // The source names can be used according to the
3753 // <link linkend="cogl-Blend-String-syntax">color-source and factor syntax</link>,
3754 // so for example "(1-SRC_COLOR[A])" would be a valid factor, as would
3755 // "(CONSTANT[RGB])"
3757 // These can also be used as factors:
3758 // <itemizedlist>
3759 // <listitem>0: (0, 0, 0, 0)</listitem>
3760 // <listitem>1: (1, 1, 1, 1)</listitem>
3761 // <listitem>SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])</listitem>
3762 // </itemizedlist>
3764 // <note>Remember; all color components are normalized to the range [0, 1]
3765 // before computing the result of blending.</note>
3767 // <example id="cogl-Blend-Strings-blend-unpremul">
3768 // <title>Blend Strings/1</title>
3769 // <para>Blend a non-premultiplied source over a destination with
3770 // premultiplied alpha:</para>
3771 // <programlisting>
3772 // "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
3773 // "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
3774 // </programlisting>
3775 // </example>
3777 // <example id="cogl-Blend-Strings-blend-premul">
3778 // <title>Blend Strings/2</title>
3779 // <para>Blend a premultiplied source over a destination with
3780 // premultiplied alpha</para>
3781 // <programlisting>
3782 // "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
3783 // </programlisting>
3784 // </example>
3786 // The default blend string is:
3787 // |[
3788 // RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
3789 // ]|
3791 // That gives normal alpha-blending when the calculated color for the pipeline
3792 // is in premultiplied form.
3794 // described blending is supported by the underlying driver/hardware. If
3795 // there was an error, %FALSE is returned and @error is set accordingly (if
3796 // present).
3797 // RETURNS: %TRUE if the blend string was successfully parsed, and the
3798 // <blend_string>: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired blend function.
3799 int set_blend()(char* blend_string, GLib2.Error** error=null) {
3800 return cogl_pipeline_set_blend(&this, blend_string, error);
3803 // VERSION: 2.0
3804 // When blending is setup to reference a CONSTANT blend factor then
3805 // blending will depend on the constant set with this function.
3806 // <constant_color>: The constant color you want
3807 void set_blend_constant()(Color* constant_color) {
3808 cogl_pipeline_set_blend_constant(&this, constant_color);
3811 // VERSION: 2.0
3812 // Sets the basic color of the pipeline, used when no lighting is enabled.
3814 // Note that if you don't add any layers to the pipeline then the color
3815 // will be blended unmodified with the destination; the default blend
3816 // expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for
3817 // semi-transparent red. See cogl_color_premultiply().
3819 // The default value is (1.0, 1.0, 1.0, 1.0)
3820 // <color>: The components of the color
3821 void set_color()(Color* color) {
3822 cogl_pipeline_set_color(&this, color);
3825 // VERSION: 2.0
3826 // Sets the basic color of the pipeline, used when no lighting is enabled.
3828 // The default value is (1.0, 1.0, 1.0, 1.0)
3829 // <red>: The red component
3830 // <green>: The green component
3831 // <blue>: The blue component
3832 // <alpha>: The alpha component
3833 void set_color4f()(float red, float green, float blue, float alpha) {
3834 cogl_pipeline_set_color4f(&this, red, green, blue, alpha);
3837 // VERSION: 2.0
3838 // Sets the basic color of the pipeline, used when no lighting is enabled.
3840 // The default value is (0xff, 0xff, 0xff, 0xff)
3841 // <red>: The red component
3842 // <green>: The green component
3843 // <blue>: The blue component
3844 // <alpha>: The alpha component
3845 void set_color4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) {
3846 cogl_pipeline_set_color4ub(&this, red, green, blue, alpha);
3849 // VERSION: 1.8
3850 // Defines a bit mask of which color channels should be written to the
3851 // current framebuffer. If a bit is set in @color_mask that means that
3852 // color will be written.
3853 // <color_mask>: A #CoglColorMask of which color channels to write to the current framebuffer.
3854 void set_color_mask()(ColorMask color_mask) {
3855 cogl_pipeline_set_color_mask(&this, color_mask);
3858 // VERSION: 2.0
3859 // Sets which faces will be culled when drawing. Face culling can be
3860 // used to increase efficiency by avoiding drawing faces that would
3861 // get overridden. For example, if a model has gaps so that it is
3862 // impossible to see the inside then faces which are facing away from
3863 // the screen will never be seen so there is no point in drawing
3864 // them. This can be acheived by setting the cull face mode to
3865 // %COGL_PIPELINE_CULL_FACE_MODE_BACK.
3867 // Face culling relies on the primitives being drawn with a specific
3868 // order to represent which faces are facing inside and outside the
3869 // model. This order can be specified by calling
3870 // cogl_pipeline_set_front_face_winding().
3872 // Status: Unstable
3873 // <cull_face_mode>: The new mode to set
3874 void set_cull_face_mode()(PipelineCullFaceMode cull_face_mode) {
3875 cogl_pipeline_set_cull_face_mode(&this, cull_face_mode);
3878 // VERSION: 2.0
3879 // This commits all the depth state configured in @state struct to the
3880 // given @pipeline. The configuration values are copied into the
3881 // pipeline so there is no requirement to keep the #CoglDepthState
3882 // struct around if you don't need it any more.
3884 // Note: Since some platforms do not support the depth range feature
3885 // it is possible for this function to fail and report an @error.
3887 // and returns an @error.
3888 // RETURNS: TRUE if the GPU supports all the given @state else %FALSE
3889 // <state>: A #CoglDepthState struct
3890 int set_depth_state()(DepthState* state, GLib2.Error** error=null) {
3891 return cogl_pipeline_set_depth_state(&this, state, error);
3894 // VERSION: 2.0
3895 // Sets the pipeline's diffuse color, in the standard OpenGL lighting
3896 // model. The diffuse color is most intense where the light hits the
3897 // surface directly - perpendicular to the surface.
3899 // The default value is (0.8, 0.8, 0.8, 1.0)
3900 // <diffuse>: The components of the desired diffuse color
3901 void set_diffuse()(Color* diffuse) {
3902 cogl_pipeline_set_diffuse(&this, diffuse);
3905 // VERSION: 2.0
3906 // Sets the pipeline's emissive color, in the standard OpenGL lighting
3907 // model. It will look like the surface is a light source emitting this
3908 // color.
3910 // The default value is (0.0, 0.0, 0.0, 1.0)
3911 // <emission>: The components of the desired emissive color
3912 void set_emission()(Color* emission) {
3913 cogl_pipeline_set_emission(&this, emission);
3916 // VERSION: 2.0
3917 // The order of the vertices within a primitive specifies whether it
3918 // is considered to be front or back facing. This function specifies
3919 // which order is considered to be the front
3920 // faces. %COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to
3921 // primitives with vertices in a counter-clockwise order and
3922 // %COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is
3923 // %COGL_WINDING_COUNTER_CLOCKWISE.
3925 // Status: Unstable
3926 void set_front_face_winding()(Winding front_winding) {
3927 cogl_pipeline_set_front_face_winding(&this, front_winding);
3930 // VERSION: 2.0
3931 // If not already familiar; you can refer
3932 // <link linkend="cogl-Blend-Strings">here</link> for an overview of what blend
3933 // strings are and there syntax.
3935 // These are all the functions available for texture combining:
3936 // <itemizedlist>
3937 // <listitem>REPLACE(arg0) = arg0</listitem>
3938 // <listitem>MODULATE(arg0, arg1) = arg0 x arg1</listitem>
3939 // <listitem>ADD(arg0, arg1) = arg0 + arg1</listitem>
3940 // <listitem>ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5</listitem>
3941 // <listitem>INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)</listitem>
3942 // <listitem>SUBTRACT(arg0, arg1) = arg0 - arg1</listitem>
3943 // <listitem>
3944 // <programlisting>
3945 // DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
3946 // (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
3947 // (arg0[B] - 0.5)) * (arg1[B] - 0.5))
3948 // </programlisting>
3949 // </listitem>
3950 // <listitem>
3951 // <programlisting>
3952 // DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
3953 // (arg0[G] - 0.5)) * (arg1[G] - 0.5) +
3954 // (arg0[B] - 0.5)) * (arg1[B] - 0.5))
3955 // </programlisting>
3956 // </listitem>
3957 // </itemizedlist>
3959 // Refer to the
3960 // <link linkend="cogl-Blend-String-syntax">color-source syntax</link> for
3961 // describing the arguments. The valid source names for texture combining
3962 // are:
3963 // <variablelist>
3964 // <varlistentry>
3965 // <term>TEXTURE</term>
3966 // <listitem>Use the color from the current texture layer</listitem>
3967 // </varlistentry>
3968 // <varlistentry>
3969 // <term>TEXTURE_0, TEXTURE_1, etc</term>
3970 // <listitem>Use the color from the specified texture layer</listitem>
3971 // </varlistentry>
3972 // <varlistentry>
3973 // <term>CONSTANT</term>
3974 // <listitem>Use the color from the constant given with
3975 // cogl_pipeline_set_layer_constant()</listitem>
3976 // </varlistentry>
3977 // <varlistentry>
3978 // <term>PRIMARY</term>
3979 // <listitem>Use the color of the pipeline as set with
3980 // cogl_pipeline_set_color()</listitem>
3981 // </varlistentry>
3982 // <varlistentry>
3983 // <term>PREVIOUS</term>
3984 // <listitem>Either use the texture color from the previous layer, or
3985 // if this is layer 0, use the color of the pipeline as set with
3986 // cogl_pipeline_set_color()</listitem>
3987 // </varlistentry>
3988 // </variablelist>
3990 // <refsect2 id="cogl-Layer-Combine-Examples">
3991 // <title>Layer Combine Examples</title>
3992 // <para>This is effectively what the default blending is:</para>
3993 // <informalexample><programlisting>
3994 // RGBA = MODULATE (PREVIOUS, TEXTURE)
3995 // </programlisting></informalexample>
3996 // <para>This could be used to cross-fade between two images, using
3997 // the alpha component of a constant as the interpolator. The constant
3998 // color is given by calling cogl_pipeline_set_layer_constant.</para>
3999 // <informalexample><programlisting>
4000 // RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
4001 // </programlisting></informalexample>
4002 // </refsect2>
4004 // <note>You can't give a multiplication factor for arguments as you can
4005 // with blending.</note>
4007 // described texture combining is supported by the underlying driver and
4008 // or hardware. On failure, %FALSE is returned and @error is set
4009 // RETURNS: %TRUE if the blend string was successfully parsed, and the
4010 // <layer_index>: Specifies the layer you want define a combine function for
4011 // <blend_string>: A <link linkend="cogl-Blend-Strings">Cogl blend string</link> describing the desired texture combine function.
4012 int set_layer_combine()(int layer_index, char* blend_string, GLib2.Error** error=null) {
4013 return cogl_pipeline_set_layer_combine(&this, layer_index, blend_string, error);
4016 // VERSION: 2.0
4017 // When you are using the 'CONSTANT' color source in a layer combine
4018 // description then you can use this function to define its value.
4019 // <layer_index>: Specifies the layer you want to specify a constant used for texture combining
4020 // <constant>: The constant color you want
4021 void set_layer_combine_constant()(int layer_index, Color* constant) {
4022 cogl_pipeline_set_layer_combine_constant(&this, layer_index, constant);
4025 // VERSION: 1.10
4026 // Changes the decimation and interpolation filters used when a texture is
4027 // drawn at other scales than 100%.
4028 // <layer_index>: the layer number to change.
4029 // <min_filter>: the filter used when scaling a texture down.
4030 // <mag_filter>: the filter used when magnifying a texture.
4031 void set_layer_filters()(int layer_index, PipelineFilter min_filter, PipelineFilter mag_filter) {
4032 cogl_pipeline_set_layer_filters(&this, layer_index, min_filter, mag_filter);
4035 // VERSION: 1.10
4036 // This function lets you set a matrix that can be used to e.g. translate
4037 // and rotate a single layer of a pipeline used to fill your geometry.
4038 // <layer_index>: the index for the layer inside @pipeline
4039 // <matrix>: the transformation matrix for the layer
4040 void set_layer_matrix()(int layer_index, Matrix* matrix) {
4041 cogl_pipeline_set_layer_matrix(&this, layer_index, matrix);
4044 // VERSION: 2.0
4045 // When rendering points, if @enable is %TRUE then the texture
4046 // coordinates for this layer will be replaced with coordinates that
4047 // vary from 0.0 to 1.0 across the primitive. The top left of the
4048 // point will have the coordinates 0.0,0.0 and the bottom right will
4049 // have 1.0,1.0. If @enable is %FALSE then the coordinates will be
4050 // fixed for the entire point.
4052 // This function will only work if %COGL_FEATURE_POINT_SPRITE is
4053 // available. If the feature is not available then the function will
4054 // return %FALSE and set @error.
4055 // RETURNS: %TRUE if the function succeeds, %FALSE otherwise.
4056 // <layer_index>: the layer number to change.
4057 // <enable>: whether to enable point sprite coord generation.
4058 int set_layer_point_sprite_coords_enabled()(int layer_index, int enable, GLib2.Error** error=null) {
4059 return cogl_pipeline_set_layer_point_sprite_coords_enabled(&this, layer_index, enable, error);
4061 void set_layer_texture()(int layer_index, Texture* texture) {
4062 cogl_pipeline_set_layer_texture(&this, layer_index, texture);
4065 // VERSION: 2.0
4066 // Sets the wrap mode for all three coordinates of texture lookups on
4067 // this layer. This is equivalent to calling
4068 // cogl_pipeline_set_layer_wrap_mode_s(),
4069 // cogl_pipeline_set_layer_wrap_mode_t() and
4070 // cogl_pipeline_set_layer_wrap_mode_p() separately.
4071 // <layer_index>: the layer number to change.
4072 // <mode>: the new wrap mode
4073 void set_layer_wrap_mode()(int layer_index, PipelineWrapMode mode) {
4074 cogl_pipeline_set_layer_wrap_mode(&this, layer_index, mode);
4077 // VERSION: 2.0
4078 // Sets the wrap mode for the 'p' coordinate of texture lookups on
4079 // this layer. 'p' is the third coordinate.
4080 // <layer_index>: the layer number to change.
4081 // <mode>: the new wrap mode
4082 void set_layer_wrap_mode_p()(int layer_index, PipelineWrapMode mode) {
4083 cogl_pipeline_set_layer_wrap_mode_p(&this, layer_index, mode);
4086 // VERSION: 2.0
4087 // Sets the wrap mode for the 's' coordinate of texture lookups on this layer.
4088 // <layer_index>: the layer number to change.
4089 // <mode>: the new wrap mode
4090 void set_layer_wrap_mode_s()(int layer_index, PipelineWrapMode mode) {
4091 cogl_pipeline_set_layer_wrap_mode_s(&this, layer_index, mode);
4094 // VERSION: 2.0
4095 // Sets the wrap mode for the 't' coordinate of texture lookups on this layer.
4096 // <layer_index>: the layer number to change.
4097 // <mode>: the new wrap mode
4098 void set_layer_wrap_mode_t()(int layer_index, PipelineWrapMode mode) {
4099 cogl_pipeline_set_layer_wrap_mode_t(&this, layer_index, mode);
4102 // VERSION: 2.0
4103 // Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is
4104 // used with the vertex buffer API. Note that typically the GPU will
4105 // only support a limited minimum and maximum range of point sizes. If
4106 // the chosen point size is outside that range then the nearest value
4107 // within that range will be used instead. The size of a point is in
4108 // screen space so it will be the same regardless of any
4109 // transformations. The default point size is 1.0.
4110 // <point_size>: the new point size.
4111 void set_point_size()(float point_size) {
4112 cogl_pipeline_set_point_size(&this, point_size);
4115 // VERSION: 2.0
4116 // Sets the shininess of the pipeline, in the standard OpenGL lighting
4117 // model, which determines the size of the specular highlights. A
4118 // higher @shininess will produce smaller highlights which makes the
4119 // object appear more shiny.
4121 // The default value is 0.0
4122 // <shininess>: The desired shininess; must be >= 0.0
4123 void set_shininess()(float shininess) {
4124 cogl_pipeline_set_shininess(&this, shininess);
4127 // VERSION: 2.0
4128 // Sets the pipeline's specular color, in the standard OpenGL lighting
4129 // model. The intensity of the specular color depends on the viewport
4130 // position, and is brightest along the lines of reflection.
4132 // The default value is (0.0, 0.0, 0.0, 1.0)
4133 // <specular>: The components of the desired specular color
4134 void set_specular()(Color* specular) {
4135 cogl_pipeline_set_specular(&this, specular);
4138 // VERSION: 2.0
4139 // Sets a new value for the uniform at @uniform_location. If this
4140 // pipeline has a user program attached and is later used as a source
4141 // for drawing, the given value will be assigned to the uniform which
4142 // can be accessed from the shader's source. The value for
4143 // @uniform_location should be retrieved from the string name of the
4144 // uniform by calling cogl_pipeline_get_uniform_location().
4146 // This function should be used to set uniforms that are of type
4147 // float. It can also be used to set a single member of a float array
4148 // uniform.
4149 // <uniform_location>: The uniform's location identifier
4150 // <value>: The new value for the uniform
4151 void set_uniform_1f()(int uniform_location, float value) {
4152 cogl_pipeline_set_uniform_1f(&this, uniform_location, value);
4155 // VERSION: 2.0
4156 // Sets a new value for the uniform at @uniform_location. If this
4157 // pipeline has a user program attached and is later used as a source
4158 // for drawing, the given value will be assigned to the uniform which
4159 // can be accessed from the shader's source. The value for
4160 // @uniform_location should be retrieved from the string name of the
4161 // uniform by calling cogl_pipeline_get_uniform_location().
4163 // This function should be used to set uniforms that are of type
4164 // int. It can also be used to set a single member of a int array
4165 // uniform or a sampler uniform.
4166 // <uniform_location>: The uniform's location identifier
4167 // <value>: The new value for the uniform
4168 void set_uniform_1i()(int uniform_location, int value) {
4169 cogl_pipeline_set_uniform_1i(&this, uniform_location, value);
4172 // VERSION: 2.0
4173 // Sets new values for the uniform at @uniform_location. If this
4174 // pipeline has a user program attached and is later used as a source
4175 // for drawing, the given values will be assigned to the uniform which
4176 // can be accessed from the shader's source. The value for
4177 // @uniform_location should be retrieved from the string name of the
4178 // uniform by calling cogl_pipeline_get_uniform_location().
4180 // This function can be used to set any floating point type uniform,
4181 // including float arrays and float vectors. For example, to set a
4182 // single vec4 uniform you would use 4 for @n_components and 1 for
4183 // @count. To set an array of 8 float values, you could use 1 for
4184 // @n_components and 8 for @count.
4185 // <uniform_location>: The uniform's location identifier
4186 // <n_components>: The number of components in the corresponding uniform's type
4187 // <count>: The number of values to set
4188 // <value>: Pointer to the new values to set
4189 void set_uniform_float()(int uniform_location, int n_components, int count, float* value) {
4190 cogl_pipeline_set_uniform_float(&this, uniform_location, n_components, count, value);
4193 // VERSION: 2.0
4194 // Sets new values for the uniform at @uniform_location. If this
4195 // pipeline has a user program attached and is later used as a source
4196 // for drawing, the given values will be assigned to the uniform which
4197 // can be accessed from the shader's source. The value for
4198 // @uniform_location should be retrieved from the string name of the
4199 // uniform by calling cogl_pipeline_get_uniform_location().
4201 // This function can be used to set any integer type uniform,
4202 // including int arrays and int vectors. For example, to set a single
4203 // ivec4 uniform you would use 4 for @n_components and 1 for
4204 // @count. To set an array of 8 int values, you could use 1 for
4205 // @n_components and 8 for @count.
4206 // <uniform_location>: The uniform's location identifier
4207 // <n_components>: The number of components in the corresponding uniform's type
4208 // <count>: The number of values to set
4209 // <value>: Pointer to the new values to set
4210 void set_uniform_int()(int uniform_location, int n_components, int count, int* value) {
4211 cogl_pipeline_set_uniform_int(&this, uniform_location, n_components, count, value);
4214 // VERSION: 2.0
4215 // Sets new values for the uniform at @uniform_location. If this
4216 // pipeline has a user program attached and is later used as a source
4217 // for drawing, the given values will be assigned to the uniform which
4218 // can be accessed from the shader's source. The value for
4219 // @uniform_location should be retrieved from the string name of the
4220 // uniform by calling cogl_pipeline_get_uniform_location().
4222 // This function can be used to set any matrix type uniform, including
4223 // matrix arrays. For example, to set a single mat4 uniform you would
4224 // use 4 for @dimensions and 1 for @count. To set an array of 8
4225 // mat3 values, you could use 3 for @dimensions and 8 for @count.
4227 // If @transpose is %FALSE then the matrix is expected to be in
4228 // column-major order or if it is %TRUE then the matrix is in
4229 // row-major order. You can pass a #CoglMatrix by calling by passing
4230 // the result of cogl_matrix_get_array() in @value and setting
4231 // @transpose to %FALSE.
4232 // <uniform_location>: The uniform's location identifier
4233 // <dimensions>: The size of the matrix
4234 // <count>: The number of values to set
4235 // <transpose>: Whether to transpose the matrix
4236 // <value>: Pointer to the new values to set
4237 void set_uniform_matrix()(int uniform_location, int dimensions, int count, int transpose, float* value) {
4238 cogl_pipeline_set_uniform_matrix(&this, uniform_location, dimensions, count, transpose, value);
4241 // VERSION: 2.0
4242 // Associates a linked CoglProgram with the given pipeline so that the
4243 // program can take full control of vertex and/or fragment processing.
4245 // This is an example of how it can be used to associate an ARBfp
4246 // program with a #CoglPipeline:
4247 // |[
4248 // CoglHandle shader;
4249 // CoglHandle program;
4250 // CoglPipeline *pipeline;
4252 // shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
4253 // cogl_shader_source (shader,
4254 // "!!ARBfp1.0\n"
4255 // "MOV result.color,fragment.color;\n"
4256 // "END\n");
4257 // cogl_shader_compile (shader);
4259 // program = cogl_create_program ();
4260 // cogl_program_attach_shader (program, shader);
4261 // cogl_program_link (program);
4263 // pipeline = cogl_pipeline_new ();
4264 // cogl_pipeline_set_user_program (pipeline, program);
4266 // cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
4267 // cogl_rectangle (0, 0, 100, 100);
4268 // ]|
4270 // It is possibly worth keeping in mind that this API is not part of
4271 // the long term design for how we want to expose shaders to Cogl
4272 // developers (We are planning on deprecating the cogl_program and
4273 // cogl_shader APIs in favour of a "snippet" framework) but in the
4274 // meantime we hope this will handle most practical GLSL and ARBfp
4275 // requirements.
4277 // Also remember you need to check for either the
4278 // %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
4279 // using the cogl_program or cogl_shader API.
4280 // <program>: A #CoglHandle to a linked CoglProgram
4281 void set_user_program()(Handle program) {
4282 cogl_pipeline_set_user_program(&this, program);
4285 // Unintrospectable function: new() / cogl_pipeline_new()
4286 // VERSION: 2.0
4287 // Allocates and initializes a default simple pipeline that will color
4288 // a primitive white.
4289 // RETURNS: a pointer to a new #CoglPipeline
4290 static Pipeline* new_()() {
4291 return cogl_pipeline_new();
4296 // Alpha testing happens before blending primitives with the framebuffer and
4297 // gives an opportunity to discard fragments based on a comparison with the
4298 // incoming alpha value and a reference alpha value. The #CoglPipelineAlphaFunc
4299 // determines how the comparison is done.
4300 enum PipelineAlphaFunc {
4301 NEVER = 512,
4302 LESS = 513,
4303 EQUAL = 514,
4304 LEQUAL = 515,
4305 GREATER = 516,
4306 NOTEQUAL = 517,
4307 GEQUAL = 518,
4308 ALWAYS = 519
4311 // Specifies which faces should be culled. This can be set on a
4312 // pipeline using cogl_pipeline_set_cull_face_mode().
4313 enum PipelineCullFaceMode {
4314 NONE = 0,
4315 FRONT = 1,
4316 BACK = 2,
4317 BOTH = 3
4320 // Texture filtering is used whenever the current pixel maps either to more
4321 // than one texture element (texel) or less than one. These filter enums
4322 // correspond to different strategies used to come up with a pixel color, by
4323 // possibly referring to multiple neighbouring texels and taking a weighted
4324 // average or simply using the nearest texel.
4325 enum PipelineFilter {
4326 NEAREST = 9728,
4327 LINEAR = 9729,
4328 NEAREST_MIPMAP_NEAREST = 9984,
4329 LINEAR_MIPMAP_NEAREST = 9985,
4330 NEAREST_MIPMAP_LINEAR = 9986,
4331 LINEAR_MIPMAP_LINEAR = 9987
4334 // VERSION: 2.0
4335 // The callback prototype used with cogl_pipeline_foreach_layer() for
4336 // iterating all the layers of a @pipeline.
4337 // <pipeline>: The #CoglPipeline whos layers are being iterated
4338 // <layer_index>: The current layer index
4339 // <user_data>: The private data passed to cogl_pipeline_foreach_layer()
4340 extern (C) alias int function (Pipeline* pipeline, int layer_index, void* user_data) PipelineLayerCallback;
4343 // The wrap mode specifies what happens when texture coordinates
4344 // outside the range 0→1 are used. Note that if the filter mode is
4345 // anything but %COGL_PIPELINE_FILTER_NEAREST then texels outside the
4346 // range 0→1 might be used even when the coordinate is exactly 0 or 1
4347 // because OpenGL will try to sample neighbouring pixels. For example
4348 // if you are trying to render the full texture then you may get
4349 // artifacts around the edges when the pixels from the other side are
4350 // merged in if the wrap mode is set to repeat.
4351 enum PipelineWrapMode /* Version 2.0 */ {
4352 REPEAT = 10497,
4353 MIRRORED_REPEAT = 33648,
4354 CLAMP_TO_EDGE = 33071,
4355 AUTOMATIC = 519
4357 struct PixelBuffer {
4358 // Unintrospectable function: new_with_size_EXP() / cogl_pixel_buffer_new_with_size_EXP()
4359 static PixelBuffer* new_with_size_EXP()(uint width, uint height, PixelFormat format, uint* stride) {
4360 return cogl_pixel_buffer_new_with_size_EXP(width, height, format, stride);
4365 // Pixel formats used by COGL. For the formats with a byte per
4366 // component, the order of the components specify the order in
4367 // increasing memory addresses. So for example
4368 // %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
4369 // lowest address, green in the next address and blue after that
4370 // regardless of the endinanness of the system.
4372 // For the 16-bit formats the component order specifies the order
4373 // within a 16-bit number from most significant bit to least
4374 // significant. So for %COGL_PIXEL_FORMAT_RGB_565, the red component
4375 // would be in bits 11-15, the green component would be in 6-11 and
4376 // the blue component would be in 1-5. Therefore the order in memory
4377 // depends on the endianness of the system.
4379 // When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
4380 // internal format. Cogl will try to pick the best format to use
4381 // internally and convert the texture data if necessary.
4382 enum PixelFormat /* Version 0.8 */ {
4383 ANY = 0,
4384 A_8 = 17,
4385 RGB_565 = 4,
4386 RGBA_4444 = 21,
4387 RGBA_5551 = 22,
4388 YUV = 7,
4389 G_8 = 8,
4390 RGB_888 = 2,
4391 BGR_888 = 34,
4392 RGBA_8888 = 19,
4393 BGRA_8888 = 51,
4394 ARGB_8888 = 83,
4395 ABGR_8888 = 115,
4396 RGBA_8888_PRE = 147,
4397 BGRA_8888_PRE = 179,
4398 ARGB_8888_PRE = 211,
4399 ABGR_8888_PRE = 243,
4400 RGBA_4444_PRE = 149,
4401 RGBA_5551_PRE = 150
4404 // A struct for describing the state of a file descriptor that Cogl
4405 // needs to block on. The @events field contains a bitmask of
4406 // #CoglPollFDEvent<!-- -->s that should cause the application to wake
4407 // up. After the application is woken up from idle it should pass back
4408 // an array of #CoglPollFD<!-- -->s to Cogl and update the @revents
4409 // mask to the actual events that occurred on the file descriptor.
4411 // Note that CoglPollFD is deliberately exactly the same as struct
4412 // pollfd on Unix so that it can simply be cast when calling poll.
4413 struct PollFD /* Version 1.10 */ {
4414 int fd;
4415 short events, revents;
4419 // A bitmask of events that Cogl may need to wake on for a file
4420 // descriptor. Note that these all have the same values as the
4421 // corresponding defines for the poll function call on Unix so they
4422 // may be directly passed to poll.
4423 enum PollFDEvent /* Version 1.10 */ {
4424 IN = 1,
4425 PRI = 2,
4426 OUT = 4,
4427 ERR = 8,
4428 HUP = 16,
4429 NVAL = 32
4431 struct Primitive {
4433 // VERSION: 1.6
4434 // Draw the given @primitive with the current source material.
4435 void draw()() {
4436 cogl_primitive_draw(&this);
4438 int get_first_vertex()() {
4439 return cogl_primitive_get_first_vertex(&this);
4441 VerticesMode get_mode()() {
4442 return cogl_primitive_get_mode(&this);
4444 int get_n_vertices_EXP()() {
4445 return cogl_primitive_get_n_vertices_EXP(&this);
4448 // VERSION: 1.6
4449 // Replaces all the attributes of the given #CoglPrimitive object.
4450 // <attributes>: A %NULL terminated array of #CoglAttribute pointers
4451 void set_attributes()(Attribute** attributes, int n_attributes) {
4452 cogl_primitive_set_attributes(&this, attributes, n_attributes);
4454 void set_first_vertex()(int first_vertex) {
4455 cogl_primitive_set_first_vertex(&this, first_vertex);
4457 void set_indices_EXP()(Indices* indices, int n_indices) {
4458 cogl_primitive_set_indices_EXP(&this, indices, n_indices);
4460 void set_mode()(VerticesMode mode) {
4461 cogl_primitive_set_mode(&this, mode);
4463 void set_n_vertices_EXP()(int n_vertices) {
4464 cogl_primitive_set_n_vertices_EXP(&this, n_vertices);
4467 // Unintrospectable function: new() / cogl_primitive_new()
4468 // VERSION: 1.6
4469 // Combines a set of #CoglAttribute<!-- -->s with a specific draw @mode
4470 // and defines a vertex count so a #CoglPrimitive object can be retained and
4471 // drawn later with no addition information required.
4473 // The value passed as @n_vertices will simply update the
4474 // #CoglPrimitive::n_vertices property as if
4475 // cogl_primitive_set_n_vertices() were called. This property defines
4476 // the number of vertices to read when drawing.
4477 // RETURNS: A newly allocated #CoglPrimitive object
4478 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4479 // <n_vertices>: The number of vertices to process when drawing
4480 alias cogl_primitive_new new_; // Variadic
4482 // Unintrospectable function: new_p2() / cogl_primitive_new_p2()
4483 // VERSION: 1.6
4484 // Provides a convenient way to describe a primitive, such as a single
4485 // triangle strip or a triangle fan, that will internally allocate the
4486 // necessary #CoglAttributeBuffer storage, describe the position
4487 // attribute with a #CoglAttribute and upload your data.
4489 // For example to draw a convex polygon you can do:
4490 // |[
4491 // CoglVertexP2 triangle[] =
4492 // {
4493 // { 0, 300 },
4494 // { 150, 0, },
4495 // { 300, 300 }
4496 // };
4497 // prim = cogl_primitive_new_p2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4498 // 3, triangle);
4499 // cogl_primitive_draw (prim);
4500 // ]|
4502 // The value passed as @n_vertices is initially used to determine how
4503 // much can be read from @data but it will also be used to update the
4504 // #CoglPrimitive::n_vertices property as if
4505 // cogl_primitive_set_n_vertices() were called. This property defines
4506 // the number of vertices to read when drawing.
4507 // <note>The primitive API doesn't support drawing with sliced
4508 // textures (since switching between slices implies changing state and
4509 // so that implies multiple primitives need to be submitted). You
4510 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4511 // might be used while drawing with this API. If your hardware doesn't
4512 // support non-power of two textures (For example you are using GLES
4513 // 1.1) then you will need to make sure your assets are resized to a
4514 // power-of-two size (though they don't have to be square)</note>
4516 // 1. This can be freed using cogl_object_unref().
4517 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4518 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4519 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4520 // <data>: An array of #CoglVertexP2 vertices
4521 static Primitive* new_p2()(VerticesMode mode, int n_vertices, VertexP2* data) {
4522 return cogl_primitive_new_p2(mode, n_vertices, data);
4525 // Unintrospectable function: new_p2c4() / cogl_primitive_new_p2c4()
4526 // VERSION: 1.6
4527 // Provides a convenient way to describe a primitive, such as a single
4528 // triangle strip or a triangle fan, that will internally allocate the
4529 // necessary #CoglAttributeBuffer storage, describe the position
4530 // and color attributes with #CoglAttribute<!-- -->s and upload
4531 // your data.
4533 // For example to draw a convex polygon with a linear gradient you
4534 // can do:
4535 // |[
4536 // CoglVertexP2C4 triangle[] =
4537 // {
4538 // { 0, 300, 0xff, 0x00, 0x00, 0xff },
4539 // { 150, 0, 0x00, 0xff, 0x00, 0xff },
4540 // { 300, 300, 0xff, 0x00, 0x00, 0xff }
4541 // };
4542 // prim = cogl_primitive_new_p2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4543 // 3, triangle);
4544 // cogl_primitive_draw (prim);
4545 // ]|
4547 // The value passed as @n_vertices is initially used to determine how
4548 // much can be read from @data but it will also be used to update the
4549 // #CoglPrimitive::n_vertices property as if
4550 // cogl_primitive_set_n_vertices() were called. This property defines
4551 // the number of vertices to read when drawing.
4552 // <note>The primitive API doesn't support drawing with sliced
4553 // textures (since switching between slices implies changing state and
4554 // so that implies multiple primitives need to be submitted). You
4555 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4556 // might be used while drawing with this API. If your hardware doesn't
4557 // support non-power of two textures (For example you are using GLES
4558 // 1.1) then you will need to make sure your assets are resized to a
4559 // power-of-two size (though they don't have to be square)</note>
4561 // 1. This can be freed using cogl_object_unref().
4562 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4563 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4564 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4565 // <data>: An array of #CoglVertexP2C4 vertices
4566 static Primitive* new_p2c4()(VerticesMode mode, int n_vertices, VertexP2C4* data) {
4567 return cogl_primitive_new_p2c4(mode, n_vertices, data);
4570 // Unintrospectable function: new_p2t2() / cogl_primitive_new_p2t2()
4571 // VERSION: 1.6
4572 // Provides a convenient way to describe a primitive, such as a single
4573 // triangle strip or a triangle fan, that will internally allocate the
4574 // necessary #CoglAttributeBuffer storage, describe the position and
4575 // texture coordinate attributes with #CoglAttribute<!-- -->s and
4576 // upload your data.
4578 // For example to draw a convex polygon with texture mapping you can
4579 // do:
4580 // |[
4581 // CoglVertexP2T2 triangle[] =
4582 // {
4583 // { 0, 300, 0.0, 1.0},
4584 // { 150, 0, 0.5, 0.0},
4585 // { 300, 300, 1.0, 1.0}
4586 // };
4587 // prim = cogl_primitive_new_p2t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4588 // 3, triangle);
4589 // cogl_primitive_draw (prim);
4590 // ]|
4592 // The value passed as @n_vertices is initially used to determine how
4593 // much can be read from @data but it will also be used to update the
4594 // #CoglPrimitive::n_vertices property as if
4595 // cogl_primitive_set_n_vertices() were called. This property defines
4596 // the number of vertices to read when drawing.
4597 // <note>The primitive API doesn't support drawing with sliced
4598 // textures (since switching between slices implies changing state and
4599 // so that implies multiple primitives need to be submitted). You
4600 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4601 // might be used while drawing with this API. If your hardware doesn't
4602 // support non-power of two textures (For example you are using GLES
4603 // 1.1) then you will need to make sure your assets are resized to a
4604 // power-of-two size (though they don't have to be square)</note>
4606 // 1. This can be freed using cogl_object_unref().
4607 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4608 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4609 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4610 // <data>: An array of #CoglVertexP2T2 vertices
4611 static Primitive* new_p2t2()(VerticesMode mode, int n_vertices, VertexP2T2* data) {
4612 return cogl_primitive_new_p2t2(mode, n_vertices, data);
4615 // Unintrospectable function: new_p2t2c4() / cogl_primitive_new_p2t2c4()
4616 // VERSION: 1.6
4617 // Provides a convenient way to describe a primitive, such as a single
4618 // triangle strip or a triangle fan, that will internally allocate the
4619 // necessary #CoglAttributeBuffer storage, describe the position, texture
4620 // coordinate and color attributes with #CoglAttribute<!-- -->s and
4621 // upload your data.
4623 // For example to draw a convex polygon with texture mapping and a
4624 // linear gradient you can do:
4625 // |[
4626 // CoglVertexP2T2C4 triangle[] =
4627 // {
4628 // { 0, 300, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
4629 // { 150, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
4630 // { 300, 300, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff}
4631 // };
4632 // prim = cogl_primitive_new_p2t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4633 // 3, triangle);
4634 // cogl_primitive_draw (prim);
4635 // ]|
4637 // The value passed as @n_vertices is initially used to determine how
4638 // much can be read from @data but it will also be used to update the
4639 // #CoglPrimitive::n_vertices property as if
4640 // cogl_primitive_set_n_vertices() were called. This property defines
4641 // the number of vertices to read when drawing.
4642 // <note>The primitive API doesn't support drawing with sliced
4643 // textures (since switching between slices implies changing state and
4644 // so that implies multiple primitives need to be submitted). You
4645 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4646 // might be used while drawing with this API. If your hardware doesn't
4647 // support non-power of two textures (For example you are using GLES
4648 // 1.1) then you will need to make sure your assets are resized to a
4649 // power-of-two size (though they don't have to be square)</note>
4651 // 1. This can be freed using cogl_object_unref().
4652 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4653 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4654 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4655 // <data>: An array of #CoglVertexP2T2C4 vertices
4656 static Primitive* new_p2t2c4()(VerticesMode mode, int n_vertices, VertexP2T2C4* data) {
4657 return cogl_primitive_new_p2t2c4(mode, n_vertices, data);
4660 // Unintrospectable function: new_p3() / cogl_primitive_new_p3()
4661 // VERSION: 1.6
4662 // Provides a convenient way to describe a primitive, such as a single
4663 // triangle strip or a triangle fan, that will internally allocate the
4664 // necessary #CoglAttributeBuffer storage, describe the position
4665 // attribute with a #CoglAttribute and upload your data.
4667 // For example to draw a convex polygon you can do:
4668 // |[
4669 // CoglVertexP3 triangle[] =
4670 // {
4671 // { 0, 300, 0 },
4672 // { 150, 0, 0 },
4673 // { 300, 300, 0 }
4674 // };
4675 // prim = cogl_primitive_new_p3 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4676 // 3, triangle);
4677 // cogl_primitive_draw (prim);
4678 // ]|
4680 // The value passed as @n_vertices is initially used to determine how
4681 // much can be read from @data but it will also be used to update the
4682 // #CoglPrimitive::n_vertices property as if
4683 // cogl_primitive_set_n_vertices() were called. This property defines
4684 // the number of vertices to read when drawing.
4685 // <note>The primitive API doesn't support drawing with sliced
4686 // textures (since switching between slices implies changing state and
4687 // so that implies multiple primitives need to be submitted). You
4688 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4689 // might be used while drawing with this API. If your hardware doesn't
4690 // support non-power of two textures (For example you are using GLES
4691 // 1.1) then you will need to make sure your assets are resized to a
4692 // power-of-two size (though they don't have to be square)</note>
4694 // 1. This can be freed using cogl_object_unref().
4695 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4696 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4697 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4698 // <data>: An array of #CoglVertexP3 vertices
4699 static Primitive* new_p3()(VerticesMode mode, int n_vertices, VertexP3* data) {
4700 return cogl_primitive_new_p3(mode, n_vertices, data);
4703 // Unintrospectable function: new_p3c4() / cogl_primitive_new_p3c4()
4704 // VERSION: 1.6
4705 // Provides a convenient way to describe a primitive, such as a single
4706 // triangle strip or a triangle fan, that will internally allocate the
4707 // necessary #CoglAttributeBuffer storage, describe the position
4708 // and color attributes with #CoglAttribute<!-- -->s and upload
4709 // your data.
4711 // For example to draw a convex polygon with a linear gradient you
4712 // can do:
4713 // |[
4714 // CoglVertexP3C4 triangle[] =
4715 // {
4716 // { 0, 300, 0, 0xff, 0x00, 0x00, 0xff },
4717 // { 150, 0, 0, 0x00, 0xff, 0x00, 0xff },
4718 // { 300, 300, 0, 0xff, 0x00, 0x00, 0xff }
4719 // };
4720 // prim = cogl_primitive_new_p3c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4721 // 3, triangle);
4722 // cogl_primitive_draw (prim);
4723 // ]|
4725 // The value passed as @n_vertices is initially used to determine how
4726 // much can be read from @data but it will also be used to update the
4727 // #CoglPrimitive::n_vertices property as if
4728 // cogl_primitive_set_n_vertices() were called. This property defines
4729 // the number of vertices to read when drawing.
4730 // <note>The primitive API doesn't support drawing with sliced
4731 // textures (since switching between slices implies changing state and
4732 // so that implies multiple primitives need to be submitted). You
4733 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4734 // might be used while drawing with this API. If your hardware doesn't
4735 // support non-power of two textures (For example you are using GLES
4736 // 1.1) then you will need to make sure your assets are resized to a
4737 // power-of-two size (though they don't have to be square)</note>
4739 // 1. This can be freed using cogl_object_unref().
4740 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4741 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4742 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4743 // <data>: An array of #CoglVertexP3C4 vertices
4744 static Primitive* new_p3c4()(VerticesMode mode, int n_vertices, VertexP3C4* data) {
4745 return cogl_primitive_new_p3c4(mode, n_vertices, data);
4748 // Unintrospectable function: new_p3t2() / cogl_primitive_new_p3t2()
4749 // VERSION: 1.6
4750 // Provides a convenient way to describe a primitive, such as a single
4751 // triangle strip or a triangle fan, that will internally allocate the
4752 // necessary #CoglAttributeBuffer storage, describe the position and
4753 // texture coordinate attributes with #CoglAttribute<!-- -->s and
4754 // upload your data.
4756 // For example to draw a convex polygon with texture mapping you can
4757 // do:
4758 // |[
4759 // CoglVertexP3T2 triangle[] =
4760 // {
4761 // { 0, 300, 0, 0.0, 1.0},
4762 // { 150, 0, 0, 0.5, 0.0},
4763 // { 300, 300, 0, 1.0, 1.0}
4764 // };
4765 // prim = cogl_primitive_new_p3t2 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4766 // 3, triangle);
4767 // cogl_primitive_draw (prim);
4768 // ]|
4770 // The value passed as @n_vertices is initially used to determine how
4771 // much can be read from @data but it will also be used to update the
4772 // #CoglPrimitive::n_vertices property as if
4773 // cogl_primitive_set_n_vertices() were called. This property defines
4774 // the number of vertices to read when drawing.
4775 // <note>The primitive API doesn't support drawing with sliced
4776 // textures (since switching between slices implies changing state and
4777 // so that implies multiple primitives need to be submitted). You
4778 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4779 // might be used while drawing with this API. If your hardware doesn't
4780 // support non-power of two textures (For example you are using GLES
4781 // 1.1) then you will need to make sure your assets are resized to a
4782 // power-of-two size (though they don't have to be square)</note>
4784 // 1. This can be freed using cogl_object_unref().
4785 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4786 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4787 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4788 // <data>: An array of #CoglVertexP3T2 vertices
4789 static Primitive* new_p3t2()(VerticesMode mode, int n_vertices, VertexP3T2* data) {
4790 return cogl_primitive_new_p3t2(mode, n_vertices, data);
4793 // Unintrospectable function: new_p3t2c4() / cogl_primitive_new_p3t2c4()
4794 // VERSION: 1.6
4795 // Provides a convenient way to describe a primitive, such as a single
4796 // triangle strip or a triangle fan, that will internally allocate the
4797 // necessary #CoglAttributeBuffer storage, describe the position, texture
4798 // coordinate and color attributes with #CoglAttribute<!-- -->s and
4799 // upload your data.
4801 // For example to draw a convex polygon with texture mapping and a
4802 // linear gradient you can do:
4803 // |[
4804 // CoglVertexP3T2C4 triangle[] =
4805 // {
4806 // { 0, 300, 0, 0.0, 1.0, 0xff, 0x00, 0x00, 0xff},
4807 // { 150, 0, 0, 0.5, 0.0, 0x00, 0xff, 0x00, 0xff},
4808 // { 300, 300, 0, 1.0, 1.0, 0xff, 0x00, 0x00, 0xff}
4809 // };
4810 // prim = cogl_primitive_new_p3t2c4 (COGL_VERTICES_MODE_TRIANGLE_FAN,
4811 // 3, triangle);
4812 // cogl_primitive_draw (prim);
4813 // ]|
4815 // The value passed as @n_vertices is initially used to determine how
4816 // much can be read from @data but it will also be used to update the
4817 // #CoglPrimitive::n_vertices property as if
4818 // cogl_primitive_set_n_vertices() were called. This property defines
4819 // the number of vertices to read when drawing.
4820 // <note>The primitive API doesn't support drawing with sliced
4821 // textures (since switching between slices implies changing state and
4822 // so that implies multiple primitives need to be submitted). You
4823 // should pass the %COGL_TEXTURE_NO_SLICING flag to all textures that
4824 // might be used while drawing with this API. If your hardware doesn't
4825 // support non-power of two textures (For example you are using GLES
4826 // 1.1) then you will need to make sure your assets are resized to a
4827 // power-of-two size (though they don't have to be square)</note>
4829 // 1. This can be freed using cogl_object_unref().
4830 // RETURNS: A newly allocated #CoglPrimitive with a reference of
4831 // <mode>: A #CoglVerticesMode defining how to draw the vertices
4832 // <n_vertices>: The number of vertices to read from @data and also the number of vertices to read when later drawing.
4833 // <data>: An array of #CoglVertexP3T2C4 vertices
4834 static Primitive* new_p3t2c4()(VerticesMode mode, int n_vertices, VertexP3T2C4* data) {
4835 return cogl_primitive_new_p3t2c4(mode, n_vertices, data);
4837 // Unintrospectable function: new_with_attributes() / cogl_primitive_new_with_attributes()
4838 static Primitive* new_with_attributes()(VerticesMode mode, int n_vertices, Attribute** attributes, int n_attributes) {
4839 return cogl_primitive_new_with_attributes(mode, n_vertices, attributes, n_attributes);
4844 // A quaternion is comprised of a scalar component and a 3D vector
4845 // component. The scalar component is normally referred to as w and the
4846 // vector might either be referred to as v or a (for axis) or expanded
4847 // with the individual components: (x, y, z) A full quaternion would
4848 // then be written as <pre>[w (x, y, z)]</pre>.
4850 // Quaternions can be considered to represent an axis and angle
4851 // pair although sadly these numbers are buried somewhat under some
4852 // maths...
4854 // For the curious you can see here that a given axis (a) and angle (𝜃)
4855 // pair are represented in a quaternion as follows:
4856 // |[
4857 // [w=cos(𝜃/2) ( x=sin(𝜃/2)*a.x, y=sin(𝜃/2)*a.y, z=sin(𝜃/2)*a.x )]
4858 // ]|
4860 // Unit Quaternions:
4861 // When using Quaternions to represent spatial orientations for 3D
4862 // graphics it's always assumed you have a unit quaternion. The
4863 // magnitude of a quaternion is defined as:
4864 // |[
4865 // sqrt (w² + x² + y² + z²)
4866 // ]|
4867 // and a unit quaternion satisfies this equation:
4868 // |[
4869 // w² + x² + y² + z² = 1
4870 // ]|
4872 // Thankfully most of the time we don't actually have to worry about
4873 // the maths that goes on behind the scenes but if you are curious to
4874 // learn more here are some external references:
4876 // <itemizedlist>
4877 // <listitem>
4878 // <ulink url="http://mathworld.wolfram.com/Quaternion.html"/>
4879 // </listitem>
4880 // <listitem>
4881 // <ulink url="http://www.gamedev.net/reference/articles/article1095.asp"/>
4882 // </listitem>
4883 // <listitem>
4884 // <ulink url="http://www.cprogramming.com/tutorial/3d/quaternions.html"/>
4885 // </listitem>
4886 // <listitem>
4887 // <ulink url="http://www.isner.com/tutorials/quatSpells/quaternion_spells_12.htm"/>
4888 // </listitem>
4889 // <listitem>
4890 // 3D Maths Primer for Graphics and Game Development ISBN-10: 1556229119
4891 // </listitem>
4892 // <listitem>
4893 // <ulink url="http://www.cs.caltech.edu/courses/cs171/quatut.pdf"/>
4894 // </listitem>
4895 // <listitem>
4896 // <ulink url="http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q56"/>
4897 // </listitem>
4898 // </itemizedlist>
4900 // rotation it is sin(𝜃/2)*axis.x
4901 // rotation it is sin(𝜃/2)*axis.y
4902 // rotation it is sin(𝜃/2)*axis.z
4903 struct Quaternion {
4904 float w, x, y, z, padding0, padding1, padding2, padding3;
4907 // Unintrospectable method: copy() / cogl_quaternion_copy()
4908 // VERSION: 2.0
4909 // Allocates a new #CoglQuaternion on the stack and initializes it with
4910 // the same values as @src.
4912 // using cogl_quaternion_free()
4913 // RETURNS: A newly allocated #CoglQuaternion which should be freed
4914 Quaternion* copy()() {
4915 return cogl_quaternion_copy(&this);
4917 // VERSION: 2.0
4918 float dot_product()(Quaternion* b) {
4919 return cogl_quaternion_dot_product(&this, b);
4922 // VERSION: 2.0
4923 // Frees a #CoglQuaternion that was previously allocated via
4924 // cogl_quaternion_copy().
4925 void free()() {
4926 cogl_quaternion_free(&this);
4928 // VERSION: 2.0
4929 float get_rotation_angle()() {
4930 return cogl_quaternion_get_rotation_angle(&this);
4932 // VERSION: 2.0
4933 void get_rotation_axis()(float* vector3) {
4934 cogl_quaternion_get_rotation_axis(&this, vector3);
4937 // VERSION: 2.0
4938 // Initializes a quaternion that rotates @angle degrees around the
4939 // axis vector (@x, @y, @z). The axis vector does not need to be
4940 // normalized.
4942 // rotated @angle degrees around the axis vector (@x, @y, @z)
4943 // RETURNS: A normalized, unit quaternion representing an orientation
4944 // <angle>: The angle you want to rotate around the given axis
4945 // <x>: The x component of your axis vector about which you want to rotate.
4946 // <y>: The y component of your axis vector about which you want to rotate.
4947 // <z>: The z component of your axis vector about which you want to rotate.
4948 void init()(float angle, float x, float y, float z) {
4949 cogl_quaternion_init(&this, angle, x, y, z);
4952 // VERSION: 2.0
4953 // Initializes a quaternion that rotates @angle degrees around the
4954 // given @axis vector. The axis vector does not need to be
4955 // normalized.
4957 // rotated @angle degrees around the given @axis vector.
4958 // RETURNS: A normalized, unit quaternion representing an orientation
4959 void init_from_angle_vector()(float angle, float* axis3f) {
4960 cogl_quaternion_init_from_angle_vector(&this, angle, axis3f);
4963 // VERSION: 2.0
4964 // Initializes a [w (x, y,z)] quaternion directly from an array of 4
4965 // floats: [w,x,y,z].
4966 // <array>: An array of 4 floats (x,y,z),w
4967 void init_from_array()(float* array) {
4968 cogl_quaternion_init_from_array(&this, array);
4970 void init_from_euler()(Euler* euler) {
4971 cogl_quaternion_init_from_euler(&this, euler);
4974 // VERSION: 2.0
4975 // XXX: check which direction this rotates
4976 // <angle>: The angle to rotate around the x axis
4977 void init_from_x_rotation()(float angle) {
4978 cogl_quaternion_init_from_x_rotation(&this, angle);
4981 // VERSION: 2.0
4983 // <angle>: The angle to rotate around the y axis
4984 void init_from_y_rotation()(float angle) {
4985 cogl_quaternion_init_from_y_rotation(&this, angle);
4988 // VERSION: 2.0
4990 // <angle>: The angle to rotate around the y axis
4991 void init_from_z_rotation()(float angle) {
4992 cogl_quaternion_init_from_z_rotation(&this, angle);
4995 // VERSION: 2.0
4996 // Initializes the quaternion with the canonical quaternion identity
4997 // [1 (0, 0, 0)] which represents no rotation. Multiplying a
4998 // quaternion with this identity leaves the quaternion unchanged.
5000 // You might also want to consider using
5001 // cogl_get_static_identity_quaternion().
5002 void init_identity()() {
5003 cogl_quaternion_init_identity(&this);
5005 // VERSION: 2.0
5006 void invert()() {
5007 cogl_quaternion_invert(&this);
5010 // VERSION: 2.0
5011 // This combines the rotations of two quaternions into @result. The
5012 // operation is not commutative so the order is important because AxB
5013 // != BxA. Cogl follows the standard convention for quaternions here
5014 // so the rotations are applied @right to @left. This is similar to the
5015 // combining of matrices.
5016 // <left>: The second #CoglQuaternion rotation to apply
5017 // <right>: The first #CoglQuaternion rotation to apply
5018 void multiply()(Quaternion* left, Quaternion* right) {
5019 cogl_quaternion_multiply(&this, left, right);
5022 // Performs a normalized linear interpolation between two quaternions.
5023 // That is it does a linear interpolation of the quaternion components
5024 // and then normalizes the result. This will follow the shortest arc
5025 // between the two orientations (just like the slerp() function) but
5026 // will not progress at a constant speed. Unlike slerp() nlerp is
5027 // commutative which is useful if you are blending animations
5028 // together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp,
5029 // d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp,
5030 // b)). Finally nlerp is cheaper than slerp so it can be a good choice
5031 // if you don't need the constant speed property of the slerp() function.
5033 // Notable properties:
5034 // <itemizedlist>
5035 // <listitem>
5036 // commutative: Yes
5037 // </listitem>
5038 // <listitem>
5039 // constant velocity: No
5040 // </listitem>
5041 // <listitem>
5042 // torque minimal (travels along the surface of the 4-sphere): Yes
5043 // </listitem>
5044 // <listitem>
5045 // faster than cogl_quaternion_slerp()
5046 // </listitem>
5047 // </itemizedlist>
5048 // <a>: The first #CoglQuaternion
5049 // <b>: The second #CoglQuaternion
5050 // <t>: The factor in the range [0,1] used to interpolate between quaterion @a and @b.
5051 void nlerp()(Quaternion* a, Quaternion* b, float t) {
5052 cogl_quaternion_nlerp(&this, a, b, t);
5054 // VERSION: 2.0
5055 void normalize()() {
5056 cogl_quaternion_normalize(&this);
5058 // VERSION: 2.0
5059 void pow()(float exponent) {
5060 cogl_quaternion_pow(&this, exponent);
5063 // Performs a spherical linear interpolation between two quaternions.
5065 // Noteable properties:
5066 // <itemizedlist>
5067 // <listitem>
5068 // commutative: No
5069 // </listitem>
5070 // <listitem>
5071 // constant velocity: Yes
5072 // </listitem>
5073 // <listitem>
5074 // torque minimal (travels along the surface of the 4-sphere): Yes
5075 // </listitem>
5076 // <listitem>
5077 // more expensive than cogl_quaternion_nlerp()
5078 // </listitem>
5079 // </itemizedlist>
5080 void slerp()(Quaternion* a, Quaternion* b, float t) {
5081 cogl_quaternion_slerp(&this, a, b, t);
5083 // VERSION: 2.0
5084 void squad()(Quaternion* prev, Quaternion* a, Quaternion* b, Quaternion* next, float t) {
5085 cogl_quaternion_squad(&this, prev, a, b, next, t);
5088 // VERSION: 2.0
5089 // Compares that all the components of quaternions @a and @b are
5090 // equal.
5092 // An epsilon value is not used to compare the float components, but
5093 // the == operator is at least used so that 0 and -0 are considered
5094 // equal.
5095 // RETURNS: %TRUE if the quaternions are equal else %FALSE.
5096 // <v1>: A #CoglQuaternion
5097 // <v2>: A #CoglQuaternion
5098 static int equal()(const(void)* v1, const(void)* v2) {
5099 return cogl_quaternion_equal(v1, v2);
5103 enum int RADIANS_TO_DEGREES = 3754936;
5104 // Flags for cogl_read_pixels()
5105 enum ReadPixelsFlags /* Version 1.0 */ {
5106 COLOR_BUFFER = 1
5108 struct Renderer {
5110 // VERSION: 1.10
5111 // This adds a renderer selection @constraint.
5113 // Applications should ideally minimize how many of these constraints they
5114 // depend on to ensure maximum portability.
5115 // <constraint>: A #CoglRendererConstraint to add
5116 void add_contraint()(RendererConstraint constraint) {
5117 cogl_renderer_add_contraint(&this, constraint);
5120 // VERSION: 1.10
5121 // Tests if a given @onscreen_template can be supported with the given
5122 // @renderer.
5124 // else %FALSE.
5125 // RETURNS: %TRUE if the @onscreen_template can be supported,
5126 // <onscreen_template>: A #CoglOnscreenTemplate
5127 int check_onscreen_template()(OnscreenTemplate* onscreen_template, GLib2.Error** error=null) {
5128 return cogl_renderer_check_onscreen_template(&this, onscreen_template, error);
5131 // VERSION: 1.10
5132 // Connects the configured @renderer. Renderer connection isn't a
5133 // very active process, it basically just means validating that
5134 // any given constraint criteria can be satisfied and that a
5135 // usable driver and window system backend can be found.
5137 // given @renderer. %FALSE if there was an error.
5138 // RETURNS: %TRUE if there was no error while connecting the
5139 int connect()(GLib2.Error** error=null) {
5140 return cogl_renderer_connect(&this, error);
5143 // VERSION: 1.8
5144 // Queries how many texture units can be used from fragment programs
5145 // RETURNS: the number of texture image units.
5146 int get_n_fragment_texture_units()() {
5147 return cogl_renderer_get_n_fragment_texture_units(&this);
5150 // Queries which window system backend Cogl has chosen to use.
5152 // This may only be called on a connected #CoglRenderer.
5154 // system backend.
5155 // RETURNS: The #CoglWinsysID corresponding to the chosen window
5156 WinsysID get_winsys_id()() {
5157 return cogl_renderer_get_winsys_id(&this);
5160 // VERSION: 1.10
5161 // This removes a renderer selection @constraint.
5163 // Applications should ideally minimize how many of these constraints they
5164 // depend on to ensure maximum portability.
5165 // <constraint>: A #CoglRendererConstraint to remove
5166 void remove_constraint()(RendererConstraint constraint) {
5167 cogl_renderer_remove_constraint(&this, constraint);
5170 // This allows you to explicitly select a winsys backend to use instead
5171 // of letting Cogl automatically select a backend.
5173 // if you select an unsupported backend then cogl_renderer_connect()
5174 // will fail and report an error.
5176 // This may only be called on an un-connected #CoglRenderer.
5177 // <winsys_id>: An ID of the winsys you explicitly want to use.
5178 void set_winsys_id()(WinsysID winsys_id) {
5179 cogl_renderer_set_winsys_id(&this, winsys_id);
5182 // Unintrospectable function: new() / cogl_renderer_new()
5183 // VERSION: 1.10
5184 // Instantiates a new (unconnected) #CoglRenderer object. A
5185 // #CoglRenderer represents a means to render. It encapsulates the
5186 // selection of an underlying driver, such as OpenGL or OpenGL-ES and
5187 // a selection of a window system binding API such as GLX, or EGL or
5188 // WGL.
5190 // While the renderer is unconnected it can be configured so that
5191 // applications may specify backend constraints, such as "must use
5192 // x11" for example via cogl_renderer_add_criteria().
5194 // There are also some platform specific configuration apis such
5195 // as cogl_xlib_renderer_set_foreign_display() that may also be
5196 // used while the renderer is unconnected.
5198 // Once the renderer has been configured, then it may (optionally) be
5199 // explicitly connected using cogl_renderer_connect() which allows
5200 // errors to be handled gracefully and potentially fallback
5201 // configurations can be tried out if there are initial failures.
5203 // If a renderer is not explicitly connected then cogl_display_new()
5204 // will automatically connect the renderer for you. If you don't
5205 // have any code to deal with error/fallback situations then its fine
5206 // to just let Cogl do the connection for you.
5208 // Once you have setup your renderer then the next step is to create a
5209 // #CoglDisplay using cogl_display_new().
5211 // <note>Many applications don't need to explicitly use
5212 // cogl_renderer_new() or cogl_display_new() and can just jump
5213 // straight to cogl_context_new() and pass a %NULL display argument
5214 // so Cogl will automatically connect and setup a renderer and
5215 // display.</note>
5216 static Cogl.Renderer* new_()() {
5217 return cogl_renderer_new();
5222 // These constraint flags are hard-coded features of the different renderer
5223 // backends. Sometimes a platform may support multiple rendering options which
5224 // Cogl will usually choose from automatically. Some of these features are
5225 // important to higher level applications and frameworks though, such as
5226 // whether a renderer is X11 based because an application might only support
5227 // X11 based input handling. An application might also need to ensure EGL is
5228 // used internally too if they depend on access to an EGLDisplay for some
5229 // purpose.
5231 // Applications should ideally minimize how many of these constraints
5232 // they depend on to ensure maximum portability.
5233 enum RendererConstraint /* Version 1.10 */ {
5234 X11 = 1,
5235 XLIB = 2,
5236 EGL = 4
5238 enum RendererError {
5239 NOT_FOUND = 0,
5240 XLIB_DISPLAY_OPEN = 1
5242 enum int SQRTI_ARG_10_PERCENT = 5590;
5243 enum int SQRTI_ARG_5_PERCENT = 210;
5244 enum int SQRTI_ARG_MAX = 4194303;
5245 // Types of shaders
5246 enum ShaderType /* Version 1.0 */ {
5247 VERTEX = 0,
5248 FRAGMENT = 1
5250 struct Snippet {
5252 // VERSION: 1.10
5253 // cogl_snippet_set_declarations() or %NULL if none was set.
5254 // RETURNS: the source string that was set with
5255 char* get_declarations()() {
5256 return cogl_snippet_get_declarations(&this);
5259 // VERSION: 1.10
5260 // called.
5261 // RETURNS: the hook that was set when cogl_snippet_new() was
5262 SnippetHook get_hook()() {
5263 return cogl_snippet_get_hook(&this);
5266 // VERSION: 1.10
5267 // cogl_snippet_set_post() or %NULL if none was set.
5268 // RETURNS: the source string that was set with
5269 char* get_post()() {
5270 return cogl_snippet_get_post(&this);
5273 // VERSION: 1.10
5274 // cogl_snippet_set_pre() or %NULL if none was set.
5275 // RETURNS: the source string that was set with
5276 char* get_pre()() {
5277 return cogl_snippet_get_pre(&this);
5280 // VERSION: 1.10
5281 // cogl_snippet_set_replace() or %NULL if none was set.
5282 // RETURNS: the source string that was set with
5283 char* get_replace()() {
5284 return cogl_snippet_get_replace(&this);
5287 // VERSION: 1.10
5288 // Sets a source string that will be inserted in the global scope of
5289 // the generated shader when this snippet is used on a pipeline. This
5290 // string is typically used to declare uniforms, attributes or
5291 // functions that will be used by the other parts of the snippets.
5293 // This function should only be called before the snippet is attached
5294 // to its first pipeline. After that the snippet should be considered
5295 // immutable.
5296 // <declarations>: The new source string for the declarations section of this snippet.
5297 void set_declarations()(char* declarations) {
5298 cogl_snippet_set_declarations(&this, declarations);
5301 // VERSION: 1.10
5302 // Sets a source string that will be inserted after the hook point in
5303 // the generated shader for the pipeline that this snippet is attached
5304 // to. Please see the documentation of each hook point in
5305 // #CoglPipeline for a description of how this string should be used.
5307 // This function should only be called before the snippet is attached
5308 // to its first pipeline. After that the snippet should be considered
5309 // immutable.
5310 // <post>: The new source string for the post section of this snippet.
5311 void set_post()(char* post) {
5312 cogl_snippet_set_post(&this, post);
5315 // VERSION: 1.10
5316 // Sets a source string that will be inserted before the hook point in
5317 // the generated shader for the pipeline that this snippet is attached
5318 // to. Please see the documentation of each hook point in
5319 // #CoglPipeline for a description of how this string should be used.
5321 // This function should only be called before the snippet is attached
5322 // to its first pipeline. After that the snippet should be considered
5323 // immutable.
5324 // <pre>: The new source string for the pre section of this snippet.
5325 void set_pre()(char* pre) {
5326 cogl_snippet_set_pre(&this, pre);
5329 // VERSION: 1.10
5330 // Sets a source string that will be used instead of any generated
5331 // source code or any previous snippets for this hook point. Please
5332 // see the documentation of each hook point in #CoglPipeline for a
5333 // description of how this string should be used.
5335 // This function should only be called before the snippet is attached
5336 // to its first pipeline. After that the snippet should be considered
5337 // immutable.
5338 // <replace>: The new source string for the replace section of this snippet.
5339 void set_replace()(char* replace) {
5340 cogl_snippet_set_replace(&this, replace);
5343 // Unintrospectable function: new() / cogl_snippet_new()
5344 // VERSION: 1.10
5345 // Allocates and initializes a new snippet with the given source strings.
5346 // RETURNS: a pointer to a new #CoglSnippet
5347 // <hook>: The point in the pipeline that this snippet will wrap around or replace.
5348 // <declarations>: The source code for the declarations for this snippet or %NULL. See cogl_snippet_set_declarations().
5349 // <post>: The source code to run after the hook point where this shader snippet is attached or %NULL. See cogl_snippet_set_post().
5350 static Snippet* new_()(SnippetHook hook, char* declarations, char* post) {
5351 return cogl_snippet_new(hook, declarations, post);
5356 // #CoglSnippetHook is used to specify a location within a
5357 // #CoglPipeline where the code of the snippet should be used when it
5358 // is attached to a pipeline.
5360 // <glosslist>
5361 // <glossentry>
5362 // <glossterm>%COGL_SNIPPET_HOOK_VERTEX</glossterm>
5363 // <glossdef>
5364 // <para>
5365 // Adds a shader snippet that will hook on to the vertex processing
5366 // stage of the pipeline. This gives a chance for the application to
5367 // modify the vertex attributes generated by the shader. Typically the
5368 // snippet will modify cogl_color_out or cogl_position_out builtins.
5369 // </para>
5370 // <para>
5371 // The ‘declarations’ string in @snippet will be inserted in the
5372 // global scope of the shader. Use this to declare any uniforms,
5373 // attributes or functions that the snippet requires.
5374 // </para>
5375 // <para>
5376 // The ‘pre’ string in @snippet will be inserted at the top of the
5377 // main() function before any vertex processing is done.
5378 // </para>
5379 // <para>
5380 // The ‘replace’ string in @snippet will be used instead of the
5381 // generated vertex processing if it is present. This can be used if
5382 // the application wants to provide a complete vertex shader and
5383 // doesn't need the generated output from Cogl.
5384 // </para>
5385 // <para>
5386 // The ‘post’ string in @snippet will be inserted after all of the
5387 // standard vertex processing is done. This can be used to modify the
5388 // outputs.
5389 // </para>
5390 // </glossdef>
5391 // </glossentry>
5392 // <glossentry>
5393 // <glossterm>%COGL_SNIPPET_HOOK_VERTEX_TRANSFORM</glossterm>
5394 // <glossdef>
5395 // <para>
5396 // Adds a shader snippet that will hook on to the vertex transform stage.
5397 // Typically the snippet will use the cogl_modelview_matrix,
5398 // cogl_projection_matrix and cogl_modelview_projection_matrix matrices and the
5399 // cogl_position_in attribute. The hook must write to cogl_position_out.
5400 // The default processing for this hook will multiply cogl_position_in by
5401 // the combined modelview-projection matrix and store it on cogl_position_out.
5402 // </para>
5403 // <para>
5404 // The ‘declarations’ string in @snippet will be inserted in the
5405 // global scope of the shader. Use this to declare any uniforms,
5406 // attributes or functions that the snippet requires.
5407 // </para>
5408 // <para>
5409 // The ‘pre’ string in @snippet will be inserted at the top of the
5410 // main() function before the vertex transform is done.
5411 // </para>
5412 // <para>
5413 // The ‘replace’ string in @snippet will be used instead of the
5414 // generated vertex transform if it is present.
5415 // </para>
5416 // <para>
5417 // The ‘post’ string in @snippet will be inserted after all of the
5418 // standard vertex transformation is done. This can be used to modify the
5419 // cogl_position_out in addition to the default processing.
5420 // </para>
5421 // </glossdef>
5422 // </glossentry>
5423 // <glossentry>
5424 // <glossterm>%COGL_SNIPPET_HOOK_FRAGMENT</glossterm>
5425 // <glossdef>
5426 // <para>
5427 // Adds a shader snippet that will hook on to the fragment processing
5428 // stage of the pipeline. This gives a chance for the application to
5429 // modify the fragment color generated by the shader. Typically the
5430 // snippet will modify cogl_color_out.
5431 // </para>
5432 // <para>
5433 // The ‘declarations’ string in @snippet will be inserted in the
5434 // global scope of the shader. Use this to declare any uniforms,
5435 // attributes or functions that the snippet requires.
5436 // </para>
5437 // <para>
5438 // The ‘pre’ string in @snippet will be inserted at the top of the
5439 // main() function before any fragment processing is done.
5440 // </para>
5441 // <para>
5442 // The ‘replace’ string in @snippet will be used instead of the
5443 // generated fragment processing if it is present. This can be used if
5444 // the application wants to provide a complete fragment shader and
5445 // doesn't need the generated output from Cogl.
5446 // </para>
5447 // <para>
5448 // The ‘post’ string in @snippet will be inserted after all of the
5449 // standard fragment processing is done. At this point the generated
5450 // value for the rest of the pipeline state will already be in
5451 // cogl_color_out so the application can modify the result by altering
5452 // this variable.
5453 // </para>
5454 // </glossdef>
5455 // </glossentry>
5456 // <glossentry>
5457 // <glossterm>%COGL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM</glossterm>
5458 // <glossdef>
5459 // <para>
5460 // Adds a shader snippet that will hook on to the texture coordinate
5461 // transformation of a particular layer. This can be used to replace
5462 // the processing for a layer or to modify the results.
5463 // </para>
5464 // <para>
5465 // Within the snippet code for this hook there are two extra
5466 // variables. The first is a mat4 called cogl_matrix which represents
5467 // the user matrix for this layer. The second is called cogl_tex_coord
5468 // and represents the incoming and outgoing texture coordinate. On
5469 // entry to the hook, cogl_tex_coord contains the value of the
5470 // corresponding texture coordinate attribute for this layer. The hook
5471 // is expected to modify this variable. The output will be passed as a
5472 // varying to the fragment processing stage. The default code will
5473 // just multiply cogl_matrix by cogl_tex_coord and store the result in
5474 // cogl_tex_coord.
5475 // </para>
5476 // <para>
5477 // The ‘declarations’ string in @snippet will be inserted in the
5478 // global scope of the shader. Use this to declare any uniforms,
5479 // attributes or functions that the snippet requires.
5480 // </para>
5481 // <para>
5482 // The ‘pre’ string in @snippet will be inserted just before the
5483 // fragment processing for this layer. At this point cogl_tex_coord
5484 // still contains the value of the texture coordinate attribute.
5485 // </para>
5486 // <para>
5487 // If a ‘replace’ string is given then this will be used instead of
5488 // the default fragment processing for this layer. The snippet can
5489 // modify cogl_tex_coord or leave it as is to apply no transformation.
5490 // </para>
5491 // <para>
5492 // The ‘post’ string in @snippet will be inserted just after the
5493 // transformation. At this point cogl_tex_coord will contain the
5494 // results of the transformation but it can be further modified by the
5495 // snippet.
5496 // </para>
5497 // </glossdef>
5498 // </glossentry>
5499 // <glossentry>
5500 // <glossterm>%COGL_SNIPPET_HOOK_LAYER_FRAGMENT</glossterm>
5501 // <glossdef>
5502 // <para>
5503 // Adds a shader snippet that will hook on to the fragment processing
5504 // of a particular layer. This can be used to replace the processing
5505 // for a layer or to modify the results.
5506 // </para>
5507 // <para>
5508 // Within the snippet code for this hook there is an extra vec4
5509 // variable called ‘cogl_layer’. This contains the resulting color
5510 // that will be used for the layer. This can be modified in the ‘post’
5511 // section or it the default processing can be replaced entirely using
5512 // the ‘replace’ section.
5513 // </para>
5514 // <para>
5515 // The ‘declarations’ string in @snippet will be inserted in the
5516 // global scope of the shader. Use this to declare any uniforms,
5517 // attributes or functions that the snippet requires.
5518 // </para>
5519 // <para>
5520 // The ‘pre’ string in @snippet will be inserted just before the
5521 // fragment processing for this layer.
5522 // </para>
5523 // <para>
5524 // If a ‘replace’ string is given then this will be used instead of
5525 // the default fragment processing for this layer. The snippet must write to
5526 // the ‘cogl_layer’ variable in that case.
5527 // </para>
5528 // <para>
5529 // The ‘post’ string in @snippet will be inserted just after the
5530 // fragment processing for the layer. The results can be modified by changing
5531 // the value of the ‘cogl_layer’ variable.
5532 // </para>
5533 // </glossdef>
5534 // </glossentry>
5535 // <glossentry>
5536 // <glossterm>%COGL_SNIPPET_HOOK_TEXTURE_LOOKUP</glossterm>
5537 // <glossdef>
5538 // <para>
5539 // Adds a shader snippet that will hook on to the texture lookup part
5540 // of a given layer. This gives a chance for the application to modify
5541 // the coordinates that will be used for the texture lookup or to
5542 // alter the returned texel.
5543 // </para>
5544 // <para>
5545 // Within the snippet code for this hook there are two extra variables
5546 // available. ‘cogl_tex_coord’ is a vec4 which contains the texture
5547 // coordinates that will be used for the texture lookup this can be
5548 // modified. ‘cogl_texel’ will contain the result of the texture
5549 // lookup. This can be modified.
5550 // </para>
5551 // <para>
5552 // The ‘declarations’ string in @snippet will be inserted in the
5553 // global scope of the shader. Use this to declare any uniforms,
5554 // attributes or functions that the snippet requires.
5555 // </para>
5556 // <para>
5557 // The ‘pre’ string in @snippet will be inserted at the top of the
5558 // main() function before any fragment processing is done. This is a
5559 // good place to modify the cogl_tex_coord variable.
5560 // </para>
5561 // <para>
5562 // If a ‘replace’ string is given then this will be used instead of a
5563 // the default texture lookup. The snippet would typically use its own
5564 // sampler in this case.
5565 // </para>
5566 // <para>
5567 // The ‘post’ string in @snippet will be inserted after texture lookup
5568 // has been preformed. Here the snippet can modify the cogl_texel
5569 // variable to alter the returned texel.
5570 // </para>
5571 // </glossdef>
5572 // </glossentry>
5573 // </glosslist>
5574 enum SnippetHook /* Version 1.10 */ {
5575 VERTEX = 0,
5576 VERTEX_TRANSFORM = 1,
5577 FRAGMENT = 2048,
5578 TEXTURE_COORD_TRANSFORM = 4096,
5579 LAYER_FRAGMENT = 6144,
5580 TEXTURE_LOOKUP = 6145
5582 struct SubTexture {
5584 // VERSION: 1.10
5585 // Retrieves the parent texture that @sub_texture derives its content
5586 // from. This is the texture that was passed to
5587 // cogl_sub_texture_new() as the parent_texture argument.
5589 // derives its content from.
5590 // RETURNS: The parent texture that @sub_texture
5591 Texture* get_parent()() {
5592 return cogl_sub_texture_get_parent(&this);
5594 // Unintrospectable function: new_EXP() / cogl_sub_texture_new_EXP()
5595 static SubTexture* new_EXP()(Cogl.Context* ctx, Texture* parent_texture, int sub_x, int sub_y, int sub_width, int sub_height) {
5596 return cogl_sub_texture_new_EXP(ctx, parent_texture, sub_x, sub_y, sub_width, sub_height);
5600 extern (C) alias void function (Framebuffer* framebuffer, void* user_data) SwapBuffersNotify;
5602 struct SwapChain {
5603 void set_has_alpha_EXP()(int has_alpha) {
5604 cogl_swap_chain_set_has_alpha_EXP(&this, has_alpha);
5606 void set_length_EXP()(int length) {
5607 cogl_swap_chain_set_length_EXP(&this, length);
5609 // Unintrospectable function: new_EXP() / cogl_swap_chain_new_EXP()
5610 static SwapChain* new_EXP()() {
5611 return cogl_swap_chain_new_EXP();
5615 enum int TEXTURE_MAX_WASTE = 127;
5616 struct Texture {
5618 // Copies the pixel data from a cogl texture to system memory.
5620 // <note>Don't pass the value of cogl_texture_get_rowstride() as the
5621 // @rowstride argument, the rowstride should be the rowstride you
5622 // want for the destination @data buffer not the rowstride of the
5623 // source texture</note>
5624 // RETURNS: the size of the texture data in bytes
5625 // <format>: the #CoglPixelFormat to store the texture as.
5626 // <rowstride>: the rowstride of @data in bytes or pass 0 to calculate from the bytes-per-pixel of @format multiplied by the @texture width.
5627 // <data>: memory location to write the @texture's contents, or %NULL to only query the data size through the return value.
5628 int get_data()(PixelFormat format, uint rowstride, ubyte* data) {
5629 return cogl_texture_get_data(&this, format, rowstride, data);
5632 // Queries the #CoglPixelFormat of a cogl texture.
5633 // RETURNS: the #CoglPixelFormat of the GPU side texture
5634 PixelFormat get_format()() {
5635 return cogl_texture_get_format(&this);
5638 // Queries the GL handles for a GPU side texture through its #CoglTexture.
5640 // If the texture is spliced the data for the first sub texture will be
5641 // queried.
5643 // if the handle was invalid
5644 // RETURNS: %TRUE if the handle was successfully retrieved, %FALSE
5645 // <out_gl_handle>: pointer to return location for the textures GL handle, or %NULL.
5646 // <out_gl_target>: pointer to return location for the GL target type, or %NULL.
5647 int get_gl_texture()(/*out*/ GL.uint_* out_gl_handle=null, /*out*/ GL.enum_* out_gl_target=null) {
5648 return cogl_texture_get_gl_texture(&this, out_gl_handle, out_gl_target);
5651 // Queries the height of a cogl texture.
5652 // RETURNS: the height of the GPU side texture in pixels
5653 uint get_height()() {
5654 return cogl_texture_get_height(&this);
5657 // Queries the maximum wasted (unused) pixels in one dimension of a GPU side
5658 // texture.
5659 // RETURNS: the maximum waste
5660 int get_max_waste()() {
5661 return cogl_texture_get_max_waste(&this);
5664 // DEPRECATED (v1.10) method: get_rowstride - There's no replacement for the API but there's
5665 // Determines the bytes-per-pixel for the #CoglPixelFormat retrieved
5666 // from cogl_texture_get_format() and multiplies that by the texture's
5667 // width.
5669 // <note>It's very unlikely that anyone would need to use this API to
5670 // query the internal rowstride of a #CoglTexture which can just be
5671 // considered an implementation detail. Actually it's not even useful
5672 // internally since underlying drivers are free to use a different
5673 // format</note>
5675 // </note>This API is only here for backwards compatibility and
5676 // shouldn't be used in new code. In particular please don't be
5677 // mislead to pass the returned value to cogl_texture_get_data() for
5678 // the rowstride, since you should be passing the rowstride you desire
5679 // for your destination buffer not the rowstride of the source
5680 // texture.</note>
5682 // multiplied by the texture's width
5684 // also no known need for API either. It was just
5685 // a mistake that it was ever published.
5686 // RETURNS: The bytes-per-pixel for the current format
5687 uint get_rowstride()() {
5688 return cogl_texture_get_rowstride(&this);
5691 // Queries the width of a cogl texture.
5692 // RETURNS: the width of the GPU side texture in pixels
5693 uint get_width()() {
5694 return cogl_texture_get_width(&this);
5697 // Queries if a texture is sliced (stored as multiple GPU side tecture
5698 // objects).
5700 // is stored as a single GPU texture
5701 // RETURNS: %TRUE if the texture is sliced, %FALSE if the texture
5702 int is_sliced()() {
5703 return cogl_texture_is_sliced(&this);
5706 // Unintrospectable method: new_from_sub_texture() / cogl_texture_new_from_sub_texture()
5707 // VERSION: 1.2
5708 // Creates a new texture which represents a subregion of another
5709 // texture. The GL resources will be shared so that no new texture
5710 // data is actually allocated.
5712 // Sub textures have undefined behaviour texture coordinates outside
5713 // of the range [0,1] are used. They also do not work with
5714 // CoglVertexBuffers.
5716 // The sub texture will keep a reference to the full texture so you do
5717 // not need to keep one separately if you only want to use the sub
5718 // texture.
5719 // RETURNS: A newly created #CoglTexture or %NULL on failure
5720 // <sub_x>: X coordinate of the top-left of the subregion
5721 // <sub_y>: Y coordinate of the top-left of the subregion
5722 // <sub_width>: Width in pixels of the subregion
5723 // <sub_height>: Height in pixels of the subregion
5724 Texture* new_from_sub_texture()(int sub_x, int sub_y, int sub_width, int sub_height) {
5725 return cogl_texture_new_from_sub_texture(&this, sub_x, sub_y, sub_width, sub_height);
5728 // Sets the pixels in a rectangular subregion of @texture from an in-memory
5729 // buffer containing pixel data.
5731 // <note>The region set can't be larger than the source @data</note>
5733 // %FALSE otherwise
5734 // RETURNS: %TRUE if the subregion upload was successful, and
5735 // <src_x>: upper left coordinate to use from source data.
5736 // <src_y>: upper left coordinate to use from source data.
5737 // <dst_x>: upper left destination horizontal coordinate.
5738 // <dst_y>: upper left destination vertical coordinate.
5739 // <dst_width>: width of destination region to write. (Must be less than or equal to @width)
5740 // <dst_height>: height of destination region to write. (Must be less than or equal to @height)
5741 // <width>: width of source data buffer.
5742 // <height>: height of source data buffer.
5743 // <format>: the #CoglPixelFormat used in the source buffer.
5744 // <rowstride>: rowstride of source buffer (computed from width if none specified)
5745 // <data>: the actual pixel data.
5746 int set_region()(int src_x, int src_y, int dst_x, int dst_y, uint dst_width, uint dst_height, int width, int height, PixelFormat format, uint rowstride, ubyte* data) {
5747 return cogl_texture_set_region(&this, src_x, src_y, dst_x, dst_y, dst_width, dst_height, width, height, format, rowstride, data);
5749 int set_region_from_bitmap_EXP()(int src_x, int src_y, int dst_x, int dst_y, uint dst_width, uint dst_height, Bitmap* bitmap) {
5750 return cogl_texture_set_region_from_bitmap_EXP(&this, src_x, src_y, dst_x, dst_y, dst_width, dst_height, bitmap);
5752 // Unintrospectable function: 2d_new_from_data_EXP() / cogl_texture_2d_new_from_data_EXP()
5753 static Texture2D* _2d_new_from_data_EXP()(Cogl.Context* ctx, int width, int height, PixelFormat format, PixelFormat internal_format, int rowstride, ubyte* data, GLib2.Error** error=null) {
5754 return cogl_texture_2d_new_from_data_EXP(ctx, width, height, format, internal_format, rowstride, data, error);
5756 // Unintrospectable function: 2d_new_from_foreign_EXP() / cogl_texture_2d_new_from_foreign_EXP()
5757 static Texture2D* _2d_new_from_foreign_EXP()(Cogl.Context* ctx, uint gl_handle, int width, int height, PixelFormat format, GLib2.Error** error=null) {
5758 return cogl_texture_2d_new_from_foreign_EXP(ctx, gl_handle, width, height, format, error);
5760 // Unintrospectable function: 2d_new_with_size_EXP() / cogl_texture_2d_new_with_size_EXP()
5761 static Texture2D* _2d_new_with_size_EXP()(Cogl.Context* ctx, int width, int height, PixelFormat internal_format, GLib2.Error** error=null) {
5762 return cogl_texture_2d_new_with_size_EXP(ctx, width, height, internal_format, error);
5765 // Unintrospectable function: 2d_sliced_new_with_size() / cogl_texture_2d_sliced_new_with_size()
5766 // VERSION: 1.10
5767 // Creates a #CoglTexture2DSliced that may internally be comprised of
5768 // 1 or more #CoglTexture2D textures with power-of-two sizes.
5769 // @max_waste is used as a threshold for recursively slicing the
5770 // right-most or bottom-most slices into smaller power-of-two sizes
5771 // until the wasted padding at the bottom and right of the
5772 // power-of-two textures is less than specified.
5774 // an error allocating any of the internal slices %NULL is
5775 // returned and @error is updated.
5776 // RETURNS: A newly allocated #CoglTexture2DSliced or if there was
5777 // <ctx>: A #CoglContext
5778 // <width>: The virtual width of your sliced texture.
5779 // <height>: The virtual height of your sliced texture.
5780 // <max_waste>: The threshold of how wide a strip of wasted texels are allowed in the non-power-of-two textures before they must be sliced to reduce the amount of waste.
5781 // <internal_format>: The format of the texture
5782 static Texture2DSliced* _2d_sliced_new_with_size()(Cogl.Context* ctx, uint width, uint height, int max_waste, PixelFormat internal_format, GLib2.Error** error=null) {
5783 return cogl_texture_2d_sliced_new_with_size(ctx, width, height, max_waste, internal_format, error);
5785 // Unintrospectable function: 3d_new_from_data_EXP() / cogl_texture_3d_new_from_data_EXP()
5786 static Handle _3d_new_from_data_EXP()(uint width, uint height, uint depth, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, uint image_stride, ubyte* data, GLib2.Error** error=null) {
5787 return cogl_texture_3d_new_from_data_EXP(width, height, depth, flags, format, internal_format, rowstride, image_stride, data, error);
5789 // Unintrospectable function: 3d_new_with_size_EXP() / cogl_texture_3d_new_with_size_EXP()
5790 static Handle _3d_new_with_size_EXP()(uint width, uint height, uint depth, TextureFlags flags, PixelFormat internal_format, GLib2.Error** error=null) {
5791 return cogl_texture_3d_new_with_size_EXP(width, height, depth, flags, internal_format, error);
5794 // Unintrospectable function: new_from_bitmap() / cogl_texture_new_from_bitmap()
5795 // VERSION: 1.0
5796 // Creates a #CoglTexture from a #CoglBitmap.
5797 // RETURNS: A newly created #CoglTexture or %NULL on failure
5798 // <bitmap>: A #CoglBitmap pointer
5799 // <flags>: Optional flags for the texture, or %COGL_TEXTURE_NONE
5800 // <internal_format>: the #CoglPixelFormat to use for the GPU storage of the texture
5801 static Texture* new_from_bitmap()(Bitmap* bitmap, TextureFlags flags, PixelFormat internal_format) {
5802 return cogl_texture_new_from_bitmap(bitmap, flags, internal_format);
5804 // Unintrospectable function: new_from_buffer_EXP() / cogl_texture_new_from_buffer_EXP()
5805 static Texture* new_from_buffer_EXP()(PixelBuffer* buffer, uint width, uint height, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, uint offset) {
5806 return cogl_texture_new_from_buffer_EXP(buffer, width, height, flags, format, internal_format, rowstride, offset);
5809 // Unintrospectable function: new_from_data() / cogl_texture_new_from_data()
5810 // VERSION: 0.8
5811 // Creates a new #CoglTexture based on data residing in memory.
5812 // RETURNS: A newly created #CoglTexture or %NULL on failure
5813 // <width>: width of texture in pixels
5814 // <height>: height of texture in pixels
5815 // <flags>: Optional flags for the texture, or %COGL_TEXTURE_NONE
5816 // <format>: the #CoglPixelFormat the buffer is stored in in RAM
5817 // <internal_format>: the #CoglPixelFormat that will be used for storing the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a premultiplied format similar to the format of the source data will be used. The default blending equations of Cogl expect premultiplied color data; the main use of passing a non-premultiplied format here is if you have non-premultiplied source data and are going to adjust the blend mode (see cogl_material_set_blend()) or use the data for something other than straight blending.
5818 // <rowstride>: the memory offset in bytes between the starts of scanlines in @data
5819 // <data>: pointer the memory region where the source buffer resides
5820 static Texture* new_from_data()(uint width, uint height, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, ubyte* data) {
5821 return cogl_texture_new_from_data(width, height, flags, format, internal_format, rowstride, data);
5824 // Unintrospectable function: new_from_file() / cogl_texture_new_from_file()
5825 // VERSION: 0.8
5826 // Creates a #CoglTexture from an image file.
5827 // RETURNS: A newly created #CoglTexture or %NULL on failure
5828 // <filename>: the file to load
5829 // <flags>: Optional flags for the texture, or %COGL_TEXTURE_NONE
5830 // <internal_format>: the #CoglPixelFormat to use for the GPU storage of the texture. If %COGL_PIXEL_FORMAT_ANY is given then a premultiplied format similar to the format of the source data will be used. The default blending equations of Cogl expect premultiplied color data; the main use of passing a non-premultiplied format here is if you have non-premultiplied source data and are going to adjust the blend mode (see cogl_material_set_blend()) or use the data for something other than straight blending.
5831 static Texture* new_from_file()(char* filename, TextureFlags flags, PixelFormat internal_format, GLib2.Error** error=null) {
5832 return cogl_texture_new_from_file(filename, flags, internal_format, error);
5835 // Unintrospectable function: new_from_foreign() / cogl_texture_new_from_foreign()
5836 // VERSION: 0.8
5837 // Creates a #CoglTexture based on an existing OpenGL texture; the
5838 // width, height and format are passed along since it is not always
5839 // possible to query these from OpenGL.
5841 // The waste arguments allow you to create a Cogl texture that maps to
5842 // a region smaller than the real OpenGL texture. For instance if your
5843 // hardware only supports power-of-two textures you may load a
5844 // non-power-of-two image into a larger power-of-two texture and use
5845 // the waste arguments to tell Cogl which region should be mapped to
5846 // the texture coordinate range [0:1].
5847 // RETURNS: A newly created #CoglTexture or %NULL on failure
5848 // <gl_handle>: opengl handle of foreign texture.
5849 // <gl_target>: opengl target type of foreign texture
5850 // <width>: width of foreign texture
5851 // <height>: height of foreign texture.
5852 // <x_pot_waste>: horizontal waste on the right hand edge of the texture.
5853 // <y_pot_waste>: vertical waste on the bottom edge of the texture.
5854 // <format>: format of the foreign texture.
5855 static Texture* new_from_foreign()(GL.uint_ gl_handle, GL.enum_ gl_target, GL.uint_ width, GL.uint_ height, GL.uint_ x_pot_waste, GL.uint_ y_pot_waste, PixelFormat format) {
5856 return cogl_texture_new_from_foreign(gl_handle, gl_target, width, height, x_pot_waste, y_pot_waste, format);
5859 // Unintrospectable function: new_with_size() / cogl_texture_new_with_size()
5860 // VERSION: 0.8
5861 // Creates a new #CoglTexture with the specified dimensions and pixel format.
5862 // RETURNS: A newly created #CoglTexture or %NULL on failure
5863 // <width>: width of texture in pixels.
5864 // <height>: height of texture in pixels.
5865 // <flags>: Optional flags for the texture, or %COGL_TEXTURE_NONE
5866 // <internal_format>: the #CoglPixelFormat to use for the GPU storage of the texture.
5867 static Texture* new_with_size()(uint width, uint height, TextureFlags flags, PixelFormat internal_format) {
5868 return cogl_texture_new_with_size(width, height, flags, internal_format);
5871 // Unintrospectable function: ref() / cogl_texture_ref()
5872 // DEPRECATED (v1.2) function: ref - Use cogl_object_ref() instead
5873 // Increment the reference count for a cogl texture.
5874 // RETURNS: the @texture pointer.
5875 // <texture>: a #CoglTexture.
5876 static void* ref_()(void* texture) {
5877 return cogl_texture_ref(texture);
5880 // DEPRECATED (v1.2) function: unref - Use cogl_object_unref() instead
5881 // Decrement the reference count for a cogl texture.
5882 // <texture>: a #CoglTexture.
5883 static void unref()(void* texture) {
5884 cogl_texture_unref(texture);
5888 struct Texture2D {
5891 struct Texture2DSliced {
5894 // Error codes that can be thrown when allocating textures.
5895 enum TextureError /* Version 2.0 */ {
5896 SIZE = 0,
5897 FORMAT = 1,
5898 BAD_PARAMETER = 2,
5899 TYPE = 3
5901 // Flags to pass to the cogl_texture_new_* family of functions.
5902 enum TextureFlags /* Version 1.0 */ {
5903 NONE = 0,
5904 NO_AUTO_MIPMAP = 1,
5905 NO_SLICING = 2,
5906 NO_ATLAS = 4
5908 struct TextureRectangle {
5909 // Unintrospectable function: new_with_size_EXP() / cogl_texture_rectangle_new_with_size_EXP()
5910 static TextureRectangle* new_with_size_EXP()(Cogl.Context* ctx, int width, int height, PixelFormat internal_format, GLib2.Error** error=null) {
5911 return cogl_texture_rectangle_new_with_size_EXP(ctx, width, height, internal_format, error);
5915 // Used to specify vertex information when calling cogl_polygon()
5916 struct TextureVertex {
5917 float x, y, z, tx, ty;
5918 Color color;
5921 enum int UNORDERED_MASK = 15;
5922 enum int UNPREMULT_MASK = 127;
5924 // VERSION: 1.4
5925 // When associating private data with a #CoglObject a callback can be
5926 // given which will be called either if the object is destroyed or if
5927 // cogl_object_set_user_data() is called with NULL user_data for the
5928 // same key.
5929 // <user_data>: The data whos association with a #CoglObject has been destoyed.
5930 extern (C) alias void function (void* user_data) UserDataDestroyCallback;
5933 // A #CoglUserDataKey is used to declare a key for attaching data to a
5934 // #CoglObject using cogl_object_set_user_data. The typedef only exists as a
5935 // formality to make code self documenting since only the unique address of a
5936 // #CoglUserDataKey is used.
5938 // Typically you would declare a static #CoglUserDataKey and set private data
5939 // on an object something like this:
5941 // |[
5942 // static CoglUserDataKey path_private_key;
5944 // static void
5945 // destroy_path_private_cb (void *data)
5946 // {
5947 // g_free (data);
5948 // }
5950 // static void
5951 // my_path_set_data (CoglPath *path, void *data)
5952 // {
5953 // cogl_object_set_user_data (COGL_OBJECT (path),
5954 // &private_key,
5955 // data,
5956 // destroy_path_private_cb);
5957 // }
5958 // ]|
5959 struct UserDataKey /* Version 1.4 */ {
5960 int unused;
5964 // A convenience vertex definition that can be used with
5965 // cogl_primitive_new_with_v2_attributes().
5966 struct VertexP2 /* Version 1.6 */ {
5967 float x, y;
5971 // A convenience vertex definition that can be used with
5972 // cogl_primitive_new_with_v2c4_attributes().
5973 struct VertexP2C4 /* Version 1.6 */ {
5974 float x, y;
5975 ubyte r, g, b, a;
5979 // A convenience vertex definition that can be used with
5980 // cogl_primitive_new_with_v2t2_attributes().
5981 struct VertexP2T2 /* Version 1.6 */ {
5982 float x, y, s, t;
5986 // A convenience vertex definition that can be used with
5987 // cogl_primitive_new_with_v3t2c4_attributes().
5988 struct VertexP2T2C4 /* Version 1.6 */ {
5989 float x, y, s, t;
5990 ubyte r, g, b, a;
5994 // A convenience vertex definition that can be used with
5995 // cogl_primitive_new_with_v3_attributes().
5996 struct VertexP3 /* Version 1.6 */ {
5997 float x, y, z;
6001 // A convenience vertex definition that can be used with
6002 // cogl_primitive_new_with_v3c4_attributes().
6003 struct VertexP3C4 /* Version 1.6 */ {
6004 float x, y, z;
6005 ubyte r, g, b, a;
6009 // A convenience vertex definition that can be used with
6010 // cogl_primitive_new_with_v3t2_attributes().
6011 struct VertexP3T2 /* Version 1.6 */ {
6012 float x, y, z, s, t;
6016 // A convenience vertex definition that can be used with
6017 // cogl_primitive_new_with_v3t2c4_attributes().
6018 struct VertexP3T2C4 /* Version 1.6 */ {
6019 float x, y, z, s, t;
6020 ubyte r, g, b, a;
6023 // Different ways of interpreting vertices when drawing.
6024 enum VerticesMode /* Version 1.0 */ {
6025 POINTS = 0,
6026 LINES = 1,
6027 LINE_LOOP = 2,
6028 LINE_STRIP = 3,
6029 TRIANGLES = 4,
6030 TRIANGLE_STRIP = 5,
6031 TRIANGLE_FAN = 6
6034 // Enum used to represent the two directions of rotation. This can be
6035 // used to set the front face for culling by calling
6036 // cogl_pipeline_set_front_face_winding().
6037 enum Winding {
6038 CLOCKWISE = 0,
6039 COUNTER_CLOCKWISE = 1
6041 enum WinsysFeature {
6042 MULTIPLE_ONSCREEN = 0,
6043 SWAP_THROTTLE = 1,
6044 VBLANK_COUNTER = 2,
6045 VBLANK_WAIT = 3,
6046 TEXTURE_FROM_PIXMAP = 4,
6047 SWAP_BUFFERS_EVENT = 5,
6048 SWAP_REGION = 6,
6049 SWAP_REGION_THROTTLE = 7,
6050 SWAP_REGION_SYNCHRONIZED = 8,
6051 N_FEATURES = 9
6054 // Identifies specific window system backends that Cogl supports.
6056 // These can be used to query what backend Cogl is using or to try and
6057 // explicitly select a backend to use.
6058 enum WinsysID {
6059 ANY = 0,
6060 STUB = 1,
6061 GLX = 2,
6062 EGL_XLIB = 3,
6063 EGL_NULL = 4,
6064 EGL_GDL = 5,
6065 EGL_WAYLAND = 6,
6066 EGL_KMS = 7,
6067 EGL_ANDROID = 8,
6068 WGL = 9,
6069 SDL = 10
6071 // Unintrospectable callback: XlibFilterFunc() / ()
6072 extern (C) alias FilterReturn function (XEvent* event, void* data) XlibFilterFunc;
6074 struct _ColorSizeCheck {
6075 char[/*GIR: -1*/ 0] compile_time_assert_CoglColor_size;
6078 struct _EulerSizeCheck {
6079 char[/*GIR: -1*/ 0] compile_time_assert_CoglEuler_size;
6082 struct _MatrixSizeCheck {
6083 char[/*GIR: -1*/ 0] compile_time_assert_CoglMatrix_size;
6086 struct _QuaternionSizeCheck {
6087 char[/*GIR: -1*/ 0] compile_time_assert_CoglQuaternion_size;
6090 struct _TextureVertexSizeCheck {
6091 char[/*GIR: -1*/ 0] compile_time_assert_CoglTextureVertex_size;
6095 // Unintrospectable function: angle_cos() / cogl_angle_cos()
6096 // VERSION: 1.0
6097 // Computes the cosine of @angle
6098 // RETURNS: the cosine of the passed angle
6099 // <angle>: an angle expressed using #CoglAngle
6100 static Fixed angle_cos()(Angle angle) {
6101 return cogl_angle_cos(angle);
6105 // Unintrospectable function: angle_sin() / cogl_angle_sin()
6106 // VERSION: 1.0
6107 // Computes the sine of @angle
6108 // RETURNS: the sine of the passed angle
6109 // <angle>: an angle expressed using #CoglAngle
6110 static Fixed angle_sin()(Angle angle) {
6111 return cogl_angle_sin(angle);
6115 // Unintrospectable function: angle_tan() / cogl_angle_tan()
6116 // VERSION: 1.0
6117 // Computes the tangent of @angle
6118 // RETURNS: the tangent of the passed angle
6119 // <angle>: an angle expressed using #CoglAngle
6120 static Fixed angle_tan()(Angle angle) {
6121 return cogl_angle_tan(angle);
6125 // VERSION: 1.0
6126 // We do not advise nor reliably support the interleaving of raw GL drawing and
6127 // Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl()
6128 // provide a simple mechanism that may at least give you a fighting chance of
6129 // succeeding.
6131 // Note: this doesn't help you modify the behaviour of Cogl drawing functions
6132 // through the modification of GL state; that will never be reliably supported,
6133 // but if you are trying to do something like:
6135 // |[
6136 // {
6137 // - setup some OpenGL state.
6138 // - draw using OpenGL (e.g. glDrawArrays() )
6139 // - reset modified OpenGL state.
6140 // - continue using Cogl to draw
6141 // }
6142 // ]|
6144 // You should surround blocks of drawing using raw GL with cogl_begin_gl()
6145 // and cogl_end_gl():
6147 // |[
6148 // {
6149 // cogl_begin_gl ();
6150 // - setup some OpenGL state.
6151 // - draw using OpenGL (e.g. glDrawArrays() )
6152 // - reset modified OpenGL state.
6153 // cogl_end_gl ();
6154 // - continue using Cogl to draw
6155 // }
6156 // ]|
6158 // Don't ever try and do:
6160 // |[
6161 // {
6162 // - setup some OpenGL state.
6163 // - use Cogl to draw
6164 // - reset modified OpenGL state.
6165 // }
6166 // ]|
6168 // When the internals of Cogl evolves, this is very liable to break.
6170 // This function will flush all batched primitives, and subsequently flush
6171 // all internal Cogl state to OpenGL as if it were going to draw something
6172 // itself.
6174 // The result is that the OpenGL modelview matrix will be setup; the state
6175 // corresponding to the current source material will be set up and other world
6176 // state such as backface culling, depth and fogging enabledness will be sent
6177 // to OpenGL.
6179 // <note>No special material state is flushed, so if you want Cogl to setup a
6180 // simplified material state it is your responsibility to set a simple source
6181 // material before calling cogl_begin_gl(). E.g. by calling
6182 // cogl_set_source_color4ub().</note>
6184 // <note>It is your responsibility to restore any OpenGL state that you modify
6185 // to how it was after calling cogl_begin_gl() if you don't do this then the
6186 // result of further Cogl calls is undefined.</note>
6188 // <note>You can not nest begin/end blocks.</note>
6190 // Again we would like to stress, we do not advise the use of this API and if
6191 // possible we would prefer to improve Cogl than have developers require raw
6192 // OpenGL.
6193 static void begin_gl()() {
6194 cogl_begin_gl();
6197 // MOVED TO: BitmapError.quark
6198 static GLib2.Quark bitmap_error_quark()() {
6199 return cogl_bitmap_error_quark();
6203 // VERSION: 1.0
6204 // MOVED TO: Bitmap.get_size_from_file
6205 // Parses an image file enough to extract the width and height
6206 // of the bitmap.
6207 // RETURNS: %TRUE if the image was successfully parsed
6208 // <filename>: the file to check
6209 // <width>: return location for the bitmap width, or %NULL
6210 // <height>: return location for the bitmap height, or %NULL
6211 static int bitmap_get_size_from_file()(char* filename, /*out*/ int* width, /*out*/ int* height) {
6212 return cogl_bitmap_get_size_from_file(filename, width, height);
6215 // MOVED TO: BlendStringError.quark
6216 static GLib2.Quark blend_string_error_quark()() {
6217 return cogl_blend_string_error_quark();
6221 // DEPRECATED (v1.2) function: check_extension - OpenGL is an implementation detail for Cogl and so it's
6222 // Check whether @name occurs in list of extensions in @ext.
6225 // not appropriate to expose OpenGL extensions through the Cogl API. This
6226 // function can be replaced by the following equivalent code:
6227 // |[
6228 // gboolean retval = (strstr (ext, name) != NULL) ? TRUE : FALSE;
6229 // ]|
6230 // RETURNS: %TRUE if the extension occurs in the list, %FALSE otherwise.
6231 // <name>: extension to check for
6232 // <ext>: list of extensions
6233 static int check_extension()(char* name, char* ext) {
6234 return cogl_check_extension(name, ext);
6238 // Clears all the auxiliary buffers identified in the @buffers mask, and if
6239 // that includes the color buffer then the specified @color is used.
6240 // <color>: Background color to clear to
6241 // <buffers>: A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary buffers to clear
6242 static void clear()(Color* color, c_ulong buffers) {
6243 cogl_clear(color, buffers);
6247 // VERSION: 1.0
6248 // DEPRECATED (v1.2) function: clip_ensure - Calling this function has no effect
6249 // Ensures that the current clipping region has been set in GL. This
6250 // will automatically be called before any Cogl primitives but it
6251 // maybe be neccessary to call if you are using raw GL calls with
6252 // clipping.
6253 static void clip_ensure()() {
6254 cogl_clip_ensure();
6258 // Reverts the clipping region to the state before the last call to
6259 // cogl_clip_push().
6260 static void clip_pop()() {
6261 cogl_clip_pop();
6265 // DEPRECATED (v1.2) function: clip_push - The x, y, width, height arguments are inconsistent
6266 // Specifies a rectangular clipping area for all subsequent drawing
6267 // operations. Any drawing commands that extend outside the rectangle
6268 // will be clipped so that only the portion inside the rectangle will
6269 // be displayed. The rectangle dimensions are transformed by the
6270 // current model-view matrix.
6272 // The rectangle is intersected with the current clip region. To undo
6273 // the effect of this function, call cogl_clip_pop().
6275 // with other API that specify rectangles in model space, and when used
6276 // with a coordinate space that puts the origin at the center and y+
6277 // extending up, it's awkward to use. Please use cogl_clip_push_rectangle()
6278 // instead
6279 // <x_offset>: left edge of the clip rectangle
6280 // <y_offset>: top edge of the clip rectangle
6281 // <width>: width of the clip rectangle
6282 // <height>: height of the clip rectangle
6283 static void clip_push()(float x_offset, float y_offset, float width, float height) {
6284 cogl_clip_push(x_offset, y_offset, width, height);
6288 // VERSION: 1.8
6289 // Sets a new clipping area using the silhouette of the specified,
6290 // filled @path. The clipping area is intersected with the previous
6291 // clipping area. To restore the previous clipping area, call
6292 // call cogl_clip_pop().
6293 static void clip_push_from_path()() {
6294 cogl_clip_push_from_path();
6298 // VERSION: 1.0
6299 // Sets a new clipping area using the current path. The current path
6300 // is then cleared. The clipping area is intersected with the previous
6301 // clipping area. To restore the previous clipping area, call
6302 // cogl_clip_pop().
6303 static void clip_push_from_path_preserve()() {
6304 cogl_clip_push_from_path_preserve();
6308 // VERSION: 1.10
6309 // Sets a new clipping area using a 2D shaped described with a
6310 // #CoglPrimitive. The shape must not contain self overlapping
6311 // geometry and must lie on a single 2D plane. A bounding box of the
6312 // 2D shape in local coordinates (the same coordinates used to
6313 // describe the shape) must be given. It is acceptable for the bounds
6314 // to be larger than the true bounds but behaviour is undefined if the
6315 // bounds are smaller than the true bounds.
6317 // The primitive is transformed by the current model-view matrix and
6318 // the silhouette is intersected with the previous clipping area. To
6319 // restore the previous clipping area, call
6320 // cogl_clip_pop().
6321 // <primitive>: A #CoglPrimitive describing a flat 2D shape
6322 // <bounds_x1>: y coordinate for the bottom-right corner of the primitives bounds.
6323 // <bounds_y1>: y coordinate for the top-left corner of the primitives bounds
6324 // <bounds_x2>: x coordinate for the top-left corner of the primitives bounds
6325 // <bounds_y2>: x coordinate for the bottom-right corner of the primitives bounds.
6326 static void clip_push_primitive()(Primitive* primitive, float bounds_x1, float bounds_y1, float bounds_x2, float bounds_y2) {
6327 cogl_clip_push_primitive(primitive, bounds_x1, bounds_y1, bounds_x2, bounds_y2);
6331 // VERSION: 1.2
6332 // Specifies a rectangular clipping area for all subsequent drawing
6333 // operations. Any drawing commands that extend outside the rectangle
6334 // will be clipped so that only the portion inside the rectangle will
6335 // be displayed. The rectangle dimensions are transformed by the
6336 // current model-view matrix.
6338 // The rectangle is intersected with the current clip region. To undo
6339 // the effect of this function, call cogl_clip_pop().
6340 // <x0>: x coordinate for top left corner of the clip rectangle
6341 // <y0>: y coordinate for top left corner of the clip rectangle
6342 // <x1>: x coordinate for bottom right corner of the clip rectangle
6343 // <y1>: y coordinate for bottom right corner of the clip rectangle
6344 static void clip_push_rectangle()(float x0, float y0, float x1, float y1) {
6345 cogl_clip_push_rectangle(x0, y0, x1, y1);
6349 // DEPRECATED (v1.2) function: clip_push_window_rect - Use cogl_clip_push_window_rectangle() instead
6350 // Specifies a rectangular clipping area for all subsequent drawing
6351 // operations. Any drawing commands that extend outside the rectangle
6352 // will be clipped so that only the portion inside the rectangle will
6353 // be displayed. The rectangle dimensions are not transformed by the
6354 // current model-view matrix.
6356 // The rectangle is intersected with the current clip region. To undo
6357 // the effect of this function, call cogl_clip_pop().
6358 // <x_offset>: left edge of the clip rectangle in window coordinates
6359 // <y_offset>: top edge of the clip rectangle in window coordinates
6360 // <width>: width of the clip rectangle
6361 // <height>: height of the clip rectangle
6362 static void clip_push_window_rect()(float x_offset, float y_offset, float width, float height) {
6363 cogl_clip_push_window_rect(x_offset, y_offset, width, height);
6367 // VERSION: 1.2
6368 // Specifies a rectangular clipping area for all subsequent drawing
6369 // operations. Any drawing commands that extend outside the rectangle
6370 // will be clipped so that only the portion inside the rectangle will
6371 // be displayed. The rectangle dimensions are not transformed by the
6372 // current model-view matrix.
6374 // The rectangle is intersected with the current clip region. To undo
6375 // the effect of this function, call cogl_clip_pop().
6376 // <x_offset>: left edge of the clip rectangle in window coordinates
6377 // <y_offset>: top edge of the clip rectangle in window coordinates
6378 // <width>: width of the clip rectangle
6379 // <height>: height of the clip rectangle
6380 static void clip_push_window_rectangle()(int x_offset, int y_offset, int width, int height) {
6381 cogl_clip_push_window_rectangle(x_offset, y_offset, width, height);
6385 // VERSION: 0.8.2
6386 // DEPRECATED (v1.2) function: clip_stack_restore - This was originally added to allow us to restore
6387 // Restore the state of the clipping stack that was previously saved
6388 // by cogl_clip_stack_save().
6390 // the clip stack when switching back from an offscreen framebuffer,
6391 // but it's not necessary anymore given that framebuffers now own
6392 // separate clip stacks which will be automatically switched between
6393 // when a new buffer is set. Calling this function has no effect
6394 static void clip_stack_restore()() {
6395 cogl_clip_stack_restore();
6399 // VERSION: 0.8.2
6400 // DEPRECATED (v1.2) function: clip_stack_save - This was originally added to allow us to save the
6401 // Save the entire state of the clipping stack and then clear all
6402 // clipping. The previous state can be returned to with
6403 // cogl_clip_stack_restore(). Each call to cogl_clip_push() after this
6404 // must be matched by a call to cogl_clip_pop() before calling
6405 // cogl_clip_stack_restore().
6407 // clip stack when switching to an offscreen framebuffer, but it's
6408 // not necessary anymore given that framebuffers now own separate
6409 // clip stacks which will be automatically switched between when a
6410 // new buffer is set. Calling this function has no effect
6411 static void clip_stack_save()() {
6412 cogl_clip_stack_save();
6415 static int clutter_check_extension_CLUTTER()(char* name, char* ext) {
6416 return cogl_clutter_check_extension_CLUTTER(name, ext);
6419 static int clutter_winsys_has_feature_CLUTTER()(WinsysFeature feature) {
6420 return cogl_clutter_winsys_has_feature_CLUTTER(feature);
6423 // Unintrospectable function: clutter_winsys_xlib_get_visual_info_CLUTTER() / cogl_clutter_winsys_xlib_get_visual_info_CLUTTER()
6424 static /*CTYPE*/ XVisualInfo* clutter_winsys_xlib_get_visual_info_CLUTTER()() {
6425 return cogl_clutter_winsys_xlib_get_visual_info_CLUTTER();
6429 // VERSION: 1.0
6430 // MOVED TO: Color.equal
6431 // Compares two #CoglColor<!-- -->s and checks if they are the same.
6433 // This function can be passed to g_hash_table_new() as the @key_equal_func
6434 // parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
6435 // RETURNS: %TRUE if the two colors are the same.
6436 // <v1>: a #CoglColor
6437 // <v2>: a #CoglColor
6438 static int color_equal()(const(void)* v1, const(void)* v2) {
6439 return cogl_color_equal(v1, v2);
6443 // Unintrospectable function: create_program() / cogl_create_program()
6444 // Create a new cogl program object that can be used to replace parts of the GL
6445 // rendering pipeline with custom code.
6446 // RETURNS: a new cogl program.
6447 static Handle create_program()() {
6448 return cogl_create_program();
6452 // Unintrospectable function: create_shader() / cogl_create_shader()
6453 // Create a new shader handle, use cogl_shader_source() to set the
6454 // source code to be used on it.
6455 // RETURNS: a new shader handle.
6456 // <shader_type>: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.
6457 static Handle create_shader()(ShaderType shader_type) {
6458 return cogl_create_shader(shader_type);
6461 // Unintrospectable function: debug_object_foreach_type_EXP() / cogl_debug_object_foreach_type_EXP()
6462 static void debug_object_foreach_type_EXP()(DebugObjectForeachTypeCallback func, void* user_data) {
6463 cogl_debug_object_foreach_type_EXP(func, user_data);
6466 static void debug_object_print_instances_EXP()() {
6467 cogl_debug_object_print_instances_EXP();
6471 // This function disables fogging, so primitives drawn afterwards will not be
6472 // blended with any previously set fog color.
6473 static void disable_fog()() {
6474 cogl_disable_fog();
6477 // Unintrospectable function: double_to_fixed() / cogl_double_to_fixed()
6478 static Fixed double_to_fixed()(double value) {
6479 return cogl_double_to_fixed(value);
6482 static int double_to_int()(double value) {
6483 return cogl_double_to_int(value);
6486 static uint double_to_uint()(double value) {
6487 return cogl_double_to_uint(value);
6490 static void draw_attributes()(VerticesMode mode, int first_vertex, int n_vertices, Attribute** attributes, int n_attributes) {
6491 cogl_draw_attributes(mode, first_vertex, n_vertices, attributes, n_attributes);
6494 static void draw_indexed_attributes()(VerticesMode mode, int first_vertex, int n_vertices, Indices* indices, Attribute** attributes, int n_attributes) {
6495 cogl_draw_indexed_attributes(mode, first_vertex, n_vertices, indices, attributes, n_attributes);
6499 // VERSION: 1.0
6500 // This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing
6501 // code using raw OpenGL. Please refer to cogl_begin_gl() for full details.
6502 static void end_gl()() {
6503 cogl_end_gl();
6507 // VERSION: 2.0
6508 // MOVED TO: Euler.equal
6509 // Compares the two given euler angles @v1 and @v1 and it they are
6510 // equal returns %TRUE else %FALSE.
6512 // <note>This function only checks that all three components rotations
6513 // are numerically equal, it does not consider that some rotations
6514 // can be represented with different component rotations</note>
6515 // RETURNS: %TRUE if @v1 and @v2 are equal else %FALSE.
6516 // <v1>: The second euler angle to compare
6517 static int euler_equal()(const(void)* v1, const(void)* v2) {
6518 return cogl_euler_equal(v1, v2);
6522 // Checks whether the given COGL features are available. Multiple
6523 // features can be checked for by or-ing them together with the '|'
6524 // operator. %TRUE is only returned if all of the requested features
6525 // are available.
6526 // RETURNS: %TRUE if the features are available, %FALSE otherwise.
6527 // <features>: A bitmask of features to check for
6528 static int features_available()(FeatureFlags features) {
6529 return cogl_features_available(features);
6533 // VERSION: 1.0
6534 // This function should only need to be called in exceptional circumstances.
6536 // As an optimization Cogl drawing functions may batch up primitives
6537 // internally, so if you are trying to use raw GL outside of Cogl you stand a
6538 // better chance of being successful if you ask Cogl to flush any batched
6539 // geometry before making your state changes.
6541 // It only ensure that the underlying driver is issued all the commands
6542 // necessary to draw the batched primitives. It provides no guarantees about
6543 // when the driver will complete the rendering.
6545 // This provides no guarantees about the GL state upon returning and to avoid
6546 // confusing Cogl you should aim to restore any changes you make before
6547 // resuming use of Cogl.
6549 // If you are making state changes with the intention of affecting Cogl drawing
6550 // primitives you are 100% on your own since you stand a good chance of
6551 // conflicting with Cogl internals. For example clutter-gst which currently
6552 // uses direct GL calls to bind ARBfp programs will very likely break when Cogl
6553 // starts to use ARBfb programs itself for the material API.
6554 static void flush()() {
6555 cogl_flush();
6559 // Unintrospectable function: foreach_feature() / cogl_foreach_feature()
6560 // VERSION: 1.10
6561 // Iterates through all the context level features currently supported
6562 // for a given @context and for each feature @callback is called.
6563 // <context>: A #CoglContext pointer
6564 // <callback>: A #CoglFeatureCallback called for each supported feature
6565 // <user_data>: Private data to pass to the callback
6566 static void foreach_feature()(Cogl.Context* context, FeatureCallback callback, void* user_data) {
6567 cogl_foreach_feature(context, callback, user_data);
6570 // MOVED TO: FramebufferError.quark
6571 static GLib2.Quark framebuffer_error_quark()() {
6572 return cogl_framebuffer_error_quark();
6576 // VERSION: 0.8.2
6577 // Replaces the current projection matrix with a perspective matrix
6578 // for a given viewing frustum defined by 4 side clip planes that
6579 // all cross through the origin and 2 near and far clip planes.
6580 // <left>: X position of the left clipping plane where it intersects the near clipping plane
6581 // <right>: X position of the right clipping plane where it intersects the near clipping plane
6582 // <bottom>: Y position of the bottom clipping plane where it intersects the near clipping plane
6583 // <top>: Y position of the top clipping plane where it intersects the near clipping plane
6584 // <z_near>: The distance to the near clipping plane (Must be positive)
6585 // <z_far>: The distance to the far clipping plane (Must be positive)
6586 static void frustum()(float left, float right, float bottom, float top, float z_near, float z_far) {
6587 cogl_frustum(left, right, bottom, top, z_near, z_far);
6591 // Queries if backface culling has been enabled via
6592 // cogl_set_backface_culling_enabled()
6593 // RETURNS: %TRUE if backface culling is enabled, and %FALSE otherwise
6594 static int get_backface_culling_enabled()() {
6595 return cogl_get_backface_culling_enabled();
6599 // Gets the number of bitplanes used for each of the color components
6600 // in the color buffer. Pass %NULL for any of the arguments if the
6601 // value is not required.
6602 // <red>: Return location for the number of red bits or %NULL
6603 // <green>: Return location for the number of green bits or %NULL
6604 // <blue>: Return location for the number of blue bits or %NULL
6605 // <alpha>: Return location for the number of alpha bits or %NULL
6606 static void get_bitmasks()(/*out*/ int* red, /*out*/ int* green, /*out*/ int* blue, /*out*/ int* alpha) {
6607 cogl_get_bitmasks(red, green, blue, alpha);
6611 // DEPRECATED (v1.4) function: get_depth_test_enabled - Use cogl_material_get_depth_test_enabled()
6612 // Queries if depth testing has been enabled via cogl_set_depth_test_enable()
6615 // instead.
6616 // RETURNS: %TRUE if depth testing is enabled, and %FALSE otherwise
6617 static int get_depth_test_enabled()() {
6618 return cogl_get_depth_test_enabled();
6622 // Unintrospectable function: get_draw_framebuffer() / cogl_get_draw_framebuffer()
6623 // VERSION: 1.8
6624 // Gets the current #CoglFramebuffer as set using
6625 // cogl_push_framebuffer()
6626 // RETURNS: The current #CoglFramebuffer
6627 static Framebuffer* get_draw_framebuffer()() {
6628 return cogl_get_draw_framebuffer();
6632 // VERSION: 0.8
6633 // Returns all of the features supported by COGL.
6634 // RETURNS: A logical OR of all the supported COGL features.
6635 static FeatureFlags get_features()() {
6636 return cogl_get_features();
6640 // Stores the current model-view matrix in @matrix.
6641 // <matrix>: return location for the model-view matrix
6642 static void get_modelview_matrix()(/*out*/ Matrix* matrix) {
6643 cogl_get_modelview_matrix(matrix);
6647 // Unintrospectable function: get_option_group() / cogl_get_option_group()
6648 // VERSION: 1.0
6649 // Retrieves the #GOptionGroup used by COGL to parse the command
6650 // line options. Clutter uses this to handle the COGL command line
6651 // options during its initialization process.
6652 // RETURNS: a #GOptionGroup
6653 static GLib2.OptionGroup* get_option_group()() {
6654 return cogl_get_option_group();
6658 // Unintrospectable function: get_path() / cogl_get_path()
6659 // VERSION: 1.4
6660 // Gets a pointer to the current path. The path can later be used
6661 // again by calling cogl_path_set(). Note that the path isn't copied
6662 // so if you later call any functions to add to the path it will
6663 // affect the returned object too. No reference is taken on the path
6664 // so if you want to retain it you should take your own reference with
6665 // cogl_object_ref().
6666 // RETURNS: a pointer to the current path.
6667 static Path* get_path()() {
6668 return cogl_get_path();
6672 // Unintrospectable function: get_proc_address() / cogl_get_proc_address()
6673 // Gets a pointer to a given GL or GL ES extension function. This acts
6674 // as a wrapper around glXGetProcAddress() or whatever is the
6675 // appropriate function for the current backend.
6677 // function is not available.
6678 // RETURNS: a pointer to the requested function or %NULL if the
6679 // <name>: the name of the function.
6680 static FuncPtr get_proc_address()(char* name) {
6681 return cogl_get_proc_address(name);
6685 // Stores the current projection matrix in @matrix.
6686 // <matrix>: return location for the projection matrix
6687 static void get_projection_matrix()(/*out*/ Matrix* matrix) {
6688 cogl_get_projection_matrix(matrix);
6691 // Unintrospectable function: get_rectangle_indices() / cogl_get_rectangle_indices()
6692 static Indices* get_rectangle_indices()(int n_rectangles) {
6693 return cogl_get_rectangle_indices(n_rectangles);
6697 // Unintrospectable function: get_source() / cogl_get_source()
6698 // VERSION: 1.6
6699 // Returns the current source material as previously set using
6700 // cogl_set_source().
6702 // <note>You should typically consider the returned material immutable
6703 // and not try to change any of its properties unless you own a
6704 // reference to that material. At times you may be able to get a
6705 // reference to an internally managed materials and the result of
6706 // modifying such materials is undefined.</note>
6707 // RETURNS: The current source material.
6708 static void* get_source()() {
6709 return cogl_get_source();
6713 // VERSION: 2.0
6714 // Returns a pointer to a singleton quaternion constant describing the
6715 // canonical identity [1 (0, 0, 0)] which represents no rotation.
6717 // If you multiply a quaternion with the identity quaternion you will
6718 // get back the same value as the original quaternion.
6719 // RETURNS: A pointer to an identity quaternion
6720 static Quaternion* get_static_identity_quaternion()() {
6721 return cogl_get_static_identity_quaternion();
6725 // VERSION: 2.0
6726 // rotation of 180 degrees around a degenerate axis:
6727 // [0 (0, 0, 0)]
6728 // RETURNS: a pointer to a singleton quaternion constant describing a
6729 static Quaternion* get_static_zero_quaternion()() {
6730 return cogl_get_static_zero_quaternion();
6734 // Stores the current viewport in @v. @v[0] and @v[1] get the x and y
6735 // position of the viewport and @v[2] and @v[3] get the width and
6736 // height.
6737 // <v>: pointer to a 4 element array of #float<!-- -->s to receive the viewport dimensions.
6738 static void get_viewport()(/*out*/ float v) {
6739 cogl_get_viewport(v);
6743 // VERSION: 1.10
6744 // Creates a #GSource which handles Cogl's internal system event
6745 // processing. This can be used as a convenience instead of
6746 // cogl_poll_get_info() and cogl_poll_dispatch() in applications that
6747 // are already using the GLib main loop. After this is called the
6748 // #GSource should be attached to the main loop using
6749 // g_source_attach().
6750 // RETURNS: a new #GSource
6751 // <context>: A #CoglContext
6752 // <priority>: The priority of the #GSource
6753 static GLib2.Source* /*new*/ glib_source_new()(Cogl.Context* context, int priority) {
6754 return cogl_glib_source_new(context, priority);
6757 static Type handle_get_type()() {
6758 return cogl_handle_get_type();
6762 // Increases the reference count of @handle by 1
6763 // RETURNS: the handle, with its reference count increased
6764 // <handle>: a #CoglHandle
6765 static Handle handle_ref()(Handle handle) {
6766 return cogl_handle_ref(handle);
6770 // Drecreases the reference count of @handle by 1; if the reference
6771 // count reaches 0, the resources allocated by @handle will be freed
6772 // <handle>: a #CoglHandle
6773 static void handle_unref()(Handle handle) {
6774 cogl_handle_unref(handle);
6778 // VERSION: 1.10
6779 // Checks if a given @feature is currently available
6781 // Cogl does not aim to be a lowest common denominator API, it aims to
6782 // expose all the interesting features of GPUs to application which
6783 // means applications have some responsibility to explicitly check
6784 // that certain features are available before depending on them.
6786 // not.
6787 // RETURNS: %TRUE if the @feature is currently supported or %FALSE if
6788 // <context>: A #CoglContext pointer
6789 // <feature>: A #CoglFeatureID
6790 static int has_feature()(Cogl.Context* context, FeatureID feature) {
6791 return cogl_has_feature(context, feature);
6795 // Unintrospectable function: has_features() / cogl_has_features()
6796 // VERSION: 1.10
6797 // Checks if a list of features are all currently available.
6799 // This checks all of the listed features using cogl_has_feature() and
6800 // returns %TRUE if all the features are available or %FALSE
6801 // otherwise.
6803 // otherwise.
6804 // RETURNS: %TRUE if all the features are available, %FALSE
6805 // <context>: A #CoglContext pointer
6806 alias cogl_has_features has_features; // Variadic
6808 static IndicesType indices_get_type()(Indices* indices) {
6809 return cogl_indices_get_type(indices);
6813 // Gets whether the given object references a #CoglAttribute.
6815 // %FALSE otherwise
6816 // RETURNS: %TRUE if the handle references a #CoglAttribute,
6817 // <object>: A #CoglObject
6818 static int is_attribute()(void* object) {
6819 return cogl_is_attribute(object);
6823 // VERSION: 1.4
6824 // Gets whether the given object references a #CoglAttributeBuffer.
6826 // %FALSE otherwise
6827 // RETURNS: %TRUE if the handle references a #CoglAttributeBuffer,
6828 // <object>: A #CoglObject
6829 static int is_attribute_buffer()(void* object) {
6830 return cogl_is_attribute_buffer(object);
6834 // VERSION: 1.0
6835 // Checks whether @handle is a #CoglHandle for a bitmap
6837 // and %FALSE otherwise
6838 // RETURNS: %TRUE if the passed handle represents a bitmap,
6839 // <handle>: a #CoglHandle for a bitmap
6840 static int is_bitmap()(Handle handle) {
6841 return cogl_is_bitmap(handle);
6845 // VERSION: 1.2
6846 // Checks whether @buffer is a buffer object.
6847 // RETURNS: %TRUE if the handle is a CoglBuffer, and %FALSE otherwise
6848 static int is_buffer()(void* object) {
6849 return cogl_is_buffer(object);
6853 // VERSION: 1.10
6854 // Gets whether the given object references an existing context object.
6856 // %FALSE otherwise
6857 // RETURNS: %TRUE if the handle references a #CoglContext,
6858 // <object>: An object or %NULL
6859 static int is_context()(void* object) {
6860 return cogl_is_context(object);
6864 // VERSION: 1.4
6865 // Gets whether the given object references a #CoglIndexBuffer.
6867 // %FALSE otherwise
6868 // RETURNS: %TRUE if the handle references a #CoglIndexBuffer,
6869 // <object>: A #CoglObject
6870 static int is_index_buffer()(void* object) {
6871 return cogl_is_index_buffer(object);
6875 // Gets whether the given handle references an existing material object.
6877 // %FALSE otherwise
6878 // RETURNS: %TRUE if the handle references a #CoglMaterial,
6879 // <handle>: A CoglHandle
6880 static int is_material()(Handle handle) {
6881 return cogl_is_material(handle);
6885 // Determines whether the given #CoglHandle references an offscreen buffer
6886 // object.
6888 // %FALSE otherwise
6889 // RETURNS: %TRUE if the handle references an offscreen buffer,
6890 // <handle>: A CoglHandle for an offscreen buffer
6891 static int is_offscreen()(Handle handle) {
6892 return cogl_is_offscreen(handle);
6896 // VERSION: 2.0
6897 // Gets whether the given object references an existing path object.
6899 // %FALSE otherwise.
6900 // RETURNS: %TRUE if the object references a #CoglPath,
6901 static int is_path()(Handle handle) {
6902 return cogl_is_path(handle);
6906 // VERSION: 2.0
6907 // Gets whether the given handle references an existing pipeline object.
6909 // %FALSE otherwise
6910 // RETURNS: %TRUE if the handle references a #CoglPipeline,
6911 // <handle>: A CoglHandle
6912 static int is_pipeline()(Handle handle) {
6913 return cogl_is_pipeline(handle);
6916 static int is_pixel_buffer_EXP()(void* object) {
6917 return cogl_is_pixel_buffer_EXP(object);
6921 // VERSION: 1.6
6922 // Gets whether the given object references a #CoglPrimitive.
6924 // %FALSE otherwise
6925 // RETURNS: %TRUE if the handle references a #CoglPrimitive,
6926 // <object>: A #CoglObject
6927 static int is_primitive()(void* object) {
6928 return cogl_is_primitive(object);
6932 // Gets whether the given handle references an existing program object.
6934 // %FALSE otherwise
6935 // RETURNS: %TRUE if the handle references a program,
6936 // <handle>: A CoglHandle
6937 static int is_program()(Handle handle) {
6938 return cogl_is_program(handle);
6942 // VERSION: 1.10
6943 // Determines if the given @object is a #CoglRenderer
6944 // RETURNS: %TRUE if @object is a #CoglRenderer, else %FALSE.
6945 // <object>: A #CoglObject pointer
6946 static int is_renderer()(void* object) {
6947 return cogl_is_renderer(object);
6951 // Gets whether the given handle references an existing shader object.
6953 // %FALSE otherwise
6954 // RETURNS: %TRUE if the handle references a shader,
6955 // <handle>: A CoglHandle
6956 static int is_shader()(Handle handle) {
6957 return cogl_is_shader(handle);
6961 // VERSION: 1.10
6962 // Gets whether the given handle references an existing snippet object.
6964 // %FALSE otherwise
6965 // RETURNS: %TRUE if the handle references a #CoglSnippet,
6966 static int is_snippet()(void* object) {
6967 return cogl_is_snippet(object);
6970 static int is_sub_texture_EXP()(void* object) {
6971 return cogl_is_sub_texture_EXP(object);
6975 // Gets whether the given object references a texture object.
6977 // %FALSE otherwise
6978 // RETURNS: %TRUE if the handle references a texture, and
6979 // <object>: A #CoglObject pointer
6980 static int is_texture()(void* object) {
6981 return cogl_is_texture(object);
6984 static int is_texture_2d_EXP()(void* object) {
6985 return cogl_is_texture_2d_EXP(object);
6988 static int is_texture_3d_EXP()(Handle handle) {
6989 return cogl_is_texture_3d_EXP(handle);
6992 static int is_texture_rectangle_EXP()(void* object) {
6993 return cogl_is_texture_rectangle_EXP(object);
6997 // VERSION: 1.0
6998 // Checks whether @handle is a Vertex Buffer Object
7000 // otherwise
7001 // RETURNS: %TRUE if the handle is a VBO, and %FALSE
7002 // <handle>: a #CoglHandle for a vertex buffer object
7003 static int is_vertex_buffer()(Handle handle) {
7004 return cogl_is_vertex_buffer(handle);
7008 // VERSION: 1.4
7009 // Checks whether @handle is a handle to the indices for a vertex
7010 // buffer object
7012 // otherwise
7013 // RETURNS: %TRUE if the handle is indices, and %FALSE
7014 // <handle>: a #CoglHandle
7015 static int is_vertex_buffer_indices()(Handle handle) {
7016 return cogl_is_vertex_buffer_indices(handle);
7020 // Retrieves the type of the layer
7022 // Currently there is only one type of layer defined:
7023 // %COGL_MATERIAL_LAYER_TYPE_TEXTURE, but considering we may add purely GLSL
7024 // based layers in the future, you should write code that checks the type
7025 // first.
7026 // RETURNS: the type of the layer
7027 // <layer>: A #CoglMaterialLayer object
7028 static MaterialLayerType material_layer_get_type()(MaterialLayer* layer) {
7029 return cogl_material_layer_get_type(layer);
7033 // VERSION: 1.0
7034 // DEPRECATED (v1.2) function: material_unref - Use cogl_object_unref() instead
7035 // MOVED TO: Material.unref
7036 // Decrement the reference count for a #CoglMaterial.
7037 // <material>: a #CoglMaterial object.
7038 static void material_unref()(Handle material) {
7039 cogl_material_unref(material);
7043 // VERSION: 1.4
7044 // MOVED TO: Matrix.equal
7045 // Compares two matrices to see if they represent the same
7046 // transformation. Although internally the matrices may have different
7047 // annotations associated with them and may potentially have a cached
7048 // inverse matrix these are not considered in the comparison.
7049 // <v1>: A 4x4 transformation matrix
7050 // <v2>: A 4x4 transformation matrix
7051 static int matrix_equal()(const(void)* v1, const(void)* v2) {
7052 return cogl_matrix_equal(v1, v2);
7056 // Unintrospectable function: object_ref() / cogl_object_ref()
7057 // MOVED TO: Object.ref
7058 // Increases the reference count of @handle by 1
7059 // RETURNS: the @object, with its reference count increased
7060 // <object>: a #CoglObject
7061 static void* object_ref()(void* object) {
7062 return cogl_object_ref(object);
7066 // Unintrospectable function: object_unref() / cogl_object_unref()
7067 // MOVED TO: Object.unref
7068 // Drecreases the reference count of @object by 1; if the reference
7069 // count reaches 0, the resources allocated by @object will be freed
7070 // <object>: a #CoglObject
7071 static void object_unref()(void* object) {
7072 cogl_object_unref(object);
7076 // This creates an offscreen buffer object using the given @texture as the
7077 // primary color buffer. It doesn't just initialize the contents of the
7078 // offscreen buffer with the @texture; they are tightly bound so that
7079 // drawing to the offscreen buffer effectivly updates the contents of the
7080 // given texture. You don't need to destroy the offscreen buffer before
7081 // you can use the @texture again.
7083 // Note: This does not work with sliced Cogl textures.
7085 // buffer or %COGL_INVALID_HANDLE if it wasn't possible to create the
7086 // buffer.
7087 // RETURNS: a #CoglHandle for the new offscreen
7088 // <texture>: A #CoglTexture pointer
7089 static Handle /*new*/ offscreen_new_to_texture()(Texture* texture) {
7090 return cogl_offscreen_new_to_texture(texture);
7094 // DEPRECATED (v1.2) function: offscreen_ref - cogl_handle_ref() should be used in new code.
7095 // Increments the reference count on the offscreen buffer.
7096 // RETURNS: For convenience it returns the given CoglHandle
7097 // <handle>: A CoglHandle for an offscreen buffer
7098 static Handle offscreen_ref()(Handle handle) {
7099 return cogl_offscreen_ref(handle);
7103 // DEPRECATED (v1.2) function: offscreen_unref - cogl_handle_unref() should be used in new code.
7104 // Decreases the reference count for the offscreen buffer and frees it when
7105 // the count reaches 0.
7106 // <handle>: A CoglHandle for an offscreen buffer
7107 static void offscreen_unref()(Handle handle) {
7108 cogl_offscreen_unref(handle);
7111 // MOVED TO: Onscreen.clutter_backend_set_size_CLUTTER
7112 static void onscreen_clutter_backend_set_size_CLUTTER()(int width, int height) {
7113 cogl_onscreen_clutter_backend_set_size_CLUTTER(width, height);
7117 // VERSION: 1.0
7118 // Replaces the current projection matrix with an orthographic projection
7119 // matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is
7120 // calculated.
7122 // <figure id="cogl-ortho-matrix">
7123 // <title></title>
7124 // <graphic fileref="cogl_ortho.png" format="PNG"/>
7125 // </figure>
7127 // <note>This function copies the arguments from OpenGL's glOrtho() even
7128 // though they are unnecessarily confusing due to the z near and z far
7129 // arguments actually being a "distance" from the origin, where
7130 // negative values are behind the viewer, instead of coordinates for
7131 // the z clipping planes which would have been consistent with the
7132 // left, right bottom and top arguments.</note>
7133 // <left>: The coordinate for the left clipping plane
7134 // <right>: The coordinate for the right clipping plane
7135 // <bottom>: The coordinate for the bottom clipping plane
7136 // <top>: The coordinate for the top clipping plane
7137 // <near>: The <emphasis>distance</emphasis> to the near clipping plane (negative if the plane is behind the viewer)
7138 // <far>: The <emphasis>distance</emphasis> for the far clipping plane (negative if the plane is behind the viewer)
7139 static void ortho()(float left, float right, float bottom, float top, float near, float far) {
7140 cogl_ortho(left, right, bottom, top, near, far);
7144 // VERSION: 2.0
7145 // MOVED TO: Path.arc
7146 // Adds an elliptical arc segment to the current path. A straight line
7147 // segment will link the current pen location with the first vertex
7148 // of the arc. If you perform a move_to to the arcs start just before
7149 // drawing it you create a free standing arc.
7151 // The angles are measured in degrees where 0° is in the direction of
7152 // the positive X axis and 90° is in the direction of the positive Y
7153 // axis. The angle of the arc begins at @angle_1 and heads towards
7154 // @angle_2 (so if @angle_2 is less than @angle_1 it will decrease,
7155 // otherwise it will increase).
7156 // <center_x>: X coordinate of the elliptical arc center
7157 // <center_y>: Y coordinate of the elliptical arc center
7158 // <radius_x>: X radius of the elliptical arc
7159 // <radius_y>: Y radius of the elliptical arc
7160 // <angle_1>: Angle in degrees at which the arc begin
7161 // <angle_2>: Angle in degrees at which the arc ends
7162 static void path_arc()(float center_x, float center_y, float radius_x, float radius_y, float angle_1, float angle_2) {
7163 cogl_path_arc(center_x, center_y, radius_x, radius_y, angle_1, angle_2);
7167 // VERSION: 2.0
7168 // MOVED TO: Path.close
7169 // Closes the path being constructed by adding a straight line segment
7170 // to it that ends at the first vertex of the path.
7171 static void path_close()() {
7172 cogl_path_close();
7176 // VERSION: 2.0
7177 // MOVED TO: Path.curve_to
7178 // Adds a cubic bezier curve segment to the current path with the given
7179 // second, third and fourth control points and using current pen location
7180 // as the first control point.
7181 // <x_1>: X coordinate of the second bezier control point
7182 // <y_1>: Y coordinate of the second bezier control point
7183 // <x_2>: X coordinate of the third bezier control point
7184 // <y_2>: Y coordinate of the third bezier control point
7185 // <x_3>: X coordinate of the fourth bezier control point
7186 // <y_3>: Y coordinate of the fourth bezier control point
7187 static void path_curve_to()(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3) {
7188 cogl_path_curve_to(x_1, y_1, x_2, y_2, x_3, y_3);
7192 // VERSION: 2.0
7193 // MOVED TO: Path.ellipse
7194 // Constructs an ellipse shape. If there is an existing path this will
7195 // start a new disjoint sub-path.
7196 // <center_x>: X coordinate of the ellipse center
7197 // <center_y>: Y coordinate of the ellipse center
7198 // <radius_x>: X radius of the ellipse
7199 // <radius_y>: Y radius of the ellipse
7200 static void path_ellipse()(float center_x, float center_y, float radius_x, float radius_y) {
7201 cogl_path_ellipse(center_x, center_y, radius_x, radius_y);
7205 // VERSION: 2.0
7206 // MOVED TO: Path.fill
7207 // Fills the interior of the constructed shape using the current
7208 // drawing color.
7210 // The interior of the shape is determined using the fill rule of the
7211 // path. See %CoglPathFillRule for details.
7213 // <note>The result of referencing sliced textures in your current
7214 // pipeline when filling a path are undefined. You should pass
7215 // the %COGL_TEXTURE_NO_SLICING flag when loading any texture you will
7216 // use while filling a path.</note>
7217 static void path_fill()() {
7218 cogl_path_fill();
7222 // VERSION: 1.0
7223 // MOVED TO: Path.fill_preserve
7224 // Fills the interior of the constructed shape using the current
7225 // drawing color and preserves the path to be used again. See
7226 // cogl_path_fill() for a description what is considered the interior
7227 // of the shape.
7228 static void path_fill_preserve()() {
7229 cogl_path_fill_preserve();
7233 // VERSION: 2.0
7234 // MOVED TO: Path.get_fill_rule
7235 // Retrieves the fill rule set using cogl_path_set_fill_rule().
7236 // RETURNS: the fill rule that is used for the current path.
7237 static PathFillRule path_get_fill_rule()() {
7238 return cogl_path_get_fill_rule();
7242 // VERSION: 2.0
7243 // MOVED TO: Path.line
7244 // Constructs a straight line shape starting and ending at the given
7245 // coordinates. If there is an existing path this will start a new
7246 // disjoint sub-path.
7247 // <x_1>: X coordinate of the start line vertex
7248 // <y_1>: Y coordinate of the start line vertex
7249 // <x_2>: X coordinate of the end line vertex
7250 // <y_2>: Y coordinate of the end line vertex
7251 static void path_line()(float x_1, float y_1, float x_2, float y_2) {
7252 cogl_path_line(x_1, y_1, x_2, y_2);
7256 // VERSION: 2.0
7257 // MOVED TO: Path.line_to
7258 // Adds a straight line segment to the current path that ends at the
7259 // given coordinates.
7260 // <x>: X coordinate of the end line vertex
7261 // <y>: Y coordinate of the end line vertex
7262 static void path_line_to()(float x, float y) {
7263 cogl_path_line_to(x, y);
7267 // VERSION: 2.0
7268 // MOVED TO: Path.move_to
7269 // Moves the pen to the given location. If there is an existing path
7270 // this will start a new disjoint subpath.
7271 // <x>: X coordinate of the pen location to move to.
7272 // <y>: Y coordinate of the pen location to move to.
7273 static void path_move_to()(float x, float y) {
7274 cogl_path_move_to(x, y);
7278 // VERSION: 2.0
7279 // MOVED TO: Path.new
7280 // Creates a new, empty path object. The default fill rule is
7281 // %COGL_PATH_FILL_RULE_EVEN_ODD.
7283 // be freed using cogl_object_unref().
7284 // RETURNS: A pointer to a newly allocated #CoglPath, which can
7285 static void path_new()() {
7286 cogl_path_new();
7290 // VERSION: 2.0
7291 // MOVED TO: Path.polygon
7292 // Constructs a polygonal shape of the given number of vertices. If
7293 // there is an existing path this will start a new disjoint sub-path.
7295 // The coords array must contain 2 * num_points values. The first value
7296 // represents the X coordinate of the first vertex, the second value
7297 // represents the Y coordinate of the first vertex, continuing in the same
7298 // fashion for the rest of the vertices.
7299 // <coords>: A pointer to the first element of an array of fixed-point values that specify the vertex coordinates.
7300 // <num_points>: The total number of vertices.
7301 static void path_polygon()(float* coords, int num_points) {
7302 cogl_path_polygon(coords, num_points);
7306 // VERSION: 2.0
7307 // MOVED TO: Path.polyline
7308 // Constructs a series of straight line segments, starting from the
7309 // first given vertex coordinate. If there is an existing path this
7310 // will start a new disjoint sub-path. Each subsequent segment starts
7311 // where the previous one ended and ends at the next given vertex
7312 // coordinate.
7314 // The coords array must contain 2 * num_points values. The first value
7315 // represents the X coordinate of the first vertex, the second value
7316 // represents the Y coordinate of the first vertex, continuing in the same
7317 // fashion for the rest of the vertices. (num_points - 1) segments will
7318 // be constructed.
7319 // <coords>: A pointer to the first element of an array of fixed-point values that specify the vertex coordinates.
7320 // <num_points>: The total number of vertices.
7321 static void path_polyline()(float* coords, int num_points) {
7322 cogl_path_polyline(coords, num_points);
7326 // VERSION: 2.0
7327 // MOVED TO: Path.rectangle
7328 // Constructs a rectangular shape at the given coordinates. If there
7329 // is an existing path this will start a new disjoint sub-path.
7330 // <x_1>: X coordinate of the top-left corner.
7331 // <y_1>: Y coordinate of the top-left corner.
7332 // <x_2>: X coordinate of the bottom-right corner.
7333 // <y_2>: Y coordinate of the bottom-right corner.
7334 static void path_rectangle()(float x_1, float y_1, float x_2, float y_2) {
7335 cogl_path_rectangle(x_1, y_1, x_2, y_2);
7339 // VERSION: 2.0
7340 // MOVED TO: Path.rel_curve_to
7341 // Adds a cubic bezier curve segment to the current path with the given
7342 // second, third and fourth control points and using current pen location
7343 // as the first control point. The given coordinates are relative to the
7344 // current pen location.
7345 // <x_1>: X coordinate of the second bezier control point
7346 // <y_1>: Y coordinate of the second bezier control point
7347 // <x_2>: X coordinate of the third bezier control point
7348 // <y_2>: Y coordinate of the third bezier control point
7349 // <x_3>: X coordinate of the fourth bezier control point
7350 // <y_3>: Y coordinate of the fourth bezier control point
7351 static void path_rel_curve_to()(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3) {
7352 cogl_path_rel_curve_to(x_1, y_1, x_2, y_2, x_3, y_3);
7356 // VERSION: 2.0
7357 // MOVED TO: Path.rel_line_to
7358 // Adds a straight line segment to the current path that ends at the
7359 // given coordinates relative to the current pen location.
7360 // <x>: X offset from the current pen location of the end line vertex
7361 // <y>: Y offset from the current pen location of the end line vertex
7362 static void path_rel_line_to()(float x, float y) {
7363 cogl_path_rel_line_to(x, y);
7367 // VERSION: 2.0
7368 // MOVED TO: Path.rel_move_to
7369 // Moves the pen to the given offset relative to the current pen
7370 // location. If there is an existing path this will start a new
7371 // disjoint subpath.
7372 // <x>: X offset from the current pen location to move the pen to.
7373 // <y>: Y offset from the current pen location to move the pen to.
7374 static void path_rel_move_to()(float x, float y) {
7375 cogl_path_rel_move_to(x, y);
7379 // VERSION: 2.0
7380 // MOVED TO: Path.round_rectangle
7381 // Constructs a rectangular shape with rounded corners. If there is an
7382 // existing path this will start a new disjoint sub-path.
7383 // <x_1>: X coordinate of the top-left corner.
7384 // <y_1>: Y coordinate of the top-left corner.
7385 // <x_2>: X coordinate of the bottom-right corner.
7386 // <y_2>: Y coordinate of the bottom-right corner.
7387 // <radius>: Radius of the corner arcs.
7388 // <arc_step>: Angle increment resolution for subdivision of the corner arcs.
7389 static void path_round_rectangle()(float x_1, float y_1, float x_2, float y_2, float radius, float arc_step) {
7390 cogl_path_round_rectangle(x_1, y_1, x_2, y_2, radius, arc_step);
7394 // VERSION: 2.0
7395 // MOVED TO: Path.set_fill_rule
7396 // Sets the fill rule of the current path to @fill_rule. This will
7397 // affect how the path is filled when cogl_path_fill() is later
7398 // called. Note that the fill rule state is attached to the path so
7399 // calling cogl_get_path() will preserve the fill rule and calling
7400 // cogl_path_new() will reset the fill rule back to the default.
7401 // <fill_rule>: The new fill rule.
7402 static void path_set_fill_rule()(PathFillRule fill_rule) {
7403 cogl_path_set_fill_rule(fill_rule);
7407 // VERSION: 2.0
7408 // MOVED TO: Path.stroke
7409 // Strokes the constructed shape using the current drawing color and a
7410 // width of 1 pixel (regardless of the current transformation
7411 // matrix).
7412 static void path_stroke()() {
7413 cogl_path_stroke();
7417 // VERSION: 1.0
7418 // MOVED TO: Path.stroke_preserve
7419 // Strokes the constructed shape using the current drawing color and
7420 // preserves the path to be used again.
7421 static void path_stroke_preserve()() {
7422 cogl_path_stroke_preserve();
7426 // Replaces the current projection matrix with a perspective matrix
7427 // based on the provided values.
7429 // <note>You should be careful not to have to great a @z_far / @z_near
7430 // ratio since that will reduce the effectiveness of depth testing
7431 // since there wont be enough precision to identify the depth of
7432 // objects near to each other.</note>
7433 // <fovy>: Vertical field of view angle in degrees.
7434 // <aspect>: The (width over height) aspect ratio for display
7435 // <z_near>: The distance to the near clipping plane (Must be positive)
7436 // <z_far>: The distance to the far clipping plane (Must be positive)
7437 static void perspective()(float fovy, float aspect, float z_near, float z_far) {
7438 cogl_perspective(fovy, aspect, z_near, z_far);
7442 // VERSION: 1.10
7443 // This should be called whenever an application is woken up from
7444 // going idle in its main loop. The @poll_fds array should contain a
7445 // list of file descriptors matched with the events that occurred in
7446 // revents. The events field is ignored. It is safe to pass in extra
7447 // file descriptors that Cogl didn't request from
7448 // cogl_context_begin_idle() or a shorter array missing some file
7449 // descriptors that Cogl requested.
7450 // <context>: A #CoglContext
7451 // <poll_fds>: An array of #CoglPollFD<!-- -->s describing the events that have occurred since the application went idle.
7452 // <n_poll_fds>: The length of the @poll_fds array.
7453 static void poll_dispatch()(Cogl.Context* context, PollFD* poll_fds, int n_poll_fds) {
7454 cogl_poll_dispatch(context, poll_fds, n_poll_fds);
7458 // VERSION: 1.10
7459 // This should be called whenever an application is about to go idle
7460 // so that Cogl has a chance to describe what state it needs to be
7461 // woken up on. The assumption is that the application is using a main
7462 // loop with something like the poll function call on Unix or the GLib
7463 // main loop.
7465 // After the function is called *@poll_fds will contain a pointer to
7466 // an array of #CoglPollFD structs describing the file descriptors
7467 // that Cogl expects. The fd and events members will be updated
7468 // accordingly. After the application has completed its idle it is
7469 // expected to either update the revents members directly in this
7470 // array or to create a copy of the array and update them
7471 // there. Either way it should pass a pointer to either array back to
7472 // Cogl when calling cogl_poll_dispatch().
7474 // When using the %COGL_WINSYS_ID_WGL winsys (where file descriptors
7475 // don't make any sense) or %COGL_WINSYS_ID_SDL (where the event
7476 // handling functions of SDL don't allow blocking on a file
7477 // descriptor) *n_poll_fds is guaranteed to be zero.
7479 // @timeout will contain a maximum amount of time to wait in
7480 // microseconds before the application should wake up or -1 if the
7481 // application should wait indefinitely. This can also be 0 zero if
7482 // Cogl needs to be woken up immediately.
7483 // <context>: A #CoglContext
7484 // <poll_fds>: A return location for a pointer to an array of #CoglPollFD<!-- -->s
7485 // <n_poll_fds>: A return location for the number of entries in *@poll_fds
7486 // <timeout>: A return location for the maximum length of time to wait in microseconds, or -1 to wait indefinitely.
7487 static void poll_get_info()(Cogl.Context* context, PollFD** poll_fds, int* n_poll_fds, long* timeout) {
7488 cogl_poll_get_info(context, poll_fds, n_poll_fds, timeout);
7492 // VERSION: 1.0
7493 // Draws a convex polygon using the current source material to fill / texture
7494 // with according to the texture coordinates passed.
7496 // If @use_color is %TRUE then the color will be changed for each vertex using
7497 // the value specified in the color member of #CoglTextureVertex. This can be
7498 // used for example to make the texture fade out by setting the alpha value of
7499 // the color.
7501 // All of the texture coordinates must be in the range [0,1] and repeating the
7502 // texture is not supported.
7504 // Because of the way this function is implemented it will currently
7505 // only work if either the texture is not sliced or the backend is not
7506 // OpenGL ES and the minifying and magnifying functions are both set
7507 // to COGL_MATERIAL_FILTER_NEAREST.
7508 // <vertices>: An array of #CoglTextureVertex structs
7509 // <n_vertices>: The length of the vertices array
7510 // <use_color>: %TRUE if the color member of #CoglTextureVertex should be used
7511 static void polygon()(TextureVertex* vertices, uint n_vertices, int use_color) {
7512 cogl_polygon(vertices, n_vertices, use_color);
7516 // DEPRECATED (v1.2) function: pop_draw_buffer - The draw buffer API was replaced with a framebuffer API
7517 // Restore cogl_set_draw_buffer() state.
7518 static void pop_draw_buffer()() {
7519 cogl_pop_draw_buffer();
7523 // VERSION: 1.2
7524 // Restores the framebuffer that was previously at the top of the stack.
7525 // All subsequent drawing will be redirected to this framebuffer.
7526 static void pop_framebuffer()() {
7527 cogl_pop_framebuffer();
7530 // Restores the current model-view matrix from the matrix stack.
7531 static void pop_matrix()() {
7532 cogl_pop_matrix();
7536 // VERSION: 1.6
7537 // Removes the material at the top of the source stack. The material
7538 // at the top of this stack defines the GPU state used to process
7539 // later primitives as defined by cogl_set_source().
7540 static void pop_source()() {
7541 cogl_pop_source();
7545 // Attaches a shader to a program object. A program can have multiple
7546 // vertex or fragment shaders but only one of them may provide a
7547 // main() function. It is allowed to use a program with only a vertex
7548 // shader or only a fragment shader.
7549 // <program_handle>: a #CoglHandle for a shdaer program.
7550 // <shader_handle>: a #CoglHandle for a vertex of fragment shader.
7551 static void program_attach_shader()(Handle program_handle, Handle shader_handle) {
7552 cogl_program_attach_shader(program_handle, shader_handle);
7556 // Retrieve the location (offset) of a uniform variable in a shader program,
7557 // a uniform is a variable that is constant for all vertices/fragments for a
7558 // shader object and is possible to modify as an external parameter.
7560 // This uniform can be set using cogl_program_uniform_1f() when the
7561 // program is in use.
7562 // RETURNS: the offset of a uniform in a specified program.
7563 // <handle>: a #CoglHandle for a shader program.
7564 // <uniform_name>: the name of a uniform.
7565 static int program_get_uniform_location()(Handle handle, char* uniform_name) {
7566 return cogl_program_get_uniform_location(handle, uniform_name);
7570 // Links a program making it ready for use. Note that calling this
7571 // function is optional. If it is not called the program will
7572 // automatically be linked the first time it is used.
7573 // <handle>: a #CoglHandle for a shader program.
7574 static void program_link()(Handle handle) {
7575 cogl_program_link(handle);
7579 // Unintrospectable function: program_ref() / cogl_program_ref()
7580 // DEPRECATED (v1.0) function: program_ref - Please use cogl_handle_ref() instead.
7581 // Add an extra reference to a program.
7582 // RETURNS: @handle
7583 // <handle>: A #CoglHandle to a program.
7584 static Handle program_ref()(Handle handle) {
7585 return cogl_program_ref(handle);
7589 // VERSION: 1.4
7590 // Changes the value of a floating point uniform for the given linked
7591 // @program.
7592 // <program>: A #CoglHandle for a linked program
7593 // <uniform_location>: the uniform location retrieved from cogl_program_get_uniform_location().
7594 // <value>: the new value of the uniform.
7595 static void program_set_uniform_1f()(Handle program, int uniform_location, float value) {
7596 cogl_program_set_uniform_1f(program, uniform_location, value);
7600 // VERSION: 1.4
7601 // Changes the value of an integer uniform for the given linked
7602 // @program.
7603 // <program>: A #CoglHandle for a linked program
7604 // <uniform_location>: the uniform location retrieved from cogl_program_get_uniform_location().
7605 // <value>: the new value of the uniform.
7606 static void program_set_uniform_1i()(Handle program, int uniform_location, int value) {
7607 cogl_program_set_uniform_1i(program, uniform_location, value);
7611 // VERSION: 1.4
7612 // Changes the value of a float vector uniform, or uniform array for
7613 // the given linked @program.
7614 // <program>: A #CoglHandle for a linked program
7615 // <uniform_location>: the uniform location retrieved from cogl_program_get_uniform_location().
7616 // <n_components>: The number of components for the uniform. For example with glsl you'd use 3 for a vec3 or 4 for a vec4.
7617 // <count>: For uniform arrays this is the array length otherwise just pass 1
7618 // <value>: the new value of the uniform[s].
7619 static void program_set_uniform_float()(Handle program, int uniform_location, int n_components, int count, float* value) {
7620 cogl_program_set_uniform_float(program, uniform_location, n_components, count, value);
7624 // VERSION: 1.4
7625 // Changes the value of a int vector uniform, or uniform array for
7626 // the given linked @program.
7627 // <program>: A #CoglHandle for a linked program
7628 // <uniform_location>: the uniform location retrieved from cogl_program_get_uniform_location().
7629 // <n_components>: The number of components for the uniform. For example with glsl you'd use 3 for a vec3 or 4 for a vec4.
7630 // <count>: For uniform arrays this is the array length otherwise just pass 1
7631 // <value>: the new value of the uniform[s].
7632 static void program_set_uniform_int()(Handle program, int uniform_location, int n_components, int count, int* value) {
7633 cogl_program_set_uniform_int(program, uniform_location, n_components, count, value);
7637 // VERSION: 1.4
7638 // Changes the value of a matrix uniform, or uniform array in the
7639 // given linked @program.
7640 // <program>: A #CoglHandle for a linked program
7641 // <uniform_location>: the uniform location retrieved from cogl_program_get_uniform_location().
7642 // <dimensions>: The dimensions of the matrix. So for for example pass 2 for a 2x2 matrix or 3 for 3x3.
7643 // <count>: For uniform arrays this is the array length otherwise just pass 1
7644 // <transpose>: Whether to transpose the matrix when setting the uniform.
7645 // <value>: the new value of the uniform.
7646 static void program_set_uniform_matrix()(Handle program, int uniform_location, int dimensions, int count, int transpose, float* value) {
7647 cogl_program_set_uniform_matrix(program, uniform_location, dimensions, count, transpose, value);
7651 // DEPRECATED (v1.4) function: program_uniform_1f - Use cogl_program_set_uniform_1f() instead.
7652 // Changes the value of a floating point uniform in the currently
7653 // used (see cogl_program_use()) shader program.
7654 // <uniform_no>: the uniform to set.
7655 // <value>: the new value of the uniform.
7656 static void program_uniform_1f()(int uniform_no, float value) {
7657 cogl_program_uniform_1f(uniform_no, value);
7661 // DEPRECATED (v1.4) function: program_uniform_1i - Use cogl_program_set_uniform_1i() instead.
7662 // Changes the value of an integer uniform in the currently
7663 // used (see cogl_program_use()) shader program.
7664 // <uniform_no>: the uniform to set.
7665 // <value>: the new value of the uniform.
7666 static void program_uniform_1i()(int uniform_no, int value) {
7667 cogl_program_uniform_1i(uniform_no, value);
7671 // DEPRECATED (v1.4) function: program_uniform_float - Use cogl_program_set_uniform_float() instead.
7672 // Changes the value of a float vector uniform, or uniform array in the
7673 // currently used (see cogl_program_use()) shader program.
7674 // <uniform_no>: the uniform to set.
7675 // <size>: Size of float vector.
7676 // <count>: Size of array of uniforms.
7677 // <value>: the new value of the uniform.
7678 static void program_uniform_float()(int uniform_no, int size, int count, float* value) {
7679 cogl_program_uniform_float(uniform_no, size, count, value);
7683 // Changes the value of a int vector uniform, or uniform array in the
7684 // currently used (see cogl_program_use()) shader program.
7685 // <uniform_no>: the uniform to set.
7686 // <size>: Size of int vector.
7687 // <count>: Size of array of uniforms.
7688 // <value>: the new value of the uniform.
7689 static void program_uniform_int()(int uniform_no, int size, int count, int* value) {
7690 cogl_program_uniform_int(uniform_no, size, count, value);
7694 // Changes the value of a matrix uniform, or uniform array in the
7695 // currently used (see cogl_program_use()) shader program. The @size
7696 // parameter is used to determine the square size of the matrix.
7697 // <uniform_no>: the uniform to set.
7698 // <size>: Size of matrix.
7699 // <count>: Size of array of uniforms.
7700 // <transpose>: Whether to transpose the matrix when setting the uniform.
7701 // <value>: the new value of the uniform.
7702 static void program_uniform_matrix()(int uniform_no, int size, int count, int transpose, float* value) {
7703 cogl_program_uniform_matrix(uniform_no, size, count, transpose, value);
7707 // DEPRECATED (v1.0) function: program_unref - Please use cogl_handle_unref() instead.
7708 // Removes a reference to a program. If it was the last reference the
7709 // program object will be destroyed.
7710 // <handle>: A #CoglHandle to a program.
7711 static void program_unref()(Handle handle) {
7712 cogl_program_unref(handle);
7716 // Activate a specific shader program replacing that part of the GL
7717 // rendering pipeline, if passed in %COGL_INVALID_HANDLE the default
7718 // behavior of GL is reinstated.
7720 // This function affects the global state of the current Cogl
7721 // context. It is much more efficient to attach the shader to a
7722 // specific material used for rendering instead by calling
7723 // cogl_material_set_user_program().
7724 // <handle>: a #CoglHandle for a shader program or %COGL_INVALID_HANDLE.
7725 static void program_use()(Handle handle) {
7726 cogl_program_use(handle);
7730 // DEPRECATED (v1.2) function: push_draw_buffer - The draw buffer API was replaced with a framebuffer API
7731 // Save cogl_set_draw_buffer() state.
7732 static void push_draw_buffer()() {
7733 cogl_push_draw_buffer();
7737 // VERSION: 1.2
7738 // Redirects all subsequent drawing to the specified framebuffer. This can
7739 // either be an offscreen buffer created with cogl_offscreen_new_to_texture ()
7740 // or in the future it may be an onscreen framebuffer too.
7742 // You should understand that a framebuffer owns the following state:
7743 // <itemizedlist>
7744 // <listitem><simpara>The projection matrix</simpara></listitem>
7745 // <listitem><simpara>The modelview matrix stack</simpara></listitem>
7746 // <listitem><simpara>The viewport</simpara></listitem>
7747 // <listitem><simpara>The clip stack</simpara></listitem>
7748 // </itemizedlist>
7749 // So these items will automatically be saved and restored when you
7750 // push and pop between different framebuffers.
7752 // Also remember a newly allocated framebuffer will have an identity matrix for
7753 // the projection and modelview matrices which gives you a coordinate space
7754 // like OpenGL with (-1, -1) corresponding to the top left of the viewport,
7755 // (1, 1) corresponding to the bottom right and +z coming out towards the
7756 // viewer.
7758 // If you want to set up a coordinate space like Clutter does with (0, 0)
7759 // corresponding to the top left and (framebuffer_width, framebuffer_height)
7760 // corresponding to the bottom right you can do so like this:
7762 // |[
7763 // static void
7764 // setup_viewport (unsigned int width,
7765 // unsigned int height,
7766 // float fovy,
7767 // float aspect,
7768 // float z_near,
7769 // float z_far)
7770 // {
7771 // float z_camera;
7772 // CoglMatrix projection_matrix;
7773 // CoglMatrix mv_matrix;
7775 // cogl_set_viewport (0, 0, width, height);
7776 // cogl_perspective (fovy, aspect, z_near, z_far);
7778 // cogl_get_projection_matrix (&amp;projection_matrix);
7779 // z_camera = 0.5 * projection_matrix.xx;
7781 // cogl_matrix_init_identity (&amp;mv_matrix);
7782 // cogl_matrix_translate (&amp;mv_matrix, -0.5f, -0.5f, -z_camera);
7783 // cogl_matrix_scale (&amp;mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
7784 // cogl_matrix_translate (&amp;mv_matrix, 0.0f, -1.0 * height, 0.0f);
7785 // cogl_set_modelview_matrix (&amp;mv_matrix);
7786 // }
7788 // static void
7789 // my_init_framebuffer (ClutterStage *stage,
7790 // CoglFramebuffer *framebuffer,
7791 // unsigned int framebuffer_width,
7792 // unsigned int framebuffer_height)
7793 // {
7794 // ClutterPerspective perspective;
7796 // clutter_stage_get_perspective (stage, &perspective);
7798 // cogl_push_framebuffer (framebuffer);
7799 // setup_viewport (framebuffer_width,
7800 // framebuffer_height,
7801 // perspective.fovy,
7802 // perspective.aspect,
7803 // perspective.z_near,
7804 // perspective.z_far);
7805 // }
7806 // ]|
7808 // The previous framebuffer can be restored by calling cogl_pop_framebuffer()
7809 // <buffer>: A #CoglFramebuffer object, either onscreen or offscreen.
7810 static void push_framebuffer()(Framebuffer* buffer) {
7811 cogl_push_framebuffer(buffer);
7815 // Stores the current model-view matrix on the matrix stack. The matrix
7816 // can later be restored with cogl_pop_matrix().
7817 static void push_matrix()() {
7818 cogl_push_matrix();
7822 // VERSION: 1.6
7823 // Pushes the given @material to the top of the source stack. The
7824 // material at the top of this stack defines the GPU state used to
7825 // process later primitives as defined by cogl_set_source().
7826 // <material>: A #CoglMaterial
7827 static void push_source()(void* material) {
7828 cogl_push_source(material);
7832 // VERSION: 2.0
7833 // MOVED TO: Quaternion.equal
7834 // Compares that all the components of quaternions @a and @b are
7835 // equal.
7837 // An epsilon value is not used to compare the float components, but
7838 // the == operator is at least used so that 0 and -0 are considered
7839 // equal.
7840 // RETURNS: %TRUE if the quaternions are equal else %FALSE.
7841 // <v1>: A #CoglQuaternion
7842 // <v2>: A #CoglQuaternion
7843 static int quaternion_equal()(const(void)* v1, const(void)* v2) {
7844 return cogl_quaternion_equal(v1, v2);
7848 // This reads a rectangle of pixels from the current framebuffer where
7849 // position (0, 0) is the top left. The pixel at (x, y) is the first
7850 // read, and the data is returned with a rowstride of (width * 4).
7852 // Currently Cogl assumes that the framebuffer is in a premultiplied
7853 // format so if @format is non-premultiplied it will convert it. To
7854 // read the pixel values without any conversion you should either
7855 // specify a format that doesn't use an alpha channel or use one of
7856 // the formats ending in PRE.
7857 // <x>: The window x position to start reading from
7858 // <y>: The window y position to start reading from
7859 // <width>: The width of the rectangle you want to read
7860 // <height>: The height of the rectangle you want to read
7861 // <source>: Identifies which auxillary buffer you want to read (only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
7862 // <format>: The pixel format you want the result in (only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)
7863 // <pixels>: The location to write the pixel data.
7864 static void read_pixels()(int x, int y, int width, int height, ReadPixelsFlags source, PixelFormat format, ubyte* pixels) {
7865 cogl_read_pixels(x, y, width, height, source, format, pixels);
7869 // Fills a rectangle at the given coordinates with the current source material
7870 // <x_1>: X coordinate of the top-left corner
7871 // <y_1>: Y coordinate of the top-left corner
7872 // <x_2>: X coordinate of the bottom-right corner
7873 // <y_2>: Y coordinate of the bottom-right corner
7874 static void rectangle()(float x_1, float y_1, float x_2, float y_2) {
7875 cogl_rectangle(x_1, y_1, x_2, y_2);
7879 // VERSION: 1.0
7880 // This function draws a rectangle using the current source material to
7881 // texture or fill with. As a material may contain multiple texture layers
7882 // this interface lets you supply texture coordinates for each layer of the
7883 // material.
7885 // The first pair of coordinates are for the first layer (with the smallest
7886 // layer index) and if you supply less texture coordinates than there are
7887 // layers in the current source material then default texture coordinates
7888 // (0.0, 0.0, 1.0, 1.0) are generated.
7889 // <x1>: x coordinate upper left on screen.
7890 // <y1>: y coordinate upper left on screen.
7891 // <x2>: x coordinate lower right on screen.
7892 // <y2>: y coordinate lower right on screen.
7893 // <tex_coords>: An array containing groups of 4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture coordinates; one for the upper left texel, and one for the lower right texel. Each value should be between 0.0 and 1.0, where the coordinate (0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the bottom right.
7894 // <tex_coords_len>: The length of the tex_coords array. (e.g. for one layer and one group of texture coordinates, this would be 4)
7895 static void rectangle_with_multitexture_coords()(float x1, float y1, float x2, float y2, float* tex_coords, int tex_coords_len) {
7896 cogl_rectangle_with_multitexture_coords(x1, y1, x2, y2, tex_coords, tex_coords_len);
7900 // VERSION: 1.0
7901 // Draw a rectangle using the current material and supply texture coordinates
7902 // to be used for the first texture layer of the material. To draw the entire
7903 // texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
7904 // <x1>: x coordinate upper left on screen.
7905 // <y1>: y coordinate upper left on screen.
7906 // <x2>: x coordinate lower right on screen.
7907 // <y2>: y coordinate lower right on screen.
7908 // <tx1>: x part of texture coordinate to use for upper left pixel
7909 // <ty1>: y part of texture coordinate to use for upper left pixel
7910 // <tx2>: x part of texture coordinate to use for lower right pixel
7911 // <ty2>: y part of texture coordinate to use for left pixel
7912 static void rectangle_with_texture_coords()(float x1, float y1, float x2, float y2, float tx1, float ty1, float tx2, float ty2) {
7913 cogl_rectangle_with_texture_coords(x1, y1, x2, y2, tx1, ty1, tx2, ty2);
7917 // VERSION: 1.0
7918 // Draws a series of rectangles in the same way that
7919 // cogl_rectangle() does. In some situations it can give a
7920 // significant performance boost to use this function rather than
7921 // calling cogl_rectangle() separately for each rectangle.
7923 // @verts should point to an array of #float<!-- -->s with
7924 // @n_rects * 4 elements. Each group of 4 values corresponds to the
7925 // parameters x1, y1, x2, and y2, and have the same
7926 // meaning as in cogl_rectangle().
7927 // <verts>: an array of vertices
7928 // <n_rects>: number of rectangles to draw
7929 static void rectangles()(float* verts, uint n_rects) {
7930 cogl_rectangles(verts, n_rects);
7934 // VERSION: 0.8.6
7935 // Draws a series of rectangles in the same way that
7936 // cogl_rectangle_with_texture_coords() does. In some situations it can give a
7937 // significant performance boost to use this function rather than
7938 // calling cogl_rectangle_with_texture_coords() separately for each rectangle.
7940 // @verts should point to an array of #float<!-- -->s with
7941 // @n_rects * 8 elements. Each group of 8 values corresponds to the
7942 // parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
7943 // meaning as in cogl_rectangle_with_texture_coords().
7944 // <verts>: an array of vertices
7945 // <n_rects>: number of rectangles to draw
7946 static void rectangles_with_texture_coords()(float* verts, uint n_rects) {
7947 cogl_rectangles_with_texture_coords(verts, n_rects);
7950 // MOVED TO: RendererError.quark
7951 static GLib2.Quark renderer_error_quark()() {
7952 return cogl_renderer_error_quark();
7956 // Multiplies the current model-view matrix by one that rotates the
7957 // model around the vertex specified by @x, @y and @z. The rotation
7958 // follows the right-hand thumb rule so for example rotating by 10
7959 // degrees about the vertex (0, 0, 1) causes a small counter-clockwise
7960 // rotation.
7961 // <angle>: Angle in degrees to rotate.
7962 // <x>: X-component of vertex to rotate around.
7963 // <y>: Y-component of vertex to rotate around.
7964 // <z>: Z-component of vertex to rotate around.
7965 static void rotate()(float angle, float x, float y, float z) {
7966 cogl_rotate(angle, x, y, z);
7970 // Multiplies the current model-view matrix by one that scales the x,
7971 // y and z axes by the given values.
7972 // <x>: Amount to scale along the x-axis
7973 // <y>: Amount to scale along the y-axis
7974 // <z>: Amount to scale along the z-axis
7975 static void scale()(float x, float y, float z) {
7976 cogl_scale(x, y, z);
7980 // Sets whether textures positioned so that their backface is showing
7981 // should be hidden. This can be used to efficiently draw two-sided
7982 // textures or fully closed cubes without enabling depth testing. This
7983 // only affects calls to the cogl_rectangle* family of functions and
7984 // cogl_vertex_buffer_draw*. Backface culling is disabled by default.
7985 // <setting>: %TRUE to enable backface culling or %FALSE to disable.
7986 static void set_backface_culling_enabled()(int setting) {
7987 cogl_set_backface_culling_enabled(setting);
7991 // DEPRECATED (v1.4) function: set_depth_test_enabled - Use cogl_material_set_depth_test_enabled()
7992 // Sets whether depth testing is enabled. If it is disabled then the
7993 // order that actors are layered on the screen depends solely on the
7994 // order specified using clutter_actor_raise() and
7995 // clutter_actor_lower(), otherwise it will also take into account the
7996 // actor's depth. Depth testing is disabled by default.
7998 // instead.
7999 // <setting>: %TRUE to enable depth testing or %FALSE to disable.
8000 static void set_depth_test_enabled()(int setting) {
8001 cogl_set_depth_test_enabled(setting);
8005 // DEPRECATED (v1.2) function: set_draw_buffer - The target argument was redundant since we could look at
8006 // Redirects all subsequent drawing to the specified framebuffer. This
8007 // can either be an offscreen buffer created with
8008 // cogl_offscreen_new_to_texture () or you can revert to your original
8009 // on screen window buffer.
8011 // the type of CoglHandle given instead.
8012 // <target>: A #CoglBufferTarget that specifies what kind of framebuffer you are setting as the render target.
8013 // <offscreen>: If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER then this is a CoglHandle for the offscreen buffer.
8014 static void set_draw_buffer()(BufferTarget target, Handle offscreen) {
8015 cogl_set_draw_buffer(target, offscreen);
8019 // Enables fogging. Fogging causes vertices that are further away from the eye
8020 // to be rendered with a different color. The color is determined according to
8021 // the chosen fog mode; at it's simplest the color is linearly interpolated so
8022 // that vertices at @z_near are drawn fully with their original color and
8023 // vertices at @z_far are drawn fully with @fog_color. Fogging will remain
8024 // enabled until you call cogl_disable_fog().
8026 // <note>The fogging functions only work correctly when primitives use
8027 // unmultiplied alpha colors. By default Cogl will premultiply textures
8028 // and cogl_set_source_color() will premultiply colors, so unless you
8029 // explicitly load your textures requesting an unmultiplied internal format
8030 // and use cogl_material_set_color() you can only use fogging with fully
8031 // opaque primitives. This might improve in the future when we can depend
8032 // on fragment shaders.</note>
8033 // <fog_color>: The color of the fog
8034 // <mode>: A #CoglFogMode that determines the equation used to calculate the fogging blend factor.
8035 // <density>: Used by %COGL_FOG_MODE_EXPONENTIAL and by %COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.
8036 // <z_near>: Position along Z axis where no fogging should be applied
8037 // <z_far>: Position along Z axis where full fogging should be applied
8038 static void set_fog()(Color* fog_color, FogMode mode, float density, float z_near, float z_far) {
8039 cogl_set_fog(fog_color, mode, density, z_near, z_far);
8043 // VERSION: 1.2
8044 // This redirects all subsequent drawing to the specified framebuffer. This can
8045 // either be an offscreen buffer created with cogl_offscreen_new_to_texture ()
8046 // or in the future it may be an onscreen framebuffers too.
8047 // <buffer>: A #CoglFramebuffer object, either onscreen or offscreen.
8048 static void set_framebuffer()(Framebuffer* buffer) {
8049 cogl_set_framebuffer(buffer);
8053 // Loads @matrix as the new model-view matrix.
8054 // <matrix>: the new model-view matrix
8055 static void set_modelview_matrix()(Matrix* matrix) {
8056 cogl_set_modelview_matrix(matrix);
8060 // Unintrospectable function: set_path() / cogl_set_path()
8061 // VERSION: 1.4
8062 // Replaces the current path with @path. A reference is taken on the
8063 // object so if you no longer need the path you should unref with
8064 // cogl_object_unref().
8065 // <path>: A #CoglPath object
8066 static void set_path()(Path* path) {
8067 cogl_set_path(path);
8071 // VERSION: 1.10
8072 // Sets @matrix as the new projection matrix.
8073 // <matrix>: the new projection matrix
8074 static void set_projection_matrix()(Matrix* matrix) {
8075 cogl_set_projection_matrix(matrix);
8079 // VERSION: 1.0
8080 // This function changes the material at the top of the source stack.
8081 // The material at the top of this stack defines the GPU state used to
8082 // process subsequent primitives, such as rectangles drawn with
8083 // cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().
8084 // <material>: A #CoglMaterial
8085 static void set_source()(void* material) {
8086 cogl_set_source(material);
8090 // VERSION: 1.0
8091 // This is a convenience function for creating a solid fill source material
8092 // from the given color. This color will be used for any subsequent drawing
8093 // operation.
8095 // The color will be premultiplied by Cogl, so the color should be
8096 // non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for
8097 // semi-transparent red.
8099 // See also cogl_set_source_color4ub() and cogl_set_source_color4f()
8100 // if you already have the color components.
8101 // <color>: a #CoglColor
8102 static void set_source_color()(Color* color) {
8103 cogl_set_source_color(color);
8107 // VERSION: 1.0
8108 // This is a convenience function for creating a solid fill source material
8109 // from the given color using normalized values for each component. This color
8110 // will be used for any subsequent drawing operation.
8112 // The value for each component is a fixed point number in the range
8113 // between 0 and %1.0. If the values passed in are outside that
8114 // range, they will be clamped.
8115 // <red>: value of the red channel, between 0 and %1.0
8116 // <green>: value of the green channel, between 0 and %1.0
8117 // <blue>: value of the blue channel, between 0 and %1.0
8118 // <alpha>: value of the alpha channel, between 0 and %1.0
8119 static void set_source_color4f()(float red, float green, float blue, float alpha) {
8120 cogl_set_source_color4f(red, green, blue, alpha);
8124 // VERSION: 1.0
8125 // This is a convenience function for creating a solid fill source material
8126 // from the given color using unsigned bytes for each component. This
8127 // color will be used for any subsequent drawing operation.
8129 // The value for each component is an unsigned byte in the range
8130 // between 0 and 255.
8131 // <red>: value of the red channel, between 0 and 255
8132 // <green>: value of the green channel, between 0 and 255
8133 // <blue>: value of the blue channel, between 0 and 255
8134 // <alpha>: value of the alpha channel, between 0 and 255
8135 static void set_source_color4ub()(ubyte red, ubyte green, ubyte blue, ubyte alpha) {
8136 cogl_set_source_color4ub(red, green, blue, alpha);
8140 // VERSION: 1.0
8141 // This is a convenience function for creating a material with the first
8142 // layer set to @texture and setting that material as the source with
8143 // cogl_set_source.
8145 // Note: There is no interaction between calls to cogl_set_source_color
8146 // and cogl_set_source_texture. If you need to blend a texture with a color then
8147 // you can create a simple material like this:
8148 // <programlisting>
8149 // material = cogl_material_new ();
8150 // cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
8151 // cogl_material_set_layer (material, 0, tex_handle);
8152 // cogl_set_source (material);
8153 // </programlisting>
8154 // <texture>: The #CoglTexture you want as your source
8155 static void set_source_texture()(Texture* texture) {
8156 cogl_set_source_texture(texture);
8160 // VERSION: 1.2
8161 // Replaces the current viewport with the given values.
8162 // <x>: X offset of the viewport
8163 // <y>: Y offset of the viewport
8164 // <width>: Width of the viewport
8165 // <height>: Height of the viewport
8166 static void set_viewport()(int x, int y, int width, int height) {
8167 cogl_set_viewport(x, y, width, height);
8171 // Compiles the shader, no return value, but the shader is now ready
8172 // for linking into a program. Note that calling this function is
8173 // optional. If it is not called then the shader will be automatically
8174 // compiled when it is linked.
8175 // <handle>: #CoglHandle for a shader.
8176 static void shader_compile()(Handle handle) {
8177 cogl_shader_compile(handle);
8181 // Retrieves the information log for a coglobject, can be used in conjunction
8182 // with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error
8183 // messages that caused a shader to not compile correctly, mainly useful for
8184 // debugging purposes.
8186 // g_free() to free it
8187 // RETURNS: a newly allocated string containing the info log. Use
8188 // <handle>: #CoglHandle for a shader.
8189 static char* /*new*/ shader_get_info_log()(Handle handle) {
8190 return cogl_shader_get_info_log(handle);
8194 // Retrieves the type of a shader #CoglHandle
8196 // or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
8197 // RETURNS: %COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
8198 // <handle>: #CoglHandle for a shader.
8199 static ShaderType shader_get_type()(Handle handle) {
8200 return cogl_shader_get_type(handle);
8204 // Retrieves whether a shader #CoglHandle has been compiled
8205 // RETURNS: %TRUE if the shader object has sucessfully be compiled
8206 // <handle>: #CoglHandle for a shader.
8207 static int shader_is_compiled()(Handle handle) {
8208 return cogl_shader_is_compiled(handle);
8212 // Unintrospectable function: shader_ref() / cogl_shader_ref()
8213 // DEPRECATED (v1.0) function: shader_ref - Please use cogl_handle_ref() instead.
8214 // Add an extra reference to a shader.
8215 // RETURNS: @handle
8216 // <handle>: A #CoglHandle to a shader.
8217 static Handle shader_ref()(Handle handle) {
8218 return cogl_shader_ref(handle);
8222 // Replaces the current source associated with a shader with a new
8223 // one.
8225 // Please see <link
8226 // linkend="cogl-Shaders-and-Programmable-Pipeline.description">above</link>
8227 // for a description of the recommended format for the shader code.
8228 // <shader>: #CoglHandle for a shader.
8229 // <source>: Shader source.
8230 static void shader_source()(Handle shader, char* source) {
8231 cogl_shader_source(shader, source);
8235 // DEPRECATED (v1.0) function: shader_unref - Please use cogl_handle_unref() instead.
8236 // Removes a reference to a shader. If it was the last reference the
8237 // shader object will be destroyed.
8238 // <handle>: A #CoglHandle to a shader.
8239 static void shader_unref()(Handle handle) {
8240 cogl_shader_unref(handle);
8244 // VERSION: 1.0
8245 // Very fast fixed point implementation of square root for integers.
8247 // This function is at least 6x faster than clib sqrt() on x86, and (this is
8248 // not a typo!) about 500x faster on ARM without FPU. It's error is less than
8249 // 5% for arguments smaller than %COGL_SQRTI_ARG_5_PERCENT and less than 10%
8250 // for narguments smaller than %COGL_SQRTI_ARG_10_PERCENT. The maximum
8251 // argument that can be passed to this function is %COGL_SQRTI_ARG_MAX.
8252 // RETURNS: integer square root.
8253 // <x>: integer value
8254 static int sqrti()(int x) {
8255 return cogl_sqrti(x);
8258 // MOVED TO: TextureError.quark
8259 static GLib2.Quark texture_error_quark()() {
8260 return cogl_texture_error_quark();
8264 // DEPRECATED (v1.2) function: texture_unref - Use cogl_object_unref() instead
8265 // MOVED TO: Texture.unref
8266 // Decrement the reference count for a cogl texture.
8267 // <texture>: a #CoglTexture.
8268 static void texture_unref()(void* texture) {
8269 cogl_texture_unref(texture);
8273 // VERSION: 1.4
8274 // Multiplies the current model-view matrix by the given matrix.
8275 // <matrix>: the matrix to multiply with the current model-view
8276 static void transform()(Matrix* matrix) {
8277 cogl_transform(matrix);
8281 // Multiplies the current model-view matrix by one that translates the
8282 // model along all three axes according to the given values.
8283 // <x>: Distance to translate along the x-axis
8284 // <y>: Distance to translate along the y-axis
8285 // <z>: Distance to translate along the z-axis
8286 static void translate()(float x, float y, float z) {
8287 cogl_translate(x, y, z);
8290 // Unintrospectable function: vdraw_attributes() / cogl_vdraw_attributes()
8291 alias cogl_vdraw_attributes vdraw_attributes; // Variadic
8293 // Unintrospectable function: vdraw_indexed_attributes() / cogl_vdraw_indexed_attributes()
8294 alias cogl_vdraw_indexed_attributes vdraw_indexed_attributes; // Variadic
8297 // VERSION: 1.4
8298 // Adds each of the corresponding components in vectors @a and @b
8299 // storing the results in @result.
8300 // <result>: Where you want the result written
8301 // <a>: The first vector operand
8302 // <b>: The second vector operand
8303 static void vector3_add()(float* result, float* a, float* b) {
8304 cogl_vector3_add(result, a, b);
8308 // VERSION: 1.4
8309 // Allocates a new 3 component float vector on the heap initializing
8310 // the components from the given @vector and returns a pointer to the
8311 // newly allocated vector. You should free the memory using
8312 // cogl_vector3_free()
8313 // RETURNS: A newly allocated 3 component float vector
8314 // <vector>: The 3 component vector you want to copy
8315 static float* vector3_copy()(float* vector) {
8316 return cogl_vector3_copy(vector);
8320 // VERSION: 1.4
8321 // Calculates the cross product between the two vectors @u and @v.
8323 // The cross product is a vector perpendicular to both @u and @v. This
8324 // can be useful for calculating the normal of a polygon by creating
8325 // two vectors in its plane using the polygons vertices and taking
8326 // their cross product.
8328 // If the two vectors are parallel then the cross product is 0.
8330 // You can use a right hand rule to determine which direction the
8331 // perpendicular vector will point: If you place the two vectors tail,
8332 // to tail and imagine grabbing the perpendicular line that extends
8333 // through the common tail with your right hand such that you fingers
8334 // rotate in the direction from @u to @v then the resulting vector
8335 // points along your extended thumb.
8336 // RETURNS: The cross product between two vectors @u and @v.
8337 // <result>: Where you want the result written
8338 // <u>: Your first 3 component vector
8339 // <v>: Your second 3 component vector
8340 static void vector3_cross_product()(float* result, float* u, float* v) {
8341 cogl_vector3_cross_product(result, u, v);
8345 // VERSION: 1.4
8346 // If you consider the two given vectors as (x,y,z) points instead
8347 // then this will compute the distance between those two points.
8349 // vectors.
8350 // RETURNS: The distance between two points given as 3 component
8351 // <a>: The first point
8352 // <b>: The second point
8353 static float vector3_distance()(float* a, float* b) {
8354 return cogl_vector3_distance(a, b);
8358 // VERSION: 1.4
8359 // Divides each of the @vector components by the given scalar.
8360 // <vector>: The 3 component vector you want to manipulate
8361 // <scalar>: The scalar you want to divide the vector components by
8362 static void vector3_divide_scalar()(float* vector, float scalar) {
8363 cogl_vector3_divide_scalar(vector, scalar);
8367 // VERSION: 1.4
8368 // Calculates the dot product of the two 3 component vectors. This
8369 // can be used to determine the magnitude of one vector projected onto
8370 // another. (for example a surface normal)
8372 // For example if you have a polygon with a given normal vector and
8373 // some other point for which you want to calculate its distance from
8374 // the polygon, you can create a vector between one of the polygon
8375 // vertices and that point and use the dot product to calculate the
8376 // magnitude for that vector but projected onto the normal of the
8377 // polygon. This way you don't just get the distance from the point to
8378 // the edge of the polygon you get the distance from the point to the
8379 // nearest part of the polygon.
8381 // <note>If you don't use a unit length normal in the above example
8382 // then you would then also have to divide the result by the magnitude
8383 // of the normal</note>
8385 // The dot product is calculated as:
8386 // |[
8387 // (a->x * b->x + a->y * b->y + a->z * b->z)
8388 // ]|
8390 // For reference, the dot product can also be calculated from the
8391 // angle between two vectors as:
8392 // |[
8393 // |a||b|cos𝜃
8394 // ]|
8395 // RETURNS: The dot product of two vectors.
8396 // <a>: Your first 3 component vector
8397 // <b>: Your second 3 component vector
8398 static float vector3_dot_product()(float* a, float* b) {
8399 return cogl_vector3_dot_product(a, b);
8403 // VERSION: 1.4
8404 // Compares the components of two vectors and returns TRUE if they are
8405 // the same.
8407 // The comparison of the components is done with the '==' operator
8408 // such that -0 is considered equal to 0, but otherwise there is no
8409 // fuzziness such as an epsilon to consider vectors that are
8410 // essentially identical except for some minor precision error
8411 // differences due to the way they have been manipulated.
8412 // RETURNS: TRUE if the vectors are equal else FALSE.
8413 // <v1>: The first 3 component vector you want to compare
8414 // <v2>: The second 3 component vector you want to compare
8415 static int vector3_equal()(const(void)* v1, const(void)* v2) {
8416 return cogl_vector3_equal(v1, v2);
8420 // VERSION: 1.4
8421 // Compares the components of two vectors using the given epsilon and
8422 // returns TRUE if they are the same, using an internal epsilon for
8423 // comparing the floats.
8425 // Each component is compared against the epsilon value in this way:
8426 // |[
8427 // if (fabsf (vector0->x - vector1->x) < epsilon)
8428 // ]|
8429 // RETURNS: TRUE if the vectors are equal else FALSE.
8430 // <vector0>: The first 3 component vector you want to compare
8431 // <vector1>: The second 3 component vector you want to compare
8432 // <epsilon>: The allowable difference between components to still be considered equal
8433 static int vector3_equal_with_epsilon()(float* vector0, float* vector1, float epsilon) {
8434 return cogl_vector3_equal_with_epsilon(vector0, vector1, epsilon);
8438 // VERSION: 1.4
8439 // Frees a 3 component vector that was previously allocated with
8440 // cogl_vector_copy()
8441 // <vector>: The 3 component you want to free
8442 static void vector3_free()(float* vector) {
8443 cogl_vector3_free(vector);
8447 // VERSION: 1.4
8448 // Initializes a 3 component, single precision float vector which can
8449 // then be manipulated with the cogl_vector convenience APIs. Vectors
8450 // can also be used in places where a "point" is often desired.
8451 // <vector>: The 3 component vector you want to initialize
8452 // <x>: The x component
8453 // <y>: The y component
8454 // <z>: The z component
8455 static void vector3_init()(float* vector, float x, float y, float z) {
8456 cogl_vector3_init(vector, x, y, z);
8460 // VERSION: 1.4
8461 // Initializes a 3 component, single precision float vector with zero
8462 // for each component.
8463 // <vector>: The 3 component vector you want to initialize
8464 static void vector3_init_zero()(float* vector) {
8465 cogl_vector3_init_zero(vector);
8469 // VERSION: 1.4
8470 // Inverts/negates all the components of the given @vector.
8471 // <vector>: The 3 component vector you want to manipulate
8472 static void vector3_invert()(float* vector) {
8473 cogl_vector3_invert(vector);
8477 // VERSION: 1.4
8478 // Calculates the scalar magnitude or length of @vector.
8479 // RETURNS: The magnitude of @vector.
8480 // <vector>: The 3 component vector you want the magnitude for
8481 static float vector3_magnitude()(float* vector) {
8482 return cogl_vector3_magnitude(vector);
8486 // VERSION: 1.4
8487 // Multiplies each of the @vector components by the given scalar.
8488 // <vector>: The 3 component vector you want to manipulate
8489 // <scalar>: The scalar you want to multiply the vector components by
8490 static void vector3_multiply_scalar()(float* vector, float scalar) {
8491 cogl_vector3_multiply_scalar(vector, scalar);
8495 // VERSION: 1.4
8496 // Updates the vector so it is a "unit vector" such that the
8497 // @vector<!-- -->s magnitude or length is equal to 1.
8498 // <vector>: The 3 component vector you want to manipulate
8499 static void vector3_normalize()(float* vector) {
8500 cogl_vector3_normalize(vector);
8504 // VERSION: 1.4
8505 // Subtracts each of the corresponding components in vector @b from
8506 // @a storing the results in @result.
8507 // <result>: Where you want the result written
8508 // <a>: The first vector operand
8509 // <b>: The second vector operand
8510 static void vector3_subtract()(float* result, float* a, float* b) {
8511 cogl_vector3_subtract(result, a, b);
8515 // Adds an attribute to a buffer, or replaces a previously added
8516 // attribute with the same name.
8518 // You either can use one of the built-in names such as "gl_Vertex", or
8519 // "gl_MultiTexCoord0" to add standard attributes, like positions, colors
8520 // and normals, or you can add custom attributes for use in shaders.
8522 // The number of vertices declared when calling cogl_vertex_buffer_new()
8523 // determines how many attribute values will be read from the supplied
8524 // @pointer.
8526 // The data for your attribute isn't copied anywhere until you call
8527 // cogl_vertex_buffer_submit(), or issue a draw call which automatically
8528 // submits pending attribute changes. so the supplied pointer must remain
8529 // valid until then. If you are updating an existing attribute (done by
8530 // re-adding it) then you still need to re-call cogl_vertex_buffer_submit()
8531 // to commit the changes to the GPU. Be carefull to minimize the number
8532 // of calls to cogl_vertex_buffer_submit(), though.
8534 // <note>If you are interleving attributes it is assumed that each interleaved
8535 // attribute starts no farther than +- stride bytes from the other attributes
8536 // it is interleved with. I.e. this is ok:
8537 // <programlisting>
8538 // |-0-0-0-0-0-0-0-0-0-0|
8539 // </programlisting>
8540 // This is not ok:
8541 // <programlisting>
8542 // |- - - - -0-0-0-0-0-0 0 0 0 0|
8543 // </programlisting>
8544 // (Though you can have multiple groups of interleved attributes)</note>
8545 // <handle>: A vertex buffer handle
8546 // <attribute_name>: The name of your attribute. It should be a valid GLSL variable name and standard attribute types must use one of following built-in names: (Note: they correspond to the built-in names of GLSL) <itemizedlist> <listitem>"gl_Color"</listitem> <listitem>"gl_Normal"</listitem> <listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem> <listitem>"gl_Vertex"</listitem> </itemizedlist> To support adding multiple variations of the same attribute the name can have a detail component, E.g. "gl_Color::active" or "gl_Color::inactive"
8547 // <n_components>: The number of components per attribute and must be 1, 2, 3 or 4
8548 // <type>: a #CoglAttributeType specifying the data type of each component.
8549 // <normalized>: If %TRUE, this specifies that values stored in an integer format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0] for unsigned values. If %FALSE they are converted to floats directly.
8550 // <stride>: This specifies the number of bytes from the start of one attribute value to the start of the next value (for the same attribute). So, for example, with a position interleved with color like this: XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the stride for both attributes is 6. The special value 0 means the values are stored sequentially in memory.
8551 // <pointer>: This addresses the first attribute in the vertex array. This must remain valid until you either call cogl_vertex_buffer_submit() or issue a draw call.
8552 static void vertex_buffer_add()(Handle handle, char* attribute_name, ubyte n_components, AttributeType type, int normalized, ushort stride, void* pointer) {
8553 cogl_vertex_buffer_add(handle, attribute_name, n_components, type, normalized, stride, pointer);
8557 // Deletes an attribute from a buffer. You will need to call
8558 // cogl_vertex_buffer_submit() or issue a draw call to commit this
8559 // change to the GPU.
8560 // <handle>: A vertex buffer handle
8561 // <attribute_name>: The name of a previously added attribute
8562 static void vertex_buffer_delete()(Handle handle, char* attribute_name) {
8563 cogl_vertex_buffer_delete(handle, attribute_name);
8567 // Disables a previosuly added attribute.
8569 // Since it can be costly to add and remove new attributes to buffers; to make
8570 // individual buffers more reuseable it is possible to enable and disable
8571 // attributes before using a buffer for drawing.
8573 // You don't need to call cogl_vertex_buffer_submit() after using this
8574 // function.
8575 // <handle>: A vertex buffer handle
8576 // <attribute_name>: The name of the attribute you want to disable
8577 static void vertex_buffer_disable()(Handle handle, char* attribute_name) {
8578 cogl_vertex_buffer_disable(handle, attribute_name);
8582 // Allows you to draw geometry using all or a subset of the
8583 // vertices in a vertex buffer.
8585 // Any un-submitted attribute changes are automatically submitted before
8586 // drawing.
8587 // <handle>: A vertex buffer handle
8588 // <mode>: A #CoglVerticesMode specifying how the vertices should be interpreted.
8589 // <first>: Specifies the index of the first vertex you want to draw with
8590 // <count>: Specifies the number of vertices you want to draw.
8591 static void vertex_buffer_draw()(Handle handle, VerticesMode mode, int first, int count) {
8592 cogl_vertex_buffer_draw(handle, mode, first, count);
8596 // This function lets you use an array of indices to specify the vertices
8597 // within your vertex buffer that you want to draw. The indices themselves
8598 // are created by calling cogl_vertex_buffer_indices_new ()
8600 // Any un-submitted attribute changes are automatically submitted before
8601 // drawing.
8602 // <handle>: A vertex buffer handle
8603 // <mode>: A #CoglVerticesMode specifying how the vertices should be interpreted.
8604 // <indices>: A CoglHandle for a set of indices allocated via cogl_vertex_buffer_indices_new ()
8605 // <min_index>: Specifies the minimum vertex index contained in indices
8606 // <max_index>: Specifies the maximum vertex index contained in indices
8607 // <indices_offset>: An offset into named indices. The offset marks the first index to use for drawing.
8608 // <count>: Specifies the number of vertices you want to draw.
8609 static void vertex_buffer_draw_elements()(Handle handle, VerticesMode mode, Handle indices, int min_index, int max_index, int indices_offset, int count) {
8610 cogl_vertex_buffer_draw_elements(handle, mode, indices, min_index, max_index, indices_offset, count);
8614 // Enables a previosuly disabled attribute.
8616 // Since it can be costly to add and remove new attributes to buffers; to make
8617 // individual buffers more reuseable it is possible to enable and disable
8618 // attributes before using a buffer for drawing.
8620 // You don't need to call cogl_vertex_buffer_submit() after using this function
8621 // <handle>: A vertex buffer handle
8622 // <attribute_name>: The name of the attribute you want to enable
8623 static void vertex_buffer_enable()(Handle handle, char* attribute_name) {
8624 cogl_vertex_buffer_enable(handle, attribute_name);
8628 // Retrieves the number of vertices that @handle represents
8629 // RETURNS: the number of vertices
8630 // <handle>: A vertex buffer handle
8631 static uint vertex_buffer_get_n_vertices()(Handle handle) {
8632 return cogl_vertex_buffer_get_n_vertices(handle);
8636 // Unintrospectable function: vertex_buffer_indices_get_for_quads() / cogl_vertex_buffer_indices_get_for_quads()
8637 // Creates a vertex buffer containing the indices needed to draw pairs
8638 // of triangles from a list of vertices grouped as quads. There will
8639 // be at least @n_indices entries in the buffer (but there may be
8640 // more).
8642 // The indices will follow this pattern:
8644 // 0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc
8646 // For example, if you submit vertices for a quad like like that shown
8647 // in <xref linkend="quad-indices-order"/> then you can request 6
8648 // indices to render two triangles like those shown in <xref
8649 // linkend="quad-indices-triangles"/>.
8651 // <figure id="quad-indices-order">
8652 // <title>Example of vertices submitted to form a quad</title>
8653 // <graphic fileref="quad-indices-order.png" format="PNG"/>
8654 // </figure>
8656 // <figure id="quad-indices-triangles">
8657 // <title>Illustration of the triangle indices that will be generated</title>
8658 // <graphic fileref="quad-indices-triangles.png" format="PNG"/>
8659 // </figure>
8661 // owned by Cogl and should not be modified or unref'd.
8662 // RETURNS: A %CoglHandle containing the indices. The handled is
8663 // <n_indices>: the number of indices in the vertex buffer.
8664 static Handle vertex_buffer_indices_get_for_quads()(uint n_indices) {
8665 return cogl_vertex_buffer_indices_get_for_quads(n_indices);
8669 // Queries back the data type used for the given indices
8670 // RETURNS: The CoglIndicesType used
8671 // <indices>: An indices handle
8672 static IndicesType vertex_buffer_indices_get_type()(Handle indices) {
8673 return cogl_vertex_buffer_indices_get_type(indices);
8677 // Unintrospectable function: vertex_buffer_indices_new() / cogl_vertex_buffer_indices_new()
8678 // Depending on how much geometry you are submitting it can be worthwhile
8679 // optimizing the number of redundant vertices you submit. Using an index
8680 // array allows you to reference vertices multiple times, for example
8681 // during triangle strips.
8683 // cogl_vertex_buffer_draw_elements().
8684 // RETURNS: A CoglHandle for the indices which you can pass to
8685 // <indices_type>: a #CoglIndicesType specifying the data type used for the indices.
8686 // <indices_array>: Specifies the address of your array of indices
8687 // <indices_len>: The number of indices in indices_array
8688 static Handle vertex_buffer_indices_new()(IndicesType indices_type, void* indices_array, int indices_len) {
8689 return cogl_vertex_buffer_indices_new(indices_type, indices_array, indices_len);
8693 // Unintrospectable function: vertex_buffer_new() / cogl_vertex_buffer_new()
8694 // Creates a new vertex buffer that you can use to add attributes.
8695 // RETURNS: a new #CoglHandle
8696 // <n_vertices>: The number of vertices that your attributes will correspond to.
8697 static Handle vertex_buffer_new()(uint n_vertices) {
8698 return cogl_vertex_buffer_new(n_vertices);
8702 // Unintrospectable function: vertex_buffer_ref() / cogl_vertex_buffer_ref()
8703 // DEPRECATED (v1.2) function: vertex_buffer_ref - Use cogl_handle_ref() instead
8704 // Increment the reference count for a vertex buffer
8705 // RETURNS: the @handle.
8706 // <handle>: a @CoglHandle.
8707 static Handle vertex_buffer_ref()(Handle handle) {
8708 return cogl_vertex_buffer_ref(handle);
8712 // Submits all the user added attributes to the GPU; once submitted, the
8713 // attributes can be used for drawing.
8715 // You should aim to minimize calls to this function since it implies
8716 // validating your data; it potentially incurs a transport cost (especially if
8717 // you are using GLX indirect rendering) and potentially a format conversion
8718 // cost if the GPU doesn't natively support any of the given attribute formats.
8719 // <handle>: A vertex buffer handle
8720 static void vertex_buffer_submit()(Handle handle) {
8721 cogl_vertex_buffer_submit(handle);
8725 // DEPRECATED (v1.2) function: vertex_buffer_unref - Use cogl_handle_unref() instead
8726 // Decrement the reference count for a vertex buffer
8727 // <handle>: a @CoglHandle.
8728 static void vertex_buffer_unref()(Handle handle) {
8729 cogl_vertex_buffer_unref(handle);
8733 // VERSION: 0.8.2
8734 // DEPRECATED (v1.2) function: viewport - Use cogl_set_viewport() instead
8735 // Replace the current viewport with the given values.
8736 // <width>: Width of the viewport
8737 // <height>: Height of the viewport
8738 static void viewport()(uint width, uint height) {
8739 cogl_viewport(width, height);
8742 static uint x11_onscreen_get_visual_xid()(Onscreen* onscreen) {
8743 return cogl_x11_onscreen_get_visual_xid(onscreen);
8747 // VERSION: 1.10
8748 // Assuming you know the given @onscreen framebuffer is based on an x11 window
8749 // this queries the XID of that window. If
8750 // cogl_x11_onscreen_set_foreign_window_xid() was previously called then it
8751 // will return that same XID otherwise it will be the XID of a window Cogl
8752 // created internally. If the window has not been allocated yet and a foreign
8753 // xid has not been set then it's undefined what value will be returned.
8755 // It's undefined what this function does if called when not using an x11 based
8756 // renderer.
8757 // <onscreen>: A #CoglOnscreen framebuffer
8758 static uint x11_onscreen_get_window_xid()(Onscreen* onscreen) {
8759 return cogl_x11_onscreen_get_window_xid(onscreen);
8763 // Unintrospectable function: x11_onscreen_set_foreign_window_xid() / cogl_x11_onscreen_set_foreign_window_xid()
8764 // VERSION: 2.0
8765 // Ideally we would recommend that you let Cogl be responsible for
8766 // creating any X window required to back an onscreen framebuffer but
8767 // if you really need to target a window created manually this
8768 // function can be called before @onscreen has been allocated to set a
8769 // foreign XID for your existing X window.
8771 // Since Cogl needs, for example, to track changes to the size of an X
8772 // window it requires that certain events be selected for via the core
8773 // X protocol. This requirement may also be changed asynchronously so
8774 // you must pass in an @update callback to inform you of Cogl's
8775 // required event mask.
8777 // For example if you are using Xlib you could use this API roughly
8778 // as follows:
8779 // [{
8780 // static void
8781 // my_update_cogl_x11_event_mask (CoglOnscreen *onscreen,
8782 // guint32 event_mask,
8783 // void *user_data)
8784 // {
8785 // XSetWindowAttributes attrs;
8786 // MyData *data = user_data;
8787 // attrs.event_mask = event_mask | data->my_event_mask;
8788 // XChangeWindowAttributes (data->xdpy,
8789 // data->xwin,
8790 // CWEventMask,
8791 // &attrs);
8792 // }
8794 // {
8795 // *snip*
8796 // cogl_x11_onscreen_set_foreign_window_xid (onscreen,
8797 // data->xwin,
8798 // my_update_cogl_x11_event_mask,
8799 // data);
8800 // *snip*
8801 // }
8802 // }]
8803 // <onscreen>: The unallocated framebuffer to associated with an X window.
8804 // <xid>: The XID of an existing X window
8805 // <update>: A callback that notifies of updates to what Cogl requires to be in the core X protocol event mask.
8806 static void x11_onscreen_set_foreign_window_xid()(Onscreen* onscreen, uint xid, OnscreenX11MaskCallback update, void* user_data) {
8807 cogl_x11_onscreen_set_foreign_window_xid(onscreen, xid, update, user_data);
8810 // Unintrospectable function: xlib_renderer_add_filter_EXP() / cogl_xlib_renderer_add_filter_EXP()
8811 static void xlib_renderer_add_filter_EXP()(Cogl.Renderer* renderer, XlibFilterFunc func, void* data) {
8812 cogl_xlib_renderer_add_filter_EXP(renderer, func, data);
8815 // Unintrospectable function: xlib_renderer_get_display_EXP() / cogl_xlib_renderer_get_display_EXP()
8816 static /*CTYPE*/ Display* xlib_renderer_get_display_EXP()(Cogl.Renderer* renderer) {
8817 return cogl_xlib_renderer_get_display_EXP(renderer);
8820 // Unintrospectable function: xlib_renderer_get_foreign_display_EXP() / cogl_xlib_renderer_get_foreign_display_EXP()
8821 static /*CTYPE*/ Display* xlib_renderer_get_foreign_display_EXP()(Cogl.Renderer* renderer) {
8822 return cogl_xlib_renderer_get_foreign_display_EXP(renderer);
8825 // Unintrospectable function: xlib_renderer_handle_event_EXP() / cogl_xlib_renderer_handle_event_EXP()
8826 static FilterReturn xlib_renderer_handle_event_EXP()(Cogl.Renderer* renderer, XEvent* event) {
8827 return cogl_xlib_renderer_handle_event_EXP(renderer, event);
8830 // Unintrospectable function: xlib_renderer_remove_filter_EXP() / cogl_xlib_renderer_remove_filter_EXP()
8831 static void xlib_renderer_remove_filter_EXP()(Cogl.Renderer* renderer, XlibFilterFunc func, void* data) {
8832 cogl_xlib_renderer_remove_filter_EXP(renderer, func, data);
8836 // VERSION: 1.10
8837 // Sets whether Cogl should automatically retrieve events from the X
8838 // display. This defaults to %TRUE unless
8839 // cogl_xlib_renderer_set_foreign_display() is called. It can be set
8840 // to %FALSE if the application wants to handle its own event
8841 // retrieval. Note that Cogl still needs to see all of the X events to
8842 // function properly so the application should call
8843 // cogl_xlib_renderer_handle_event() for each event if it disables
8844 // automatic event retrieval.
8845 // <renderer>: A #CoglRenderer
8846 // <enable>: The new value
8847 static void xlib_renderer_set_event_retrieval_enabled()(Cogl.Renderer* renderer, int enable) {
8848 cogl_xlib_renderer_set_event_retrieval_enabled(renderer, enable);
8851 // Unintrospectable function: xlib_renderer_set_foreign_display_EXP() / cogl_xlib_renderer_set_foreign_display_EXP()
8852 static void xlib_renderer_set_foreign_display_EXP()(Cogl.Renderer* renderer, Display* display) {
8853 cogl_xlib_renderer_set_foreign_display_EXP(renderer, display);
8857 // C prototypes:
8859 extern (C) {
8860 AttributeBuffer* cogl_attribute_get_buffer(Attribute* this_);
8861 int cogl_attribute_get_normalized(Attribute* this_);
8862 void cogl_attribute_set_buffer(Attribute* this_, AttributeBuffer* attribute_buffer);
8863 void cogl_attribute_set_normalized(Attribute* this_, int normalized);
8864 Attribute* cogl_attribute_new(AttributeBuffer* attribute_buffer, char* name, size_t stride, size_t offset, int components, AttributeType type);
8865 AttributeBuffer* cogl_attribute_buffer_new(size_t bytes, void* data);
8866 int cogl_bitmap_get_size_from_file(char* filename, /*out*/ int* width, /*out*/ int* height);
8867 Bitmap* cogl_bitmap_new_from_buffer(Buffer* buffer, PixelFormat format, int width, int height, int rowstride, int offset);
8868 Bitmap* cogl_bitmap_new_from_file(char* filename, GLib2.Error** error);
8869 uint cogl_buffer_get_size(Buffer* this_);
8870 BufferUpdateHint cogl_buffer_get_update_hint(Buffer* this_);
8871 void* cogl_buffer_map(Buffer* this_, BufferAccess access, BufferMapHint hints);
8872 int cogl_buffer_set_data(Buffer* this_, size_t offset, void* data, size_t size);
8873 void cogl_buffer_set_update_hint(Buffer* this_, BufferUpdateHint hint);
8874 void cogl_buffer_unmap(Buffer* this_);
8875 Color* cogl_color_copy(Color* this_);
8876 void cogl_color_free(Color* this_);
8877 float cogl_color_get_alpha(Color* this_);
8878 ubyte cogl_color_get_alpha_byte(Color* this_);
8879 float cogl_color_get_alpha_float(Color* this_);
8880 float cogl_color_get_blue(Color* this_);
8881 ubyte cogl_color_get_blue_byte(Color* this_);
8882 float cogl_color_get_blue_float(Color* this_);
8883 float cogl_color_get_green(Color* this_);
8884 ubyte cogl_color_get_green_byte(Color* this_);
8885 float cogl_color_get_green_float(Color* this_);
8886 float cogl_color_get_red(Color* this_);
8887 ubyte cogl_color_get_red_byte(Color* this_);
8888 float cogl_color_get_red_float(Color* this_);
8889 void cogl_color_init_from_4f(Color* this_, float red, float green, float blue, float alpha);
8890 void cogl_color_init_from_4fv(Color* this_, float* color_array);
8891 void cogl_color_init_from_4ub(Color* this_, ubyte red, ubyte green, ubyte blue, ubyte alpha);
8892 void cogl_color_premultiply(Color* this_);
8893 void cogl_color_set_alpha(Color* this_, float alpha);
8894 void cogl_color_set_alpha_byte(Color* this_, ubyte alpha);
8895 void cogl_color_set_alpha_float(Color* this_, float alpha);
8896 void cogl_color_set_blue(Color* this_, float blue);
8897 void cogl_color_set_blue_byte(Color* this_, ubyte blue);
8898 void cogl_color_set_blue_float(Color* this_, float blue);
8899 void cogl_color_set_from_4f(Color* this_, float red, float green, float blue, float alpha);
8900 void cogl_color_set_from_4ub(Color* this_, ubyte red, ubyte green, ubyte blue, ubyte alpha);
8901 void cogl_color_set_green(Color* this_, float green);
8902 void cogl_color_set_green_byte(Color* this_, ubyte green);
8903 void cogl_color_set_green_float(Color* this_, float green);
8904 void cogl_color_set_red(Color* this_, float red);
8905 void cogl_color_set_red_byte(Color* this_, ubyte red);
8906 void cogl_color_set_red_float(Color* this_, float red);
8907 void cogl_color_unpremultiply(Color* this_);
8908 int cogl_color_equal(const(void)* v1, const(void)* v2);
8909 Color* cogl_color_new();
8910 Cogl.Display* cogl_context_get_display(Context* this_);
8911 Cogl.Context* /*new*/ cogl_context_new(Cogl.Display* display, GLib2.Error** error);
8912 void cogl_depth_state_get_range(DepthState* this_, float* near_val, float* far_val);
8913 int cogl_depth_state_get_test_enabled(DepthState* this_);
8914 DepthTestFunction cogl_depth_state_get_test_function(DepthState* this_);
8915 int cogl_depth_state_get_write_enabled(DepthState* this_);
8916 void cogl_depth_state_init(DepthState* this_);
8917 void cogl_depth_state_set_range(DepthState* this_, float near_val, float far_val);
8918 void cogl_depth_state_set_test_enabled(DepthState* this_, int enable);
8919 void cogl_depth_state_set_test_function(DepthState* this_, DepthTestFunction function_);
8920 void cogl_depth_state_set_write_enabled(DepthState* this_, int enable);
8921 Cogl.Renderer* cogl_display_get_renderer_EXP(Display* this_);
8922 int cogl_display_setup_EXP(Display* this_, GLib2.Error** error);
8923 Cogl.Display* cogl_display_new_EXP(Cogl.Renderer* renderer, OnscreenTemplate* onscreen_template);
8924 Euler* cogl_euler_copy(Euler* this_);
8925 void cogl_euler_free(Euler* this_);
8926 void cogl_euler_init(Euler* this_, float heading, float pitch, float roll);
8927 void cogl_euler_init_from_matrix(Euler* this_, Matrix* matrix);
8928 void cogl_euler_init_from_quaternion(Euler* this_, Quaternion* quaternion);
8929 int cogl_euler_equal(const(void)* v1, const(void)* v2);
8930 Fixed cogl_fixed_log2(uint x);
8931 uint cogl_fixed_pow(uint x, Fixed y);
8932 Fixed cogl_fixed_atan(Fixed* this_);
8933 Fixed cogl_fixed_atan2(Fixed* this_, Fixed b);
8934 Fixed cogl_fixed_cos(Fixed* this_);
8935 Fixed cogl_fixed_div(Fixed* this_, Fixed b);
8936 Fixed cogl_fixed_mul(Fixed* this_, Fixed b);
8937 Fixed cogl_fixed_mul_div(Fixed* this_, Fixed b, Fixed c);
8938 uint cogl_fixed_pow2(Fixed* this_);
8939 Fixed cogl_fixed_sin(Fixed* this_);
8940 Fixed cogl_fixed_sqrt(Fixed* this_);
8941 Fixed cogl_fixed_tan(Fixed* this_);
8942 uint cogl_framebuffer_add_swap_buffers_callback(Framebuffer* this_, SwapBuffersNotify callback, void* user_data);
8943 int cogl_framebuffer_allocate(Framebuffer* this_, GLib2.Error** error);
8944 void cogl_framebuffer_clear(Framebuffer* this_, c_ulong buffers, Color* color);
8945 void cogl_framebuffer_clear4f(Framebuffer* this_, c_ulong buffers, float red, float green, float blue, float alpha);
8946 void cogl_framebuffer_discard_buffers(Framebuffer* this_, c_ulong buffers);
8947 void cogl_framebuffer_finish(Framebuffer* this_);
8948 void cogl_framebuffer_frustum(Framebuffer* this_, float left, float right, float bottom, float top, float z_near, float z_far);
8949 int cogl_framebuffer_get_alpha_bits(Framebuffer* this_);
8950 int cogl_framebuffer_get_blue_bits(Framebuffer* this_);
8951 PixelFormat cogl_framebuffer_get_color_format(Framebuffer* this_);
8952 ColorMask cogl_framebuffer_get_color_mask(Framebuffer* this_);
8953 Cogl.Context* cogl_framebuffer_get_context(Framebuffer* this_);
8954 int cogl_framebuffer_get_dither_enabled(Framebuffer* this_);
8955 int cogl_framebuffer_get_green_bits(Framebuffer* this_);
8956 int cogl_framebuffer_get_height(Framebuffer* this_);
8957 void cogl_framebuffer_get_modelview_matrix(Framebuffer* this_, /*out*/ Matrix* matrix);
8958 void cogl_framebuffer_get_projection_matrix(Framebuffer* this_, /*out*/ Matrix* matrix);
8959 int cogl_framebuffer_get_red_bits(Framebuffer* this_);
8960 int cogl_framebuffer_get_samples_per_pixel(Framebuffer* this_);
8961 void cogl_framebuffer_get_viewport4fv(Framebuffer* this_, float* viewport);
8962 float cogl_framebuffer_get_viewport_height(Framebuffer* this_);
8963 float cogl_framebuffer_get_viewport_width(Framebuffer* this_);
8964 float cogl_framebuffer_get_viewport_x(Framebuffer* this_);
8965 float cogl_framebuffer_get_viewport_y(Framebuffer* this_);
8966 int cogl_framebuffer_get_width(Framebuffer* this_);
8967 void cogl_framebuffer_identity_matrix(Framebuffer* this_);
8968 void cogl_framebuffer_orthographic(Framebuffer* this_, float x_1, float y_1, float x_2, float y_2, float near, float far);
8969 void cogl_framebuffer_perspective(Framebuffer* this_, float fov_y, float aspect, float z_near, float z_far);
8970 void cogl_framebuffer_pop_clip(Framebuffer* this_);
8971 void cogl_framebuffer_pop_matrix(Framebuffer* this_);
8972 void cogl_framebuffer_push_matrix(Framebuffer* this_);
8973 void cogl_framebuffer_push_path_clip(Framebuffer* this_, Path* path);
8974 void cogl_framebuffer_push_primitive_clip(Framebuffer* this_, Primitive* primitive, float bounds_x1, float bounds_y1, float bounds_x2, float bounds_y2);
8975 void cogl_framebuffer_push_rectangle_clip(Framebuffer* this_, float x_1, float y_1, float x_2, float y_2);
8976 void cogl_framebuffer_push_scissor_clip(Framebuffer* this_, int x, int y, int width, int height);
8977 void cogl_framebuffer_remove_swap_buffers_callback(Framebuffer* this_, uint id);
8978 void cogl_framebuffer_resolve_samples(Framebuffer* this_);
8979 void cogl_framebuffer_resolve_samples_region(Framebuffer* this_, int x, int y, int width, int height);
8980 void cogl_framebuffer_rotate(Framebuffer* this_, float angle, float x, float y, float z);
8981 void cogl_framebuffer_scale(Framebuffer* this_, float x, float y, float z);
8982 void cogl_framebuffer_set_color_mask(Framebuffer* this_, ColorMask color_mask);
8983 void cogl_framebuffer_set_dither_enabled(Framebuffer* this_, int dither_enabled);
8984 void cogl_framebuffer_set_modelview_matrix(Framebuffer* this_, Matrix* matrix);
8985 void cogl_framebuffer_set_projection_matrix(Framebuffer* this_, Matrix* matrix);
8986 void cogl_framebuffer_set_samples_per_pixel(Framebuffer* this_, int samples_per_pixel);
8987 void cogl_framebuffer_set_viewport(Framebuffer* this_, float x, float y, float width, float height);
8988 void cogl_framebuffer_swap_buffers(Framebuffer* this_);
8989 void cogl_framebuffer_swap_region(Framebuffer* this_, int* rectangles, int n_rectangles);
8990 void cogl_framebuffer_transform(Framebuffer* this_, Matrix* matrix);
8991 void cogl_framebuffer_translate(Framebuffer* this_, float x, float y, float z);
8992 IndexBuffer* cogl_index_buffer_new(size_t bytes);
8993 IndexBuffer* cogl_indices_get_buffer(Indices* this_);
8994 size_t cogl_indices_get_offset(Indices* this_);
8995 void cogl_indices_set_offset(Indices* this_, size_t offset);
8996 Indices* cogl_indices_new(IndicesType type, void* indices_data, int n_indices);
8997 Indices* cogl_indices_new_for_buffer(IndicesType type, IndexBuffer* buffer, size_t offset);
8998 Material* cogl_material_copy(Material* this_);
8999 void cogl_material_foreach_layer(Material* this_, MaterialLayerCallback callback, void* user_data);
9000 void cogl_material_get_ambient(Material* this_, Color* ambient);
9001 void cogl_material_get_color(Material* this_, /*out*/ Color* color);
9002 void cogl_material_get_depth_state(Material* this_, DepthState* state_out);
9003 void cogl_material_get_diffuse(Material* this_, Color* diffuse);
9004 void cogl_material_get_emission(Material* this_, Color* emission);
9005 int cogl_material_get_layer_point_sprite_coords_enabled(Material* this_, int layer_index);
9006 MaterialWrapMode cogl_material_get_layer_wrap_mode_p(Material* this_, int layer_index);
9007 MaterialWrapMode cogl_material_get_layer_wrap_mode_s(Material* this_, int layer_index);
9008 MaterialWrapMode cogl_material_get_layer_wrap_mode_t(Material* this_, int layer_index);
9009 GLib2.List* cogl_material_get_layers(Material* this_);
9010 int cogl_material_get_n_layers(Material* this_);
9011 float cogl_material_get_point_size(Material* this_);
9012 float cogl_material_get_shininess(Material* this_);
9013 void cogl_material_get_specular(Material* this_, Color* specular);
9014 Handle cogl_material_get_user_program(Material* this_);
9015 void cogl_material_remove_layer(Material* this_, int layer_index);
9016 void cogl_material_set_alpha_test_function(Material* this_, MaterialAlphaFunc alpha_func, float alpha_reference);
9017 void cogl_material_set_ambient(Material* this_, Color* ambient);
9018 void cogl_material_set_ambient_and_diffuse(Material* this_, Color* color);
9019 int cogl_material_set_blend(Material* this_, char* blend_string, GLib2.Error** error);
9020 void cogl_material_set_blend_constant(Material* this_, Color* constant_color);
9021 void cogl_material_set_color(Material* this_, Color* color);
9022 void cogl_material_set_color4f(Material* this_, float red, float green, float blue, float alpha);
9023 void cogl_material_set_color4ub(Material* this_, ubyte red, ubyte green, ubyte blue, ubyte alpha);
9024 int cogl_material_set_depth_state(Material* this_, DepthState* state, GLib2.Error** error);
9025 void cogl_material_set_diffuse(Material* this_, Color* diffuse);
9026 void cogl_material_set_emission(Material* this_, Color* emission);
9027 void cogl_material_set_layer(Material* this_, int layer_index, Handle texture);
9028 int cogl_material_set_layer_combine(Material* this_, int layer_index, char* blend_string, GLib2.Error** error);
9029 void cogl_material_set_layer_combine_constant(Material* this_, int layer_index, Color* constant);
9030 void cogl_material_set_layer_filters(Material* this_, int layer_index, MaterialFilter min_filter, MaterialFilter mag_filter);
9031 void cogl_material_set_layer_matrix(Material* this_, int layer_index, Matrix* matrix);
9032 int cogl_material_set_layer_point_sprite_coords_enabled(Material* this_, int layer_index, int enable, GLib2.Error** error);
9033 void cogl_material_set_layer_wrap_mode(Material* this_, int layer_index, MaterialWrapMode mode);
9034 void cogl_material_set_layer_wrap_mode_p(Material* this_, int layer_index, MaterialWrapMode mode);
9035 void cogl_material_set_layer_wrap_mode_s(Material* this_, int layer_index, MaterialWrapMode mode);
9036 void cogl_material_set_layer_wrap_mode_t(Material* this_, int layer_index, MaterialWrapMode mode);
9037 void cogl_material_set_point_size(Material* this_, float point_size);
9038 void cogl_material_set_shininess(Material* this_, float shininess);
9039 void cogl_material_set_specular(Material* this_, Color* specular);
9040 void cogl_material_set_user_program(Material* this_, Handle program);
9041 Material* cogl_material_new();
9042 Handle cogl_material_ref(Handle material);
9043 void cogl_material_unref(Handle material);
9044 MaterialFilter cogl_material_layer_get_mag_filter(MaterialLayer* this_);
9045 MaterialFilter cogl_material_layer_get_min_filter(MaterialLayer* this_);
9046 Handle cogl_material_layer_get_texture(MaterialLayer* this_);
9047 MaterialWrapMode cogl_material_layer_get_wrap_mode_p(MaterialLayer* this_);
9048 MaterialWrapMode cogl_material_layer_get_wrap_mode_s(MaterialLayer* this_);
9049 MaterialWrapMode cogl_material_layer_get_wrap_mode_t(MaterialLayer* this_);
9050 Matrix* cogl_matrix_copy(Matrix* this_);
9051 void cogl_matrix_free(Matrix* this_);
9052 void cogl_matrix_frustum(Matrix* this_, float left, float right, float bottom, float top, float z_near, float z_far);
9053 float* cogl_matrix_get_array(Matrix* this_);
9054 int cogl_matrix_get_inverse(Matrix* this_, /*out*/ Matrix* inverse);
9055 void cogl_matrix_init_from_array(Matrix* this_, float* array);
9056 void cogl_matrix_init_from_quaternion(Matrix* this_, Quaternion* quaternion);
9057 void cogl_matrix_init_identity(Matrix* this_);
9058 int cogl_matrix_is_identity(Matrix* this_);
9059 void cogl_matrix_look_at(Matrix* this_, float eye_position_x, float eye_position_y, float eye_position_z, float object_x, float object_y, float object_z, float world_up_x, float world_up_y, float world_up_z);
9060 void cogl_matrix_multiply(Matrix* this_, Matrix* a, Matrix* b);
9061 void cogl_matrix_ortho(Matrix* this_, float left, float right, float bottom, float top, float near, float far);
9062 void cogl_matrix_orthographic(Matrix* this_, float x_1, float y_1, float x_2, float y_2, float near, float far);
9063 void cogl_matrix_perspective(Matrix* this_, float fov_y, float aspect, float z_near, float z_far);
9064 void cogl_matrix_project_points(Matrix* this_, int n_components, size_t stride_in, void* points_in, size_t stride_out, void* points_out, int n_points);
9065 void cogl_matrix_rotate(Matrix* this_, float angle, float x, float y, float z);
9066 void cogl_matrix_scale(Matrix* this_, float sx, float sy, float sz);
9067 void cogl_matrix_transform_point(Matrix* this_, /*inout*/ float* x, /*inout*/ float* y, /*inout*/ float* z, /*inout*/ float* w);
9068 void cogl_matrix_transform_points(Matrix* this_, int n_components, size_t stride_in, void* points_in, size_t stride_out, void* points_out, int n_points);
9069 void cogl_matrix_translate(Matrix* this_, float x, float y, float z);
9070 void cogl_matrix_transpose(Matrix* this_);
9071 void cogl_matrix_view_2d_in_frustum(Matrix* this_, float left, float right, float bottom, float top, float z_near, float z_2d, float width_2d, float height_2d);
9072 void cogl_matrix_view_2d_in_perspective(Matrix* this_, float fov_y, float aspect, float z_near, float z_2d, float width_2d, float height_2d);
9073 int cogl_matrix_equal(const(void)* v1, const(void)* v2);
9074 void cogl_meta_texture_foreach_in_region(MetaTexture* this_, float tx_1, float ty_1, float tx_2, float ty_2, PipelineWrapMode wrap_s, PipelineWrapMode wrap_t, MetaTextureCallback callback, void* user_data);
9075 void* cogl_object_get_user_data(Object* this_, UserDataKey* key);
9076 void cogl_object_set_user_data(Object* this_, UserDataKey* key, void* user_data, UserDataDestroyCallback destroy);
9077 void* cogl_object_ref(void* object);
9078 void cogl_object_unref(void* object);
9079 void cogl_onscreen_hide(Onscreen* this_);
9080 void cogl_onscreen_set_swap_throttled(Onscreen* this_, int throttled);
9081 void cogl_onscreen_show(Onscreen* this_);
9082 void cogl_onscreen_clutter_backend_set_size_CLUTTER(int width, int height);
9083 Onscreen* cogl_onscreen_new(Cogl.Context* context, int width, int height);
9084 void cogl_onscreen_template_set_samples_per_pixel(OnscreenTemplate* this_, int n);
9085 void cogl_onscreen_template_set_swap_throttled(OnscreenTemplate* this_, int throttled);
9086 OnscreenTemplate* cogl_onscreen_template_new_EXP(SwapChain* swap_chain);
9087 Path* cogl_path_copy(Path* this_);
9088 void cogl_path_arc(float center_x, float center_y, float radius_x, float radius_y, float angle_1, float angle_2);
9089 void cogl_path_close();
9090 void cogl_path_curve_to(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3);
9091 void cogl_path_ellipse(float center_x, float center_y, float radius_x, float radius_y);
9092 void cogl_path_fill();
9093 void cogl_path_fill_preserve();
9094 PathFillRule cogl_path_get_fill_rule();
9095 void cogl_path_line(float x_1, float y_1, float x_2, float y_2);
9096 void cogl_path_line_to(float x, float y);
9097 void cogl_path_move_to(float x, float y);
9098 void cogl_path_new();
9099 void cogl_path_polygon(float* coords, int num_points);
9100 void cogl_path_polyline(float* coords, int num_points);
9101 void cogl_path_rectangle(float x_1, float y_1, float x_2, float y_2);
9102 void cogl_path_rel_curve_to(float x_1, float y_1, float x_2, float y_2, float x_3, float y_3);
9103 void cogl_path_rel_line_to(float x, float y);
9104 void cogl_path_rel_move_to(float x, float y);
9105 void cogl_path_round_rectangle(float x_1, float y_1, float x_2, float y_2, float radius, float arc_step);
9106 void cogl_path_set_fill_rule(PathFillRule fill_rule);
9107 void cogl_path_stroke();
9108 void cogl_path_stroke_preserve();
9109 void cogl_pipeline_add_layer_snippet(Pipeline* this_, int layer, Snippet* snippet);
9110 void cogl_pipeline_add_snippet(Pipeline* this_, Snippet* snippet);
9111 Pipeline* cogl_pipeline_copy(Pipeline* this_);
9112 void cogl_pipeline_foreach_layer(Pipeline* this_, PipelineLayerCallback callback, void* user_data);
9113 PipelineAlphaFunc cogl_pipeline_get_alpha_test_function(Pipeline* this_);
9114 float cogl_pipeline_get_alpha_test_reference(Pipeline* this_);
9115 void cogl_pipeline_get_ambient(Pipeline* this_, Color* ambient);
9116 void cogl_pipeline_get_color(Pipeline* this_, /*out*/ Color* color);
9117 ColorMask cogl_pipeline_get_color_mask(Pipeline* this_);
9118 PipelineCullFaceMode cogl_pipeline_get_cull_face_mode(Pipeline* this_);
9119 void cogl_pipeline_get_depth_state(Pipeline* this_, DepthState* state_out);
9120 void cogl_pipeline_get_diffuse(Pipeline* this_, Color* diffuse);
9121 void cogl_pipeline_get_emission(Pipeline* this_, Color* emission);
9122 Winding cogl_pipeline_get_front_face_winding(Pipeline* this_);
9123 int cogl_pipeline_get_layer_point_sprite_coords_enabled(Pipeline* this_, int layer_index);
9124 PipelineWrapMode cogl_pipeline_get_layer_wrap_mode_p(Pipeline* this_, int layer_index);
9125 PipelineWrapMode cogl_pipeline_get_layer_wrap_mode_s(Pipeline* this_, int layer_index);
9126 PipelineWrapMode cogl_pipeline_get_layer_wrap_mode_t(Pipeline* this_, int layer_index);
9127 int cogl_pipeline_get_n_layers(Pipeline* this_);
9128 float cogl_pipeline_get_point_size(Pipeline* this_);
9129 float cogl_pipeline_get_shininess(Pipeline* this_);
9130 void cogl_pipeline_get_specular(Pipeline* this_, Color* specular);
9131 int cogl_pipeline_get_uniform_location(Pipeline* this_, char* uniform_name);
9132 Handle cogl_pipeline_get_user_program(Pipeline* this_);
9133 void cogl_pipeline_remove_layer(Pipeline* this_, int layer_index);
9134 void cogl_pipeline_set_alpha_test_function(Pipeline* this_, PipelineAlphaFunc alpha_func, float alpha_reference);
9135 void cogl_pipeline_set_ambient(Pipeline* this_, Color* ambient);
9136 void cogl_pipeline_set_ambient_and_diffuse(Pipeline* this_, Color* color);
9137 int cogl_pipeline_set_blend(Pipeline* this_, char* blend_string, GLib2.Error** error);
9138 void cogl_pipeline_set_blend_constant(Pipeline* this_, Color* constant_color);
9139 void cogl_pipeline_set_color(Pipeline* this_, Color* color);
9140 void cogl_pipeline_set_color4f(Pipeline* this_, float red, float green, float blue, float alpha);
9141 void cogl_pipeline_set_color4ub(Pipeline* this_, ubyte red, ubyte green, ubyte blue, ubyte alpha);
9142 void cogl_pipeline_set_color_mask(Pipeline* this_, ColorMask color_mask);
9143 void cogl_pipeline_set_cull_face_mode(Pipeline* this_, PipelineCullFaceMode cull_face_mode);
9144 int cogl_pipeline_set_depth_state(Pipeline* this_, DepthState* state, GLib2.Error** error);
9145 void cogl_pipeline_set_diffuse(Pipeline* this_, Color* diffuse);
9146 void cogl_pipeline_set_emission(Pipeline* this_, Color* emission);
9147 void cogl_pipeline_set_front_face_winding(Pipeline* this_, Winding front_winding);
9148 int cogl_pipeline_set_layer_combine(Pipeline* this_, int layer_index, char* blend_string, GLib2.Error** error);
9149 void cogl_pipeline_set_layer_combine_constant(Pipeline* this_, int layer_index, Color* constant);
9150 void cogl_pipeline_set_layer_filters(Pipeline* this_, int layer_index, PipelineFilter min_filter, PipelineFilter mag_filter);
9151 void cogl_pipeline_set_layer_matrix(Pipeline* this_, int layer_index, Matrix* matrix);
9152 int cogl_pipeline_set_layer_point_sprite_coords_enabled(Pipeline* this_, int layer_index, int enable, GLib2.Error** error);
9153 void cogl_pipeline_set_layer_texture(Pipeline* this_, int layer_index, Texture* texture);
9154 void cogl_pipeline_set_layer_wrap_mode(Pipeline* this_, int layer_index, PipelineWrapMode mode);
9155 void cogl_pipeline_set_layer_wrap_mode_p(Pipeline* this_, int layer_index, PipelineWrapMode mode);
9156 void cogl_pipeline_set_layer_wrap_mode_s(Pipeline* this_, int layer_index, PipelineWrapMode mode);
9157 void cogl_pipeline_set_layer_wrap_mode_t(Pipeline* this_, int layer_index, PipelineWrapMode mode);
9158 void cogl_pipeline_set_point_size(Pipeline* this_, float point_size);
9159 void cogl_pipeline_set_shininess(Pipeline* this_, float shininess);
9160 void cogl_pipeline_set_specular(Pipeline* this_, Color* specular);
9161 void cogl_pipeline_set_uniform_1f(Pipeline* this_, int uniform_location, float value);
9162 void cogl_pipeline_set_uniform_1i(Pipeline* this_, int uniform_location, int value);
9163 void cogl_pipeline_set_uniform_float(Pipeline* this_, int uniform_location, int n_components, int count, float* value);
9164 void cogl_pipeline_set_uniform_int(Pipeline* this_, int uniform_location, int n_components, int count, int* value);
9165 void cogl_pipeline_set_uniform_matrix(Pipeline* this_, int uniform_location, int dimensions, int count, int transpose, float* value);
9166 void cogl_pipeline_set_user_program(Pipeline* this_, Handle program);
9167 Pipeline* cogl_pipeline_new();
9168 PixelBuffer* cogl_pixel_buffer_new_with_size_EXP(uint width, uint height, PixelFormat format, uint* stride);
9169 void cogl_primitive_draw(Primitive* this_);
9170 int cogl_primitive_get_first_vertex(Primitive* this_);
9171 VerticesMode cogl_primitive_get_mode(Primitive* this_);
9172 int cogl_primitive_get_n_vertices_EXP(Primitive* this_);
9173 void cogl_primitive_set_attributes(Primitive* this_, Attribute** attributes, int n_attributes);
9174 void cogl_primitive_set_first_vertex(Primitive* this_, int first_vertex);
9175 void cogl_primitive_set_indices_EXP(Primitive* this_, Indices* indices, int n_indices);
9176 void cogl_primitive_set_mode(Primitive* this_, VerticesMode mode);
9177 void cogl_primitive_set_n_vertices_EXP(Primitive* this_, int n_vertices);
9178 Primitive* cogl_primitive_new(VerticesMode mode, int n_vertices, ...);
9179 Primitive* cogl_primitive_new_p2(VerticesMode mode, int n_vertices, VertexP2* data);
9180 Primitive* cogl_primitive_new_p2c4(VerticesMode mode, int n_vertices, VertexP2C4* data);
9181 Primitive* cogl_primitive_new_p2t2(VerticesMode mode, int n_vertices, VertexP2T2* data);
9182 Primitive* cogl_primitive_new_p2t2c4(VerticesMode mode, int n_vertices, VertexP2T2C4* data);
9183 Primitive* cogl_primitive_new_p3(VerticesMode mode, int n_vertices, VertexP3* data);
9184 Primitive* cogl_primitive_new_p3c4(VerticesMode mode, int n_vertices, VertexP3C4* data);
9185 Primitive* cogl_primitive_new_p3t2(VerticesMode mode, int n_vertices, VertexP3T2* data);
9186 Primitive* cogl_primitive_new_p3t2c4(VerticesMode mode, int n_vertices, VertexP3T2C4* data);
9187 Primitive* cogl_primitive_new_with_attributes(VerticesMode mode, int n_vertices, Attribute** attributes, int n_attributes);
9188 Quaternion* cogl_quaternion_copy(Quaternion* this_);
9189 float cogl_quaternion_dot_product(Quaternion* this_, Quaternion* b);
9190 void cogl_quaternion_free(Quaternion* this_);
9191 float cogl_quaternion_get_rotation_angle(Quaternion* this_);
9192 void cogl_quaternion_get_rotation_axis(Quaternion* this_, float* vector3);
9193 void cogl_quaternion_init(Quaternion* this_, float angle, float x, float y, float z);
9194 void cogl_quaternion_init_from_angle_vector(Quaternion* this_, float angle, float* axis3f);
9195 void cogl_quaternion_init_from_array(Quaternion* this_, float* array);
9196 void cogl_quaternion_init_from_euler(Quaternion* this_, Euler* euler);
9197 void cogl_quaternion_init_from_x_rotation(Quaternion* this_, float angle);
9198 void cogl_quaternion_init_from_y_rotation(Quaternion* this_, float angle);
9199 void cogl_quaternion_init_from_z_rotation(Quaternion* this_, float angle);
9200 void cogl_quaternion_init_identity(Quaternion* this_);
9201 void cogl_quaternion_invert(Quaternion* this_);
9202 void cogl_quaternion_multiply(Quaternion* this_, Quaternion* left, Quaternion* right);
9203 void cogl_quaternion_nlerp(Quaternion* this_, Quaternion* a, Quaternion* b, float t);
9204 void cogl_quaternion_normalize(Quaternion* this_);
9205 void cogl_quaternion_pow(Quaternion* this_, float exponent);
9206 void cogl_quaternion_slerp(Quaternion* this_, Quaternion* a, Quaternion* b, float t);
9207 void cogl_quaternion_squad(Quaternion* this_, Quaternion* prev, Quaternion* a, Quaternion* b, Quaternion* next, float t);
9208 int cogl_quaternion_equal(const(void)* v1, const(void)* v2);
9209 void cogl_renderer_add_contraint(Renderer* this_, RendererConstraint constraint);
9210 int cogl_renderer_check_onscreen_template(Renderer* this_, OnscreenTemplate* onscreen_template, GLib2.Error** error);
9211 int cogl_renderer_connect(Renderer* this_, GLib2.Error** error);
9212 int cogl_renderer_get_n_fragment_texture_units(Renderer* this_);
9213 WinsysID cogl_renderer_get_winsys_id(Renderer* this_);
9214 void cogl_renderer_remove_constraint(Renderer* this_, RendererConstraint constraint);
9215 void cogl_renderer_set_winsys_id(Renderer* this_, WinsysID winsys_id);
9216 Cogl.Renderer* cogl_renderer_new();
9217 char* cogl_snippet_get_declarations(Snippet* this_);
9218 SnippetHook cogl_snippet_get_hook(Snippet* this_);
9219 char* cogl_snippet_get_post(Snippet* this_);
9220 char* cogl_snippet_get_pre(Snippet* this_);
9221 char* cogl_snippet_get_replace(Snippet* this_);
9222 void cogl_snippet_set_declarations(Snippet* this_, char* declarations);
9223 void cogl_snippet_set_post(Snippet* this_, char* post);
9224 void cogl_snippet_set_pre(Snippet* this_, char* pre);
9225 void cogl_snippet_set_replace(Snippet* this_, char* replace);
9226 Snippet* cogl_snippet_new(SnippetHook hook, char* declarations, char* post);
9227 Texture* cogl_sub_texture_get_parent(SubTexture* this_);
9228 SubTexture* cogl_sub_texture_new_EXP(Cogl.Context* ctx, Texture* parent_texture, int sub_x, int sub_y, int sub_width, int sub_height);
9229 void cogl_swap_chain_set_has_alpha_EXP(SwapChain* this_, int has_alpha);
9230 void cogl_swap_chain_set_length_EXP(SwapChain* this_, int length);
9231 SwapChain* cogl_swap_chain_new_EXP();
9232 int cogl_texture_get_data(Texture* this_, PixelFormat format, uint rowstride, ubyte* data);
9233 PixelFormat cogl_texture_get_format(Texture* this_);
9234 int cogl_texture_get_gl_texture(Texture* this_, /*out*/ GL.uint_* out_gl_handle=null, /*out*/ GL.enum_* out_gl_target=null);
9235 uint cogl_texture_get_height(Texture* this_);
9236 int cogl_texture_get_max_waste(Texture* this_);
9237 uint cogl_texture_get_rowstride(Texture* this_);
9238 uint cogl_texture_get_width(Texture* this_);
9239 int cogl_texture_is_sliced(Texture* this_);
9240 Texture* cogl_texture_new_from_sub_texture(Texture* this_, int sub_x, int sub_y, int sub_width, int sub_height);
9241 int cogl_texture_set_region(Texture* this_, int src_x, int src_y, int dst_x, int dst_y, uint dst_width, uint dst_height, int width, int height, PixelFormat format, uint rowstride, ubyte* data);
9242 int cogl_texture_set_region_from_bitmap_EXP(Texture* this_, int src_x, int src_y, int dst_x, int dst_y, uint dst_width, uint dst_height, Bitmap* bitmap);
9243 Texture2D* cogl_texture_2d_new_from_data_EXP(Cogl.Context* ctx, int width, int height, PixelFormat format, PixelFormat internal_format, int rowstride, ubyte* data, GLib2.Error** error);
9244 Texture2D* cogl_texture_2d_new_from_foreign_EXP(Cogl.Context* ctx, uint gl_handle, int width, int height, PixelFormat format, GLib2.Error** error);
9245 Texture2D* cogl_texture_2d_new_with_size_EXP(Cogl.Context* ctx, int width, int height, PixelFormat internal_format, GLib2.Error** error);
9246 Texture2DSliced* cogl_texture_2d_sliced_new_with_size(Cogl.Context* ctx, uint width, uint height, int max_waste, PixelFormat internal_format, GLib2.Error** error);
9247 Handle cogl_texture_3d_new_from_data_EXP(uint width, uint height, uint depth, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, uint image_stride, ubyte* data, GLib2.Error** error);
9248 Handle cogl_texture_3d_new_with_size_EXP(uint width, uint height, uint depth, TextureFlags flags, PixelFormat internal_format, GLib2.Error** error);
9249 Texture* cogl_texture_new_from_bitmap(Bitmap* bitmap, TextureFlags flags, PixelFormat internal_format);
9250 Texture* cogl_texture_new_from_buffer_EXP(PixelBuffer* buffer, uint width, uint height, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, uint offset);
9251 Texture* cogl_texture_new_from_data(uint width, uint height, TextureFlags flags, PixelFormat format, PixelFormat internal_format, uint rowstride, ubyte* data);
9252 Texture* cogl_texture_new_from_file(char* filename, TextureFlags flags, PixelFormat internal_format, GLib2.Error** error);
9253 Texture* cogl_texture_new_from_foreign(GL.uint_ gl_handle, GL.enum_ gl_target, GL.uint_ width, GL.uint_ height, GL.uint_ x_pot_waste, GL.uint_ y_pot_waste, PixelFormat format);
9254 Texture* cogl_texture_new_with_size(uint width, uint height, TextureFlags flags, PixelFormat internal_format);
9255 void* cogl_texture_ref(void* texture);
9256 void cogl_texture_unref(void* texture);
9257 TextureRectangle* cogl_texture_rectangle_new_with_size_EXP(Cogl.Context* ctx, int width, int height, PixelFormat internal_format, GLib2.Error** error);
9258 Fixed cogl_angle_cos(Angle angle);
9259 Fixed cogl_angle_sin(Angle angle);
9260 Fixed cogl_angle_tan(Angle angle);
9261 void cogl_begin_gl();
9262 GLib2.Quark cogl_bitmap_error_quark();
9263 GLib2.Quark cogl_blend_string_error_quark();
9264 int cogl_check_extension(char* name, char* ext);
9265 void cogl_clear(Color* color, c_ulong buffers);
9266 void cogl_clip_ensure();
9267 void cogl_clip_pop();
9268 void cogl_clip_push(float x_offset, float y_offset, float width, float height);
9269 void cogl_clip_push_from_path();
9270 void cogl_clip_push_from_path_preserve();
9271 void cogl_clip_push_primitive(Primitive* primitive, float bounds_x1, float bounds_y1, float bounds_x2, float bounds_y2);
9272 void cogl_clip_push_rectangle(float x0, float y0, float x1, float y1);
9273 void cogl_clip_push_window_rect(float x_offset, float y_offset, float width, float height);
9274 void cogl_clip_push_window_rectangle(int x_offset, int y_offset, int width, int height);
9275 void cogl_clip_stack_restore();
9276 void cogl_clip_stack_save();
9277 int cogl_clutter_check_extension_CLUTTER(char* name, char* ext);
9278 int cogl_clutter_winsys_has_feature_CLUTTER(WinsysFeature feature);
9279 /*CTYPE*/ XVisualInfo* cogl_clutter_winsys_xlib_get_visual_info_CLUTTER();
9280 Handle cogl_create_program();
9281 Handle cogl_create_shader(ShaderType shader_type);
9282 void cogl_debug_object_foreach_type_EXP(DebugObjectForeachTypeCallback func, void* user_data);
9283 void cogl_debug_object_print_instances_EXP();
9284 void cogl_disable_fog();
9285 Fixed cogl_double_to_fixed(double value);
9286 int cogl_double_to_int(double value);
9287 uint cogl_double_to_uint(double value);
9288 void cogl_draw_attributes(VerticesMode mode, int first_vertex, int n_vertices, Attribute** attributes, int n_attributes);
9289 void cogl_draw_indexed_attributes(VerticesMode mode, int first_vertex, int n_vertices, Indices* indices, Attribute** attributes, int n_attributes);
9290 void cogl_end_gl();
9291 int cogl_features_available(FeatureFlags features);
9292 void cogl_flush();
9293 void cogl_foreach_feature(Cogl.Context* context, FeatureCallback callback, void* user_data);
9294 GLib2.Quark cogl_framebuffer_error_quark();
9295 void cogl_frustum(float left, float right, float bottom, float top, float z_near, float z_far);
9296 int cogl_get_backface_culling_enabled();
9297 void cogl_get_bitmasks(/*out*/ int* red, /*out*/ int* green, /*out*/ int* blue, /*out*/ int* alpha);
9298 int cogl_get_depth_test_enabled();
9299 Framebuffer* cogl_get_draw_framebuffer();
9300 FeatureFlags cogl_get_features();
9301 void cogl_get_modelview_matrix(/*out*/ Matrix* matrix);
9302 GLib2.OptionGroup* cogl_get_option_group();
9303 Path* cogl_get_path();
9304 FuncPtr cogl_get_proc_address(char* name);
9305 void cogl_get_projection_matrix(/*out*/ Matrix* matrix);
9306 Indices* cogl_get_rectangle_indices(int n_rectangles);
9307 void* cogl_get_source();
9308 Quaternion* cogl_get_static_identity_quaternion();
9309 Quaternion* cogl_get_static_zero_quaternion();
9310 void cogl_get_viewport(/*out*/ float v);
9311 GLib2.Source* /*new*/ cogl_glib_source_new(Cogl.Context* context, int priority);
9312 Type cogl_handle_get_type();
9313 Handle cogl_handle_ref(Handle handle);
9314 void cogl_handle_unref(Handle handle);
9315 int cogl_has_feature(Cogl.Context* context, FeatureID feature);
9316 int cogl_has_features(Cogl.Context* context, ...);
9317 IndicesType cogl_indices_get_type(Indices* indices);
9318 int cogl_is_attribute(void* object);
9319 int cogl_is_attribute_buffer(void* object);
9320 int cogl_is_bitmap(Handle handle);
9321 int cogl_is_buffer(void* object);
9322 int cogl_is_context(void* object);
9323 int cogl_is_index_buffer(void* object);
9324 int cogl_is_material(Handle handle);
9325 int cogl_is_offscreen(Handle handle);
9326 int cogl_is_path(Handle handle);
9327 int cogl_is_pipeline(Handle handle);
9328 int cogl_is_pixel_buffer_EXP(void* object);
9329 int cogl_is_primitive(void* object);
9330 int cogl_is_program(Handle handle);
9331 int cogl_is_renderer(void* object);
9332 int cogl_is_shader(Handle handle);
9333 int cogl_is_snippet(void* object);
9334 int cogl_is_sub_texture_EXP(void* object);
9335 int cogl_is_texture(void* object);
9336 int cogl_is_texture_2d_EXP(void* object);
9337 int cogl_is_texture_3d_EXP(Handle handle);
9338 int cogl_is_texture_rectangle_EXP(void* object);
9339 int cogl_is_vertex_buffer(Handle handle);
9340 int cogl_is_vertex_buffer_indices(Handle handle);
9341 MaterialLayerType cogl_material_layer_get_type(MaterialLayer* layer);
9342 Handle /*new*/ cogl_offscreen_new_to_texture(Texture* texture);
9343 Handle cogl_offscreen_ref(Handle handle);
9344 void cogl_offscreen_unref(Handle handle);
9345 void cogl_ortho(float left, float right, float bottom, float top, float near, float far);
9346 void cogl_perspective(float fovy, float aspect, float z_near, float z_far);
9347 void cogl_poll_dispatch(Cogl.Context* context, PollFD* poll_fds, int n_poll_fds);
9348 void cogl_poll_get_info(Cogl.Context* context, PollFD** poll_fds, int* n_poll_fds, long* timeout);
9349 void cogl_polygon(TextureVertex* vertices, uint n_vertices, int use_color);
9350 void cogl_pop_draw_buffer();
9351 void cogl_pop_framebuffer();
9352 void cogl_pop_matrix();
9353 void cogl_pop_source();
9354 void cogl_program_attach_shader(Handle program_handle, Handle shader_handle);
9355 int cogl_program_get_uniform_location(Handle handle, char* uniform_name);
9356 void cogl_program_link(Handle handle);
9357 Handle cogl_program_ref(Handle handle);
9358 void cogl_program_set_uniform_1f(Handle program, int uniform_location, float value);
9359 void cogl_program_set_uniform_1i(Handle program, int uniform_location, int value);
9360 void cogl_program_set_uniform_float(Handle program, int uniform_location, int n_components, int count, float* value);
9361 void cogl_program_set_uniform_int(Handle program, int uniform_location, int n_components, int count, int* value);
9362 void cogl_program_set_uniform_matrix(Handle program, int uniform_location, int dimensions, int count, int transpose, float* value);
9363 void cogl_program_uniform_1f(int uniform_no, float value);
9364 void cogl_program_uniform_1i(int uniform_no, int value);
9365 void cogl_program_uniform_float(int uniform_no, int size, int count, float* value);
9366 void cogl_program_uniform_int(int uniform_no, int size, int count, int* value);
9367 void cogl_program_uniform_matrix(int uniform_no, int size, int count, int transpose, float* value);
9368 void cogl_program_unref(Handle handle);
9369 void cogl_program_use(Handle handle);
9370 void cogl_push_draw_buffer();
9371 void cogl_push_framebuffer(Framebuffer* buffer);
9372 void cogl_push_matrix();
9373 void cogl_push_source(void* material);
9374 void cogl_read_pixels(int x, int y, int width, int height, ReadPixelsFlags source, PixelFormat format, ubyte* pixels);
9375 void cogl_rectangle(float x_1, float y_1, float x_2, float y_2);
9376 void cogl_rectangle_with_multitexture_coords(float x1, float y1, float x2, float y2, float* tex_coords, int tex_coords_len);
9377 void cogl_rectangle_with_texture_coords(float x1, float y1, float x2, float y2, float tx1, float ty1, float tx2, float ty2);
9378 void cogl_rectangles(float* verts, uint n_rects);
9379 void cogl_rectangles_with_texture_coords(float* verts, uint n_rects);
9380 GLib2.Quark cogl_renderer_error_quark();
9381 void cogl_rotate(float angle, float x, float y, float z);
9382 void cogl_scale(float x, float y, float z);
9383 void cogl_set_backface_culling_enabled(int setting);
9384 void cogl_set_depth_test_enabled(int setting);
9385 void cogl_set_draw_buffer(BufferTarget target, Handle offscreen);
9386 void cogl_set_fog(Color* fog_color, FogMode mode, float density, float z_near, float z_far);
9387 void cogl_set_framebuffer(Framebuffer* buffer);
9388 void cogl_set_modelview_matrix(Matrix* matrix);
9389 void cogl_set_path(Path* path);
9390 void cogl_set_projection_matrix(Matrix* matrix);
9391 void cogl_set_source(void* material);
9392 void cogl_set_source_color(Color* color);
9393 void cogl_set_source_color4f(float red, float green, float blue, float alpha);
9394 void cogl_set_source_color4ub(ubyte red, ubyte green, ubyte blue, ubyte alpha);
9395 void cogl_set_source_texture(Texture* texture);
9396 void cogl_set_viewport(int x, int y, int width, int height);
9397 void cogl_shader_compile(Handle handle);
9398 char* /*new*/ cogl_shader_get_info_log(Handle handle);
9399 ShaderType cogl_shader_get_type(Handle handle);
9400 int cogl_shader_is_compiled(Handle handle);
9401 Handle cogl_shader_ref(Handle handle);
9402 void cogl_shader_source(Handle shader, char* source);
9403 void cogl_shader_unref(Handle handle);
9404 int cogl_sqrti(int x);
9405 GLib2.Quark cogl_texture_error_quark();
9406 void cogl_transform(Matrix* matrix);
9407 void cogl_translate(float x, float y, float z);
9408 void cogl_vdraw_attributes(VerticesMode mode, int first_vertex, int n_vertices, ...);
9409 void cogl_vdraw_indexed_attributes(VerticesMode mode, int first_vertex, int n_vertices, Indices* indices, ...);
9410 void cogl_vector3_add(float* result, float* a, float* b);
9411 float* cogl_vector3_copy(float* vector);
9412 void cogl_vector3_cross_product(float* result, float* u, float* v);
9413 float cogl_vector3_distance(float* a, float* b);
9414 void cogl_vector3_divide_scalar(float* vector, float scalar);
9415 float cogl_vector3_dot_product(float* a, float* b);
9416 int cogl_vector3_equal(const(void)* v1, const(void)* v2);
9417 int cogl_vector3_equal_with_epsilon(float* vector0, float* vector1, float epsilon);
9418 void cogl_vector3_free(float* vector);
9419 void cogl_vector3_init(float* vector, float x, float y, float z);
9420 void cogl_vector3_init_zero(float* vector);
9421 void cogl_vector3_invert(float* vector);
9422 float cogl_vector3_magnitude(float* vector);
9423 void cogl_vector3_multiply_scalar(float* vector, float scalar);
9424 void cogl_vector3_normalize(float* vector);
9425 void cogl_vector3_subtract(float* result, float* a, float* b);
9426 void cogl_vertex_buffer_add(Handle handle, char* attribute_name, ubyte n_components, AttributeType type, int normalized, ushort stride, void* pointer);
9427 void cogl_vertex_buffer_delete(Handle handle, char* attribute_name);
9428 void cogl_vertex_buffer_disable(Handle handle, char* attribute_name);
9429 void cogl_vertex_buffer_draw(Handle handle, VerticesMode mode, int first, int count);
9430 void cogl_vertex_buffer_draw_elements(Handle handle, VerticesMode mode, Handle indices, int min_index, int max_index, int indices_offset, int count);
9431 void cogl_vertex_buffer_enable(Handle handle, char* attribute_name);
9432 uint cogl_vertex_buffer_get_n_vertices(Handle handle);
9433 Handle cogl_vertex_buffer_indices_get_for_quads(uint n_indices);
9434 IndicesType cogl_vertex_buffer_indices_get_type(Handle indices);
9435 Handle cogl_vertex_buffer_indices_new(IndicesType indices_type, void* indices_array, int indices_len);
9436 Handle cogl_vertex_buffer_new(uint n_vertices);
9437 Handle cogl_vertex_buffer_ref(Handle handle);
9438 void cogl_vertex_buffer_submit(Handle handle);
9439 void cogl_vertex_buffer_unref(Handle handle);
9440 void cogl_viewport(uint width, uint height);
9441 uint cogl_x11_onscreen_get_visual_xid(Onscreen* onscreen);
9442 uint cogl_x11_onscreen_get_window_xid(Onscreen* onscreen);
9443 void cogl_x11_onscreen_set_foreign_window_xid(Onscreen* onscreen, uint xid, OnscreenX11MaskCallback update, void* user_data);
9444 void cogl_xlib_renderer_add_filter_EXP(Cogl.Renderer* renderer, XlibFilterFunc func, void* data);
9445 /*CTYPE*/ Display* cogl_xlib_renderer_get_display_EXP(Cogl.Renderer* renderer);
9446 /*CTYPE*/ Display* cogl_xlib_renderer_get_foreign_display_EXP(Cogl.Renderer* renderer);
9447 FilterReturn cogl_xlib_renderer_handle_event_EXP(Cogl.Renderer* renderer, XEvent* event);
9448 void cogl_xlib_renderer_remove_filter_EXP(Cogl.Renderer* renderer, XlibFilterFunc func, void* data);
9449 void cogl_xlib_renderer_set_event_retrieval_enabled(Cogl.Renderer* renderer, int enable);
9450 void cogl_xlib_renderer_set_foreign_display_EXP(Cogl.Renderer* renderer, Display* display);