2009-04-27 14:48:12 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
2009-03-09 17:06:22 +00:00
|
|
|
*
|
2009-04-27 14:48:12 +00:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2008-10-30 17:57:41 +00:00
|
|
|
*
|
2009-04-27 14:48:12 +00:00
|
|
|
* Copyright (C) 2008,2009 Intel Corporation.
|
2008-10-30 17:57:41 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-04-27 14:48:12 +00:00
|
|
|
* version 2 of the License, or (at your option) any later version.
|
2008-10-30 17:57:41 +00:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-04-27 14:48:12 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
2008-10-30 17:57:41 +00:00
|
|
|
*/
|
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
#if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __COGL_TYPES_H__
|
|
|
|
#define __COGL_TYPES_H__
|
|
|
|
|
2009-02-19 12:02:42 +00:00
|
|
|
#include <glib-object.h>
|
2008-10-30 17:25:00 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglHandle:
|
|
|
|
*
|
|
|
|
* Type used for storing references to cogl objects, the CoglHandle is
|
|
|
|
* a fully opaque type without any public data members.
|
|
|
|
*/
|
|
|
|
typedef gpointer CoglHandle;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* COGL_INVALID_HANDLE:
|
|
|
|
*
|
|
|
|
* A COGL handle that is not valid, used for unitialized handles as well as
|
|
|
|
* error conditions.
|
|
|
|
*/
|
|
|
|
#define COGL_INVALID_HANDLE NULL
|
|
|
|
|
2009-02-19 12:02:42 +00:00
|
|
|
#define COGL_TYPE_HANDLE (cogl_handle_get_type ())
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
GType
|
|
|
|
cogl_handle_get_type (void) G_GNUC_CONST;
|
2009-02-19 12:02:42 +00:00
|
|
|
|
2009-07-20 11:49:35 +00:00
|
|
|
/**
|
|
|
|
* cogl_handle_ref:
|
|
|
|
* @handle: a #CoglHandle
|
|
|
|
*
|
|
|
|
* Increases the reference count of @handle by 1
|
|
|
|
*
|
|
|
|
* Returns: the handle, with its reference count increased
|
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
CoglHandle
|
|
|
|
cogl_handle_ref (CoglHandle handle);
|
2009-07-20 11:49:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_handle_unref:
|
|
|
|
* @handle: a #CoglHandle
|
|
|
|
*
|
|
|
|
* Drecreases the reference count of @handle by 1; if the reference
|
|
|
|
* count reaches 0, the resources allocated by @handle will be freed
|
|
|
|
*/
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
void
|
|
|
|
cogl_handle_unref (CoglHandle Handle);
|
2009-02-19 12:02:42 +00:00
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
/**
|
|
|
|
* CoglFuncPtr:
|
|
|
|
*
|
|
|
|
* The type used by cogl for function pointers, note that this type
|
|
|
|
* is used as a generic catch-all cast for function pointers and the
|
|
|
|
* actual arguments and return type may be different.
|
|
|
|
*/
|
|
|
|
typedef void (* CoglFuncPtr) (void);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglFixed:
|
|
|
|
*
|
|
|
|
* Fixed point number using a (16.16) notation.
|
|
|
|
*/
|
|
|
|
typedef gint32 CoglFixed;
|
|
|
|
|
2009-03-09 17:06:22 +00:00
|
|
|
#define COGL_TYPE_FIXED (cogl_fixed_get_type ())
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
GType
|
|
|
|
cogl_fixed_get_type (void) G_GNUC_CONST;
|
2009-03-09 17:06:22 +00:00
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
/**
|
|
|
|
* CoglAngle:
|
|
|
|
*
|
|
|
|
* Integer representation of an angle such that 1024 corresponds to
|
|
|
|
* full circle (i.e., 2 * pi).
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef gint32 CoglAngle;
|
|
|
|
|
|
|
|
typedef struct _CoglColor CoglColor;
|
|
|
|
typedef struct _CoglTextureVertex CoglTextureVertex;
|
|
|
|
|
|
|
|
/* Enum declarations */
|
|
|
|
|
|
|
|
#define COGL_PIXEL_FORMAT_24 2
|
|
|
|
#define COGL_PIXEL_FORMAT_32 3
|
|
|
|
#define COGL_A_BIT (1 << 4)
|
|
|
|
#define COGL_BGR_BIT (1 << 5)
|
|
|
|
#define COGL_AFIRST_BIT (1 << 6)
|
|
|
|
#define COGL_PREMULT_BIT (1 << 7)
|
|
|
|
#define COGL_UNORDERED_MASK 0x0F
|
|
|
|
#define COGL_UNPREMULT_MASK 0x7F
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglPixelFormat:
|
2009-01-09 14:26:35 +00:00
|
|
|
* @COGL_PIXEL_FORMAT_ANY: Any format
|
|
|
|
* @COGL_PIXEL_FORMAT_A_8: 8 bits alpha mask
|
|
|
|
* @COGL_PIXEL_FORMAT_RGB_565: RGB, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_4444: RGBA, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_5551: RGBA, 16 bits
|
2010-01-27 12:06:22 +00:00
|
|
|
* @COGL_PIXEL_FORMAT_YUV: Not currently supported
|
|
|
|
* @COGL_PIXEL_FORMAT_G_8: Single luminance component
|
2009-01-09 14:26:35 +00:00
|
|
|
* @COGL_PIXEL_FORMAT_RGB_888: RGB, 24 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGR_888: BGR, 24 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_8888: RGBA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_8888: BGRA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_8888: ARGB, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_8888: ABGR, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_8888_PRE: Premultiplied RGBA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_BGRA_8888_PRE: Premultiplied BGRA, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ARGB_8888_PRE: Premultiplied ARGB, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_ABGR_8888_PRE: Premultiplied ABGR, 32 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_4444_PRE: Premultiplied RGBA, 16 bits
|
|
|
|
* @COGL_PIXEL_FORMAT_RGBA_5551_PRE: Premultiplied RGBA, 16 bits
|
2008-10-30 17:25:00 +00:00
|
|
|
*
|
2010-01-27 12:06:22 +00:00
|
|
|
* Pixel formats used by COGL. For the formats with a byte per
|
|
|
|
* component, the order of the components specify the order in
|
|
|
|
* increasing memory addresses. So for example
|
|
|
|
* %COGL_PIXEL_FORMAT_RGB_888 would have the red component in the
|
|
|
|
* lowest address, green in the next address and blue after that
|
|
|
|
* regardless of the endinanness of the system.
|
|
|
|
*
|
|
|
|
* For the 16-bit formats the component order specifies the order
|
|
|
|
* within a 16-bit number from most significant bit to least
|
|
|
|
* significant. So for %COGL_PIXEL_FORMAT_RGB_565, the red component
|
|
|
|
* would be in bits 11-15, the green component would be in 6-11 and
|
|
|
|
* the blue component would be in 1-5. Therefore the order in memory
|
|
|
|
* depends on the endianness of the system.
|
|
|
|
*
|
|
|
|
* When uploading a texture %COGL_PIXEL_FORMAT_ANY can be used as the
|
|
|
|
* internal format. Cogl will try to pick the best format to use
|
|
|
|
* internally and convert the texture data if necessary.
|
2009-01-09 14:26:35 +00:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2008-10-30 17:25:00 +00:00
|
|
|
*/
|
2009-05-29 11:31:47 +00:00
|
|
|
typedef enum { /*< prefix=COGL_PIXEL_FORMAT >*/
|
2008-10-30 17:25:00 +00:00
|
|
|
COGL_PIXEL_FORMAT_ANY = 0,
|
|
|
|
COGL_PIXEL_FORMAT_A_8 = 1 | COGL_A_BIT,
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_RGB_565 = 4,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_4444 = 5 | COGL_A_BIT,
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_5551 = 6 | COGL_A_BIT,
|
|
|
|
COGL_PIXEL_FORMAT_YUV = 7,
|
|
|
|
COGL_PIXEL_FORMAT_G_8 = 8,
|
2009-04-27 14:48:12 +00:00
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
COGL_PIXEL_FORMAT_RGB_888 = COGL_PIXEL_FORMAT_24,
|
2009-05-29 11:31:47 +00:00
|
|
|
COGL_PIXEL_FORMAT_BGR_888 = (COGL_PIXEL_FORMAT_24 | COGL_BGR_BIT),
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ABGR_8888 = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
|
|
|
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_BGRA_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ARGB_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_ABGR_8888_PRE = (COGL_PIXEL_FORMAT_32 | COGL_A_BIT | COGL_PREMULT_BIT | COGL_BGR_BIT | COGL_AFIRST_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_4444_PRE = (COGL_PIXEL_FORMAT_RGBA_4444 | COGL_A_BIT | COGL_PREMULT_BIT),
|
|
|
|
COGL_PIXEL_FORMAT_RGBA_5551_PRE = (COGL_PIXEL_FORMAT_RGBA_5551 | COGL_A_BIT | COGL_PREMULT_BIT),
|
2008-10-30 17:25:00 +00:00
|
|
|
} CoglPixelFormat;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglFeatureFlags:
|
2009-01-09 14:26:35 +00:00
|
|
|
* @COGL_FEATURE_TEXTURE_RECTANGLE: ARB_texture_rectangle support
|
|
|
|
* @COGL_FEATURE_TEXTURE_NPOT: ARB_texture_non_power_of_two support
|
|
|
|
* @COGL_FEATURE_TEXTURE_YUV: ycbcr conversion support
|
|
|
|
* @COGL_FEATURE_TEXTURE_READ_PIXELS: glReadPixels() support
|
|
|
|
* @COGL_FEATURE_SHADERS_GLSL: GLSL support
|
|
|
|
* @COGL_FEATURE_OFFSCREEN: FBO support
|
|
|
|
* @COGL_FEATURE_OFFSCREEN_MULTISAMPLE: Multisample support on FBOs
|
|
|
|
* @COGL_FEATURE_OFFSCREEN_BLIT: Blit support on FBOs
|
|
|
|
* @COGL_FEATURE_FOUR_CLIP_PLANES: At least 4 clip planes available
|
|
|
|
* @COGL_FEATURE_STENCIL_BUFFER: Stencil buffer support
|
|
|
|
* @COGL_FEATURE_VBOS: VBO support
|
2010-02-02 12:59:51 +00:00
|
|
|
* @COGL_FEATURE_PBOS: PBO support
|
2008-10-30 17:25:00 +00:00
|
|
|
*
|
|
|
|
* Flags for the supported features.
|
2009-01-09 14:26:35 +00:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2008-10-30 17:25:00 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_FEATURE_TEXTURE_RECTANGLE = (1 << 1),
|
|
|
|
COGL_FEATURE_TEXTURE_NPOT = (1 << 2),
|
|
|
|
COGL_FEATURE_TEXTURE_YUV = (1 << 3),
|
|
|
|
COGL_FEATURE_TEXTURE_READ_PIXELS = (1 << 4),
|
|
|
|
COGL_FEATURE_SHADERS_GLSL = (1 << 5),
|
|
|
|
COGL_FEATURE_OFFSCREEN = (1 << 6),
|
|
|
|
COGL_FEATURE_OFFSCREEN_MULTISAMPLE = (1 << 7),
|
|
|
|
COGL_FEATURE_OFFSCREEN_BLIT = (1 << 8),
|
|
|
|
COGL_FEATURE_FOUR_CLIP_PLANES = (1 << 9),
|
2008-11-10 18:53:14 +00:00
|
|
|
COGL_FEATURE_STENCIL_BUFFER = (1 << 10),
|
2010-02-02 12:59:51 +00:00
|
|
|
COGL_FEATURE_VBOS = (1 << 11),
|
|
|
|
COGL_FEATURE_PBOS = (1 << 12)
|
2008-10-30 17:25:00 +00:00
|
|
|
} CoglFeatureFlags;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglBufferTarget:
|
2009-01-09 14:26:35 +00:00
|
|
|
* @COGL_WINDOW_BUFFER: FIXME
|
|
|
|
* @COGL_OFFSCREEN_BUFFER: FIXME
|
2008-10-30 17:25:00 +00:00
|
|
|
*
|
2009-01-09 14:26:35 +00:00
|
|
|
* Target flags for FBOs.
|
2008-10-30 17:25:00 +00:00
|
|
|
*
|
2009-01-09 14:26:35 +00:00
|
|
|
* Since: 0.8
|
2008-10-30 17:25:00 +00:00
|
|
|
*/
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_WINDOW_BUFFER = (1 << 1),
|
2009-04-30 21:19:43 +00:00
|
|
|
COGL_OFFSCREEN_BUFFER = (1 << 2)
|
2008-10-30 17:25:00 +00:00
|
|
|
} CoglBufferTarget;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglColor:
|
|
|
|
*
|
|
|
|
* A structure for holding a color definition. The contents of
|
|
|
|
* the CoglColor structure are private and should never by accessed
|
|
|
|
* directly.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
struct _CoglColor
|
|
|
|
{
|
|
|
|
/*< private >*/
|
2008-11-12 13:57:58 +00:00
|
|
|
guint8 red;
|
|
|
|
guint8 green;
|
|
|
|
guint8 blue;
|
2008-10-30 17:25:00 +00:00
|
|
|
|
2008-11-12 13:57:58 +00:00
|
|
|
guint8 alpha;
|
2009-01-27 11:01:23 +00:00
|
|
|
|
|
|
|
/* padding in case we want to change to floats at
|
|
|
|
* some point */
|
|
|
|
guint32 padding0;
|
|
|
|
guint32 padding1;
|
|
|
|
guint32 padding2;
|
2008-10-30 17:25:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CoglTextureVertex:
|
|
|
|
* @x: Model x-coordinate
|
|
|
|
* @y: Model y-coordinate
|
|
|
|
* @z: Model z-coordinate
|
|
|
|
* @tx: Texture x-coordinate
|
|
|
|
* @ty: Texture y-coordinate
|
|
|
|
* @color: The color to use at this vertex. This is ignored if
|
2009-08-18 10:11:29 +00:00
|
|
|
* use_color is %FALSE when calling cogl_polygon()
|
2008-10-30 17:25:00 +00:00
|
|
|
*
|
2009-08-18 10:11:29 +00:00
|
|
|
* Used to specify vertex information when calling cogl_polygon()
|
2008-10-30 17:25:00 +00:00
|
|
|
*/
|
|
|
|
struct _CoglTextureVertex
|
|
|
|
{
|
2009-01-20 16:20:54 +00:00
|
|
|
float x, y, z;
|
|
|
|
float tx, ty;
|
2009-08-18 10:11:29 +00:00
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
CoglColor color;
|
|
|
|
};
|
|
|
|
|
2009-01-18 14:51:19 +00:00
|
|
|
/**
|
|
|
|
* CoglTextureFlags:
|
|
|
|
* @COGL_TEXTURE_NONE: No flags specified
|
2009-06-04 15:04:57 +00:00
|
|
|
* @COGL_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
|
|
|
|
* the mipmap pyramid from the base level image whenever it is
|
|
|
|
* updated. The mipmaps are only generated when the texture is
|
|
|
|
* rendered with a mipmap filter so it should be free to leave out
|
2010-02-09 14:41:37 +00:00
|
|
|
* this flag when using other filtering modes
|
[cogl] Remove max_waste argument from Texture ctors
The CoglTexture constructors expose the "max-waste" argument for
controlling the maximum amount of wasted areas for slicing or,
if set to -1, disables slicing.
Slicing is really relevant only for large images that are never
repeated, so it's a useful feature only in controlled use cases.
Specifying the amount of wasted area is, on the other hand, just
a way to mess up this feature; 99% the times, you either pull this
number out of thin air, hoping it's right, or you try to do the
right thing and you choose the wrong number anyway.
Instead, we can use the CoglTextureFlags to control whether the
texture should not be sliced (useful for Clutter-GST and for the
texture-from-pixmap actors) and provide a reasonable value for
enabling the slicing ourself. At some point, we might even
provide a way to change the default at compile time or at run time,
for particular platforms.
Since max_waste is gone, the :tile-waste property of ClutterTexture
becomes read-only, and it proxies the cogl_texture_get_max_waste()
function.
Inside Clutter, the only cases where the max_waste argument was
not set to -1 are in the Pango glyph cache (which is a POT texture
anyway) and inside the test cases where we want to force slicing;
for the latter we can create larger textures that will be bigger than
the threshold we set.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-05-23 18:18:18 +00:00
|
|
|
* @COGL_TEXTURE_NO_SLICING: Disables the slicing of the texture
|
2010-02-09 14:41:37 +00:00
|
|
|
* @COGL_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside
|
|
|
|
* the texture atlas used by Cogl
|
2009-01-18 14:51:19 +00:00
|
|
|
*
|
|
|
|
* Flags to pass to the cogl_texture_new_* family of functions.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2009-06-04 15:04:57 +00:00
|
|
|
COGL_TEXTURE_NONE = 0,
|
|
|
|
COGL_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
|
2009-12-04 13:06:32 +00:00
|
|
|
COGL_TEXTURE_NO_SLICING = 1 << 1,
|
|
|
|
COGL_TEXTURE_NO_ATLAS = 1 << 2
|
2009-01-18 14:51:19 +00:00
|
|
|
} CoglTextureFlags;
|
|
|
|
|
2009-03-09 17:06:22 +00:00
|
|
|
/**
|
|
|
|
* CoglFogMode:
|
|
|
|
* @COGL_FOG_MODE_LINEAR: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = end - eye_distance / end - start
|
|
|
|
* ]|
|
|
|
|
* @COGL_FOG_MODE_EXPONENTIAL: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = e ^ -(density * eye_distance)
|
|
|
|
* ]|
|
|
|
|
* @COGL_FOG_MODE_EXPONENTIAL_SQUARED: Calculates the fog blend factor as:
|
|
|
|
* |[
|
|
|
|
* f = e ^ -(density * eye_distance)^2
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* The fog mode determines the equation used to calculate the fogging blend
|
|
|
|
* factor while fogging is enabled. The simplest %COGL_FOG_MODE_LINEAR mode
|
|
|
|
* determines f as:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* f = end - eye_distance / end - start
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* Where eye_distance is the distance of the current fragment in eye
|
|
|
|
* coordinates from the origin.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-05-29 11:31:47 +00:00
|
|
|
typedef enum {
|
2009-03-09 17:06:22 +00:00
|
|
|
COGL_FOG_MODE_LINEAR,
|
|
|
|
COGL_FOG_MODE_EXPONENTIAL,
|
|
|
|
COGL_FOG_MODE_EXPONENTIAL_SQUARED
|
|
|
|
} CoglFogMode;
|
|
|
|
|
2010-02-09 14:41:37 +00:00
|
|
|
/**
|
|
|
|
* COGL_BLEND_STRING_ERROR:
|
|
|
|
*
|
|
|
|
* #GError domain for blend string parser errors
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-07-20 11:47:53 +00:00
|
|
|
#define COGL_BLEND_STRING_ERROR (cogl_blend_string_error_quark ())
|
|
|
|
|
2010-02-09 14:41:37 +00:00
|
|
|
/**
|
|
|
|
* CoglBlendStringError:
|
|
|
|
* @COGL_BLEND_STRING_ERROR_PARSE_ERROR: Generic parse error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR: Argument parse error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_INVALID_ERROR: Internal parser error
|
|
|
|
* @COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR: Blend string not
|
|
|
|
* supported by the GPU
|
|
|
|
*
|
|
|
|
* Error enumeration for the blend strings parser
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
|
|
|
*/
|
2009-07-20 11:47:53 +00:00
|
|
|
typedef enum { /*< prefix=COGL_BLEND_STRING_ERROR >*/
|
|
|
|
COGL_BLEND_STRING_ERROR_PARSE_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_INVALID_ERROR,
|
|
|
|
COGL_BLEND_STRING_ERROR_GPU_UNSUPPORTED_ERROR
|
|
|
|
} CoglBlendStringError;
|
|
|
|
|
cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so
this is a first pass at tidying things up by giving them some
consistency. These changes are all consistent with how new code in Cogl
is being written, but the style isn't consistently applied across all
code yet.
There are two parts to this patch; but since each one required a large
amount of effort to maintain tidy indenting it made sense to combine the
changes to reduce the time spent re indenting the same lines.
The first change is to use a consistent style for declaring function
prototypes in headers. Cogl headers now consistently use this style for
prototypes:
return_type
cogl_function_name (CoglType arg0,
CoglType arg1);
Not everyone likes this style, but it seems that most of the currently
active Cogl developers agree on it.
The second change is to constrain the use of redundant glib data types
in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all
been replaced with int, unsigned int, float, long, unsigned long and char
respectively. When talking about pixel data; use of guchar has been
replaced with guint8, otherwise unsigned char can be used.
The glib types that we continue to use for portability are gboolean,
gint{8,16,32,64}, guint{8,16,32,64} and gsize.
The general intention is that Cogl should look palatable to the widest
range of C programmers including those outside the Gnome community so
- especially for the public API - we want to minimize the number of
foreign looking typedefs.
2010-02-10 01:57:32 +00:00
|
|
|
GQuark
|
|
|
|
cogl_blend_string_error_quark (void);
|
2009-07-20 11:47:53 +00:00
|
|
|
|
2008-10-30 17:25:00 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __COGL_TYPES_H__ */
|