2009-03-30 16:07:31 +00:00
|
|
|
/*
|
|
|
|
* Cogl
|
|
|
|
*
|
2009-04-27 14:48:12 +00:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
2009-03-30 16:07:31 +00: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-10 01:57:32 +00:00
|
|
|
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
|
2009-03-30 16:07:31 +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
|
|
|
|
* 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 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*
|
2009-03-30 16:07:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __COGL_INTERNAL_H
|
|
|
|
#define __COGL_INTERNAL_H
|
|
|
|
|
2010-05-24 11:40:11 +00:00
|
|
|
#include "cogl-bitmask.h"
|
2009-10-13 22:09:42 +00:00
|
|
|
|
2009-10-13 14:27:06 +00:00
|
|
|
#ifdef COGL_HAS_XLIB_SUPPORT
|
2010-11-05 12:28:33 +00:00
|
|
|
#include <X11/Xutil.h>
|
2009-10-13 14:27:06 +00:00
|
|
|
#endif
|
|
|
|
|
2009-05-19 15:00:18 +00:00
|
|
|
#ifdef COGL_GL_DEBUG
|
2009-03-30 16:07:31 +00: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-10 01:57:32 +00:00
|
|
|
const char *
|
|
|
|
cogl_gl_error_to_string (GLenum error_code);
|
2009-05-18 18:38:03 +00:00
|
|
|
|
2011-07-06 20:51:00 +00:00
|
|
|
#define GE(ctx, x) G_STMT_START { \
|
2009-05-19 13:44:29 +00:00
|
|
|
GLenum __err; \
|
2011-07-06 20:51:00 +00:00
|
|
|
(ctx)->x; \
|
|
|
|
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
|
2009-05-19 13:44:29 +00:00
|
|
|
{ \
|
|
|
|
g_warning ("%s: GL error (%d): %s\n", \
|
|
|
|
G_STRLOC, \
|
2009-05-21 14:04:38 +00:00
|
|
|
__err, \
|
2009-05-19 13:44:29 +00:00
|
|
|
cogl_gl_error_to_string (__err)); \
|
|
|
|
} } G_STMT_END
|
2009-03-30 16:07:31 +00:00
|
|
|
|
2011-07-06 20:51:00 +00:00
|
|
|
#define GE_RET(ret, ctx, x) G_STMT_START { \
|
2010-01-11 00:15:25 +00:00
|
|
|
GLenum __err; \
|
2011-07-06 20:51:00 +00:00
|
|
|
ret = (ctx)->x; \
|
|
|
|
while ((__err = (ctx)->glGetError ()) != GL_NO_ERROR) \
|
2010-01-11 00:15:25 +00:00
|
|
|
{ \
|
|
|
|
g_warning ("%s: GL error (%d): %s\n", \
|
|
|
|
G_STRLOC, \
|
|
|
|
__err, \
|
|
|
|
cogl_gl_error_to_string (__err)); \
|
|
|
|
} } G_STMT_END
|
|
|
|
|
2009-05-19 13:44:29 +00:00
|
|
|
#else /* !COGL_GL_DEBUG */
|
2009-03-30 16:07:31 +00:00
|
|
|
|
2011-07-06 20:51:00 +00:00
|
|
|
#define GE(ctx, x) ((ctx)->x)
|
|
|
|
#define GE_RET(ret, ctx, x) (ret = ((ctx)->x))
|
2009-03-30 16:07:31 +00:00
|
|
|
|
2009-05-19 13:44:29 +00:00
|
|
|
#endif /* COGL_GL_DEBUG */
|
2009-03-30 16:07:31 +00:00
|
|
|
|
2010-04-08 11:21:04 +00: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 16:07:31 +00: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-10 01:57:32 +00:00
|
|
|
void
|
2010-03-19 09:16:08 +00:00
|
|
|
_cogl_enable (unsigned long flags);
|
2009-03-30 16:07:31 +00: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-10 01:57:32 +00:00
|
|
|
unsigned long
|
2010-03-19 09:16:08 +00:00
|
|
|
_cogl_get_enable (void);
|
2009-03-30 16:07:31 +00:00
|
|
|
|
2010-04-22 12:48:49 +00:00
|
|
|
void
|
|
|
|
_cogl_transform_point (const CoglMatrix *matrix_mv,
|
|
|
|
const CoglMatrix *matrix_p,
|
|
|
|
const float *viewport,
|
|
|
|
float *x,
|
|
|
|
float *y);
|
|
|
|
|
2010-11-05 12:28:33 +00:00
|
|
|
#define COGL_DRIVER_ERROR (_cogl_driver_error_quark ())
|
2010-05-19 15:13:07 +00:00
|
|
|
|
2010-11-05 12:28:33 +00:00
|
|
|
typedef enum { /*< prefix=COGL_DRIVER_ERROR >*/
|
|
|
|
COGL_DRIVER_ERROR_UNKNOWN_VERSION,
|
2011-07-07 19:44:56 +00:00
|
|
|
COGL_DRIVER_ERROR_INVALID_VERSION,
|
|
|
|
COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND,
|
|
|
|
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY
|
2010-11-05 12:28:33 +00:00
|
|
|
} CoglDriverError;
|
2009-11-14 14:59:59 +00:00
|
|
|
|
2011-07-07 19:44:56 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
COGL_DRIVER_GL,
|
|
|
|
COGL_DRIVER_GLES1,
|
|
|
|
COGL_DRIVER_GLES2
|
|
|
|
} CoglDriver;
|
|
|
|
|
2011-05-24 21:34:10 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
2011-07-05 13:13:12 +00:00
|
|
|
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE = 1L<<0,
|
2011-10-12 21:37:29 +00:00
|
|
|
COGL_PRIVATE_FEATURE_MESA_PACK_INVERT = 1L<<1,
|
2011-10-12 21:47:42 +00:00
|
|
|
COGL_PRIVATE_FEATURE_STENCIL_BUFFER = 1L<<2,
|
2011-10-13 08:24:58 +00:00
|
|
|
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT = 1L<<3,
|
2011-10-13 08:30:33 +00:00
|
|
|
COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES = 1L<<4,
|
2011-10-13 08:36:46 +00:00
|
|
|
COGL_PRIVATE_FEATURE_PBOS = 1L<<5,
|
|
|
|
COGL_PRIVATE_FEATURE_VBOS = 1L<<6
|
2011-05-24 21:34:10 +00:00
|
|
|
} CoglPrivateFeatureFlags;
|
|
|
|
|
2011-09-08 23:40:06 +00: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 14:59:59 +00:00
|
|
|
gboolean
|
2010-11-05 12:28:33 +00:00
|
|
|
_cogl_check_extension (const char *name, const char *ext);
|
|
|
|
|
|
|
|
GQuark
|
|
|
|
_cogl_driver_error_quark (void);
|
2009-11-14 14:59:59 +00:00
|
|
|
|
2009-03-30 16:07:31 +00:00
|
|
|
#endif /* __COGL_INTERNAL_H */
|