2009-03-30 12:07:31 -04:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2009-03-30 12:07:31 -04:00
|
|
|
*
|
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-09 20:57:32 -05:00
|
|
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
2009-03-30 12:07:31 -04: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
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
2010-03-01 07:56:10 -05:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-03-30 12:07:31 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COGL_INTERNAL_H
|
|
|
|
#define __COGL_INTERNAL_H
|
|
|
|
|
2010-05-24 07:40:11 -04:00
|
|
|
#include "cogl-bitmask.h"
|
2009-10-13 18:09:42 -04:00
|
|
|
|
2009-10-13 10:27:06 -04:00
|
|
|
#ifdef COGL_HAS_XLIB_SUPPORT
|
2010-11-05 08:28:33 -04:00
|
|
|
#include <X11/Xutil.h>
|
2009-10-13 10:27:06 -04:00
|
|
|
#endif
|
|
|
|
|
2009-05-19 11:00:18 -04:00
|
|
|
#ifdef COGL_GL_DEBUG
|
2009-03-30 12:07:31 -04:00
|
|
|
|
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-09 20:57:32 -05:00
|
|
|
const char *
|
2012-03-09 11:40:42 -05:00
|
|
|
_cogl_gl_error_to_string (GLenum error_code);
|
2009-05-18 14:38:03 -04:00
|
|
|
|
2011-07-06 16:51:00 -04:00
|
|
|
#define GE(ctx, x) G_STMT_START { \
|
2009-05-19 09:44:29 -04:00
|
|
|
GLenum __err; \
|
2011-07-06 16:51:00 -04:00
|
|
|
(ctx)->x; \
|
|
|
|
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
|
2009-05-19 09:44:29 -04:00
|
|
|
{ \
|
|
|
|
g_warning ("%s: GL error (%d): %s\n", \
|
|
|
|
G_STRLOC, \
|
2009-05-21 10:04:38 -04:00
|
|
|
__err, \
|
2012-03-09 11:40:42 -05:00
|
|
|
_cogl_gl_error_to_string (__err)); \
|
2009-05-19 09:44:29 -04:00
|
|
|
} } G_STMT_END
|
2009-03-30 12:07:31 -04:00
|
|
|
|
2011-07-06 16:51:00 -04:00
|
|
|
#define GE_RET(ret, ctx, x) G_STMT_START { \
|
2010-01-10 19:15:25 -05:00
|
|
|
GLenum __err; \
|
2011-07-06 16:51:00 -04:00
|
|
|
ret = (ctx)->x; \
|
|
|
|
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
|
2010-01-10 19:15:25 -05:00
|
|
|
{ \
|
|
|
|
g_warning ("%s: GL error (%d): %s\n", \
|
|
|
|
G_STRLOC, \
|
|
|
|
__err, \
|
2012-03-09 11:40:42 -05:00
|
|
|
_cogl_gl_error_to_string (__err)); \
|
2010-01-10 19:15:25 -05:00
|
|
|
} } G_STMT_END
|
|
|
|
|
2009-05-19 09:44:29 -04:00
|
|
|
#else /* !COGL_GL_DEBUG */
|
2009-03-30 12:07:31 -04:00
|
|
|
|
2011-07-06 16:51:00 -04:00
|
|
|
#define GE(ctx, x) ((ctx)->x)
|
|
|
|
#define GE_RET(ret, ctx, x) (ret = ((ctx)->x))
|
2009-03-30 12:07:31 -04:00
|
|
|
|
2009-05-19 09:44:29 -04:00
|
|
|
#endif /* COGL_GL_DEBUG */
|
2009-03-30 12:07:31 -04:00
|
|
|
|
2010-04-08 07:21:04 -04:00
|
|
|
#define COGL_ENABLE_ALPHA_TEST (1<<1)
|
|
|
|
#define COGL_ENABLE_VERTEX_ARRAY (1<<2)
|
|
|
|
#define COGL_ENABLE_COLOR_ARRAY (1<<3)
|
2009-03-30 12:07:31 -04:00
|
|
|
|
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-09 20:57:32 -05:00
|
|
|
void
|
2010-03-19 05:16:08 -04:00
|
|
|
_cogl_enable (unsigned long flags);
|
2009-03-30 12:07:31 -04:00
|
|
|
|
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-09 20:57:32 -05:00
|
|
|
unsigned long
|
2010-03-19 05:16:08 -04:00
|
|
|
_cogl_get_enable (void);
|
2009-03-30 12:07:31 -04:00
|
|
|
|
2010-04-22 08:48:49 -04:00
|
|
|
void
|
|
|
|
_cogl_transform_point (const CoglMatrix *matrix_mv,
|
|
|
|
const CoglMatrix *matrix_p,
|
|
|
|
const float *viewport,
|
|
|
|
float *x,
|
|
|
|
float *y);
|
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ())
|
2010-05-19 11:13:07 -04:00
|
|
|
|
2010-11-05 08:28:33 -04:00
|
|
|
typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/
|
|
|
|
COGL_DRIVER_ERROR_UNKNOWN_VERSION,
|
2011-07-07 15:44:56 -04:00
|
|
|
COGL_DRIVER_ERROR_INVALID_VERSION,
|
|
|
|
COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND,
|
|
|
|
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY
|
2010-11-05 08:28:33 -04:00
|
|
|
} CoglDriverError;
|
2009-11-14 09:59:59 -05:00
|
|
|
|
2011-05-24 17:34:10 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
2011-07-05 09:13:12 -04:00
|
|
|
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE = 1L<<0,
|
2011-10-12 17:37:29 -04:00
|
|
|
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT = 1L<<1,
|
2011-10-12 17:47:42 -04:00
|
|
|
COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2,
|
2011-10-13 04:24:58 -04:00
|
|
|
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3,
|
2011-10-13 04:30:33 -04:00
|
|
|
COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4,
|
2011-10-13 04:36:46 -04:00
|
|
|
COGL_PRIVATE_FEATURE_PBOS = 1L<<5,
|
2012-02-22 11:55:34 -05:00
|
|
|
COGL_PRIVATE_FEATURE_VBOS = 1L<<6,
|
2012-02-22 12:02:28 -05:00
|
|
|
COGL_PRIVATE_FEATURE_EXT_PACKED_DEPTH_STENCIL = 1L<<7,
|
2012-03-21 12:06:59 -04:00
|
|
|
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL = 1L<<8,
|
2012-03-21 13:51:51 -04:00
|
|
|
COGL_PRIVATE_FEATURE_TEXTURE_FORMAT_BGRA8888 = 1L<<9,
|
|
|
|
COGL_PRIVATE_FEATURE_UNPACK_SUBIMAGE = 1L<<10
|
2011-05-24 17:34:10 -04:00
|
|
|
} CoglPrivateFeatureFlags;
|
|
|
|
|
2011-09-08 19:40:06 -04:00
|
|
|
/* Sometimes when evaluating pipelines, either during comparisons or
|
|
|
|
* if calculating a hash value we need to tweak the evaluation
|
|
|
|
* semantics */
|
|
|
|
typedef enum _CoglPipelineEvalFlags
|
|
|
|
{
|
|
|
|
COGL_PIPELINE_EVAL_FLAG_NONE = 0
|
|
|
|
} CoglPipelineEvalFlags;
|
|
|
|
|
2009-11-14 09:59:59 -05:00
|
|
|
gboolean
|
2010-11-05 08:28:33 -04:00
|
|
|
_cogl_check_extension (const char *name, const char *ext);
|
|
|
|
|
|
|
|
GQuark
|
|
|
|
_cogl_driver_error_quark (void);
|
2009-11-14 09:59:59 -05:00
|
|
|
|
2009-03-30 12:07:31 -04:00
|
|
|
#endif /* __COGL_INTERNAL_H */
|