4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2008,2009 Intel Corporation.
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
24
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25
#error "Only <cogl/cogl.h> can be included directly."
28
#ifndef __COGL_TYPES_H__
29
#define __COGL_TYPES_H__
31
#include <glib-object.h>
38
* Type used for storing references to cogl objects, the CoglHandle is
39
* a fully opaque type without any public data members.
41
typedef gpointer CoglHandle;
44
* COGL_INVALID_HANDLE:
46
* A COGL handle that is not valid, used for unitialized handles as well as
49
#define COGL_INVALID_HANDLE NULL
51
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
53
cogl_handle_get_type (void) G_GNUC_CONST;
57
* @handle: a #CoglHandle
59
* Increases the reference count of @handle by 1
61
* Returns: the handle, with its reference count increased
64
cogl_handle_ref (CoglHandle handle);
68
* @handle: a #CoglHandle
70
* Drecreases the reference count of @handle by 1; if the reference
71
* count reaches 0, the resources allocated by @handle will be freed
74
cogl_handle_unref (CoglHandle Handle);
79
* The type used by cogl for function pointers, note that this type
80
* is used as a generic catch-all cast for function pointers and the
81
* actual arguments and return type may be different.
83
typedef void (* CoglFuncPtr) (void);
88
* Fixed point number using a (16.16) notation.
90
typedef gint32 CoglFixed;
92
#define COGL_TYPE_FIXED (cogl_fixed_get_type ())
94
cogl_fixed_get_type (void) G_GNUC_CONST;
99
* Integer representation of an angle such that 1024 corresponds to
100
* full circle (i.e., 2 * pi).
104
typedef gint32 CoglAngle;
106
typedef struct _CoglColor CoglColor;
107
typedef struct _CoglTextureVertex CoglTextureVertex;
109
/* Enum declarations */
111
#define COGL_PIXEL_FORMAT_24 2
112
#define COGL_PIXEL_FORMAT_32 3
113
#define COGL_A_BIT (1 << 4)
114
#define COGL_BGR_BIT (1 << 5)
115
#define COGL_AFIRST_BIT (1 << 6)
116
#define COGL_PREMULT_BIT (1 << 7)
117
#define COGL_UNORDERED_MASK 0x0F
118
#define COGL_UNPREMULT_MASK 0x7F
122
* @COGL_PIXEL_FORMAT_ANY: Any format
123
* @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask
124
* @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
125
* @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
126
* @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
127
* @COGL_PIXEL_FORMAT_YUV: Not currently supported
128
* @COGL_PIXEL_FORMAT_G_8: Single luminance component
129
* @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
130
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
131
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
132
* @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits
133
* @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits
134
* @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits
135
* @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits
136
* @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits
137
* @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits
138
* @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits
139
* @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits
140
* @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits
142
* Pixel formats used by COGL. For the formats with a byte per
143
* component, the order of the components specify the order in
144
* increasing memory addresses. So for example
145
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
146
* lowest address, green in the next address and blue after that
147
* regardless of the endinanness of the system.
149
* For the 16-bit formats the component order specifies the order
150
* within a 16-bit number from most significant bit to least
151
* significant. So for %COGL_PIXEL_FORMAT_RGB_565, the red component
152
* would be in bits 11-15, the green component would be in 6-11 and
153
* the blue component would be in 1-5. Therefore the order in memory
154
* depends on the endianness of the system.
156
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
157
* internal format. Cogl will try to pick the best format to use
158
* internally and convert the texture data if necessary.
162
typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
163
COGL_PIXEL_FORMAT_ANY = 0,
164
COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT,
166
COGL_PIXEL_FORMAT_RGB_565 = 4,
167
COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT,
168
COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT,
169
COGL_PIXEL_FORMAT_YUV = 7,
170
COGL_PIXEL_FORMAT_G_8 = 8,
172
COGL_PIXEL_FORMAT_RGB_888 = COGL_PIXEL_FORMAT_24,
173
COGL_PIXEL_FORMAT_BGR_888 = (COGL_PIXEL_FORMAT_24 | COGL_BGR_BIT),
175
COGL_PIXEL_FORMAT_RGBA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT),
176
COGL_PIXEL_FORMAT_BGRA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT),
177
COGL_PIXEL_FORMAT_ARGB_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_AFIRST_BIT),
178
COGL_PIXEL_FORMAT_ABGR_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
180
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT),
181
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
182
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
183
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
184
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
185
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
190
* @COGL_FEATURE_TEXTURE_RECTANGLE: ARB_texture_rectangle support
191
* @COGL_FEATURE_TEXTURE_NPOT: ARB_texture_non_power_of_two support
192
* @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
193
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
194
* @COGL_FEATURE_SHADERS_GLSL: GLSL support
195
* @COGL_FEATURE_OFFSCREEN: FBO support
196
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
197
* @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
198
* @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available
199
* @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support
200
* @COGL_FEATURE_VBOS: VBO support
201
* @COGL_FEATURE_PBOS: PBO support
202
* @COGL_FEATURE_UNSIGNED_INT_INDICES: Set if
203
* %COGL_INDICES_TYPE_UNSIGNED_INT is supported in
204
* cogl_vertex_buffer_indices_new().
206
* Flags for the supported features.
212
COGL_FEATURE_TEXTURE_RECTANGLE = (1 << 1),
213
COGL_FEATURE_TEXTURE_NPOT = (1 << 2),
214
COGL_FEATURE_TEXTURE_YUV = (1 << 3),
215
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
216
COGL_FEATURE_SHADERS_GLSL = (1 << 5),
217
COGL_FEATURE_OFFSCREEN = (1 << 6),
218
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
219
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
220
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
221
COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
222
COGL_FEATURE_VBOS = (1 << 11),
223
COGL_FEATURE_PBOS = (1 << 12),
224
COGL_FEATURE_UNSIGNED_INT_INDICES = (1 << 13)
229
* @COGL_WINDOW_BUFFER: FIXME
230
* @COGL_OFFSCREEN_BUFFER: FIXME
232
* Target flags for FBOs.
238
COGL_WINDOW_BUFFER = (1 << 1),
239
COGL_OFFSCREEN_BUFFER = (1 << 2)
245
* A structure for holding a color definition. The contents of
246
* the CoglColor structure are private and should never by accessed
260
/* padding in case we want to change to floats at
269
* @x: Model x-coordinate
270
* @y: Model y-coordinate
271
* @z: Model z-coordinate
272
* @tx: Texture x-coordinate
273
* @ty: Texture y-coordinate
274
* @color: The color to use at this vertex. This is ignored if
275
* use_color is %FALSE when calling cogl_polygon()
277
* Used to specify vertex information when calling cogl_polygon()
279
struct _CoglTextureVertex
289
* @COGL_TEXTURE_NONE: No flags specified
290
* @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
291
* the mipmap pyramid from the base level image whenever it is
292
* updated. The mipmaps are only generated when the texture is
293
* rendered with a mipmap filter so it should be free to leave out
294
* this flag when using other filtering modes
295
* @COGL_TEXTURE_NO_SLICING: Disables the slicing of the texture
296
* @COGL_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside
297
* the texture atlas used by Cogl
299
* Flags to pass to the cogl_texture_new_* family of functions.
304
COGL_TEXTURE_NONE = 0,
305
COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
306
COGL_TEXTURE_NO_SLICING = 1 << 1,
307
COGL_TEXTURE_NO_ATLAS = 1 << 2
312
* @COGL_FOG_MODE_LINEAR: Calculates the fog blend factor as:
314
* f = end - eye_distance / end - start
316
* @COGL_FOG_MODE_EXPONENTIAL: Calculates the fog blend factor as:
318
* f = e ^ -(density * eye_distance)
320
* @COGL_FOG_MODE_EXPONENTIAL_SQUARED: Calculates the fog blend factor as:
322
* f = e ^ -(density * eye_distance)^2
325
* The fog mode determines the equation used to calculate the fogging blend
326
* factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
330
* f = end - eye_distance / end - start
333
* Where eye_distance is the distance of the current fragment in eye
334
* coordinates from the origin.
339
COGL_FOG_MODE_LINEAR,
340
COGL_FOG_MODE_EXPONENTIAL,
341
COGL_FOG_MODE_EXPONENTIAL_SQUARED
345
* COGL_BLEND_STRING_ERROR:
347
* #GError domain for blend string parser errors
351
#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ())
354
* CoglBlendStringError:
355
* @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error
356
* @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error
357
* @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error
358
* @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not
359
* supported by the GPU
361
* Error enumeration for the blend strings parser
365
typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/
366
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
367
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
368
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
369
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
370
} CoglBlendStringError;
373
cogl_blend_string_error_quark (void);
377
#endif /* __COGL_TYPES_H__ */