2009-04-27 10:48:12 -04:00
|
|
|
/*
|
|
|
|
* Cogl
|
2008-10-30 13:57:41 -04:00
|
|
|
*
|
2009-04-27 10:48:12 -04:00
|
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
|
|
*
|
|
|
|
* Copyright (C) 2008,2009 Intel Corporation.
|
2008-10-30 13:57:41 -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/>.
|
|
|
|
*
|
|
|
|
*
|
2008-10-30 13:57:41 -04:00
|
|
|
*/
|
|
|
|
|
2012-06-20 13:49:08 -04:00
|
|
|
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
|
2008-10-30 13:25:00 -04:00
|
|
|
#error "Only <cogl/cogl.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef __COGL_SHADER_H__
|
|
|
|
#define __COGL_SHADER_H__
|
|
|
|
|
2009-05-06 05:35:28 -04:00
|
|
|
#include <cogl/cogl-types.h>
|
2010-01-05 12:54:45 -05:00
|
|
|
#include <cogl/cogl-defines.h>
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
COGL_BEGIN_DECLS
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:cogl-shaders
|
|
|
|
* @short_description: Fuctions for accessing the programmable GL pipeline
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Cogl allows accessing the GL programmable pipeline in order to create
|
2008-10-30 13:25:00 -04:00
|
|
|
* vertex and fragment shaders.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* The shader source code can either be GLSL or ARBfp. If the source
|
|
|
|
* code is ARBfp, it must begin with the string “!!ARBfp1.0”. The
|
|
|
|
* application should check for the %COGL_FEATURE_SHADERS_GLSL or
|
|
|
|
* %COGL_FEATURE_SHADERS_ARBFP features before using shaders.
|
|
|
|
*
|
|
|
|
* When using GLSL Cogl provides replacement names for most of the
|
|
|
|
* builtin varyings and uniforms. It is recommended to use these names
|
|
|
|
* wherever possible to increase portability between OpenGL 2.0 and
|
|
|
|
* GLES 2.0. GLES 2.0 does not have most of the builtins under their
|
|
|
|
* original names so they will only work with the Cogl names.
|
|
|
|
*
|
|
|
|
* For use in all GLSL shaders, the Cogl builtins are as follows:
|
|
|
|
*
|
|
|
|
* <tip>
|
|
|
|
* <glosslist>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>uniform mat4
|
|
|
|
* <emphasis>cogl_modelview_matrix</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The current modelview matrix. This is equivalent to
|
|
|
|
* #gl_ModelViewMatrix.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>uniform mat4
|
|
|
|
* <emphasis>cogl_projection_matrix</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The current projection matrix. This is equivalent to
|
|
|
|
* #gl_ProjectionMatrix.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>uniform mat4
|
|
|
|
* <emphasis>cogl_modelview_projection_matrix</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The combined modelview and projection matrix. A vertex shader
|
|
|
|
* would typically use this to transform the incoming vertex
|
|
|
|
* position. The separate modelview and projection matrices are
|
|
|
|
* usually only needed for lighting calculations. This is
|
|
|
|
* equivalent to #gl_ModelViewProjectionMatrix.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>uniform mat4
|
|
|
|
* <emphasis>cogl_texture_matrix</emphasis>[]</glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* An array of matrices for transforming the texture
|
|
|
|
* coordinates. This is equivalent to #gl_TextureMatrix.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* </glosslist>
|
|
|
|
* </tip>
|
|
|
|
*
|
|
|
|
* In a vertex shader, the following are also available:
|
|
|
|
*
|
|
|
|
* <tip>
|
|
|
|
* <glosslist>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>attribute vec4
|
|
|
|
* <emphasis>cogl_position_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The incoming vertex position. This is equivalent to #gl_Vertex.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>attribute vec4
|
|
|
|
* <emphasis>cogl_color_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The incoming vertex color. This is equivalent to #gl_Color.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>attribute vec4
|
|
|
|
* <emphasis>cogl_tex_coord_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The texture coordinate for the first texture unit. This is
|
|
|
|
* equivalent to #gl_MultiTexCoord0.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>attribute vec4
|
|
|
|
* <emphasis>cogl_tex_coord0_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The texture coordinate for the first texture unit. This is
|
|
|
|
* equivalent to #gl_MultiTexCoord0. There is also
|
|
|
|
* #cogl_tex_coord1_in and so on.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>attribute vec3
|
|
|
|
* <emphasis>cogl_normal_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The normal of the vertex. This is equivalent to #gl_Normal.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>vec4
|
|
|
|
* <emphasis>cogl_position_out</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The calculated position of the vertex. This must be written to
|
|
|
|
* in all vertex shaders. This is equivalent to #gl_Position.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>float
|
|
|
|
* <emphasis>cogl_point_size_out</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The calculated size of a point. This is equivalent to #gl_PointSize.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>varying vec4
|
|
|
|
* <emphasis>cogl_color_out</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The calculated color of a vertex. This is equivalent to #gl_FrontColor.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>varying vec4
|
|
|
|
* <emphasis>cogl_tex_coord_out</emphasis>[]</glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* An array of calculated texture coordinates for a vertex. This is
|
|
|
|
* equivalent to #gl_TexCoord.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* </glosslist>
|
|
|
|
* </tip>
|
|
|
|
*
|
|
|
|
* In a fragment shader, the following are also available:
|
|
|
|
*
|
|
|
|
* <tip>
|
|
|
|
* <glosslist>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>varying vec4 <emphasis>cogl_color_in</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The calculated color of a vertex. This is equivalent to #gl_FrontColor.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>varying vec4
|
|
|
|
* <emphasis>cogl_tex_coord_in</emphasis>[]</glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* An array of calculated texture coordinates for a vertex. This is
|
|
|
|
* equivalent to #gl_TexCoord.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>vec4 <emphasis>cogl_color_out</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* The final calculated color of the fragment. All fragment shaders
|
|
|
|
* must write to this variable. This is equivalent to
|
|
|
|
* #gl_FrontColor.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>float <emphasis>cogl_depth_out</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* An optional output variable specifying the depth value to use
|
|
|
|
* for this fragment. This is equivalent to #gl_FragDepth.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* <glossentry>
|
|
|
|
* <glossterm>bool <emphasis>cogl_front_facing</emphasis></glossterm>
|
|
|
|
* <glossdef><para>
|
|
|
|
* A readonly variable that will be true if the current primitive
|
|
|
|
* is front facing. This can be used to implement two-sided
|
|
|
|
* coloring algorithms. This is equivalent to #gl_FrontFacing.
|
|
|
|
* </para></glossdef>
|
|
|
|
* </glossentry>
|
|
|
|
* </glosslist>
|
|
|
|
* </tip>
|
|
|
|
*
|
|
|
|
* It's worth nothing that this API isn't what Cogl would like to have
|
2011-12-06 14:17:03 -05:00
|
|
|
* in the long term and it may be removed in Cogl 2.0. The
|
|
|
|
* experimental #CoglShader API is the proposed replacement.
|
2008-10-30 13:25:00 -04:00
|
|
|
*/
|
|
|
|
|
2009-05-12 09:15:18 -04:00
|
|
|
/**
|
|
|
|
* CoglShaderType:
|
|
|
|
* @COGL_SHADER_TYPE_VERTEX: A program for proccessing vertices
|
|
|
|
* @COGL_SHADER_TYPE_FRAGMENT: A program for processing fragments
|
2009-05-28 12:18:13 -04:00
|
|
|
*
|
|
|
|
* Types of shaders
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2009-05-12 09:15:18 -04:00
|
|
|
*/
|
2009-05-29 07:31:47 -04:00
|
|
|
typedef enum {
|
2009-05-12 09:15:18 -04:00
|
|
|
COGL_SHADER_TYPE_VERTEX,
|
|
|
|
COGL_SHADER_TYPE_FRAGMENT
|
|
|
|
} CoglShaderType;
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* cogl_create_shader:
|
2010-01-12 09:43:36 -05:00
|
|
|
* @shader_type: COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Create a new shader handle, use cogl_shader_source() to set the
|
|
|
|
* source code to be used on it.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
|
|
|
* Returns: a new shader handle.
|
|
|
|
*/
|
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
|
|
|
CoglHandle
|
|
|
|
cogl_create_shader (CoglShaderType shader_type);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2010-02-10 17:47:49 -05:00
|
|
|
#ifndef COGL_DISABLE_DEPRECATED
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* cogl_shader_ref:
|
|
|
|
* @handle: A #CoglHandle to a shader.
|
|
|
|
*
|
|
|
|
* Add an extra reference to a shader.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Deprecated: 1.0: Please use cogl_handle_ref() instead.
|
|
|
|
*
|
2008-10-30 13:25:00 -04:00
|
|
|
* Returns: @handle
|
|
|
|
*/
|
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
|
|
|
CoglHandle
|
2010-02-10 17:47:49 -05:00
|
|
|
cogl_shader_ref (CoglHandle handle) G_GNUC_DEPRECATED;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_shader_unref:
|
|
|
|
* @handle: A #CoglHandle to a shader.
|
|
|
|
*
|
|
|
|
* Removes a reference to a shader. If it was the last reference the
|
|
|
|
* shader object will be destroyed.
|
2011-10-20 08:53:04 -04:00
|
|
|
*
|
|
|
|
* Deprecated: 1.0: Please use cogl_handle_unref() instead.
|
2008-10-30 13:25:00 -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-02-10 17:47:49 -05:00
|
|
|
cogl_shader_unref (CoglHandle handle) G_GNUC_DEPRECATED;
|
|
|
|
|
|
|
|
#endif /* COGL_DISABLE_DEPRECATED */
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_is_shader:
|
|
|
|
* @handle: A CoglHandle
|
|
|
|
*
|
|
|
|
* Gets whether the given handle references an existing shader object.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the handle references a shader,
|
|
|
|
* %FALSE otherwise
|
|
|
|
*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool
|
2011-10-20 08:53:04 -04:00
|
|
|
cogl_is_shader (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_shader_source:
|
|
|
|
* @shader: #CoglHandle for a shader.
|
2011-10-20 08:53:04 -04:00
|
|
|
* @source: Shader source.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Replaces the current source associated with a shader with a new
|
2008-10-30 13:25:00 -04:00
|
|
|
* one.
|
2011-10-20 08:53:04 -04:00
|
|
|
*
|
|
|
|
* Please see <link
|
|
|
|
* linkend="cogl-Shaders-and-Programmable-Pipeline.description">above</link>
|
|
|
|
* for a description of the recommended format for the shader code.
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_shader_source (CoglHandle shader,
|
|
|
|
const char *source);
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* cogl_shader_compile:
|
|
|
|
* @handle: #CoglHandle for a shader.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Compiles the shader, no return value, but the shader is now ready
|
|
|
|
* for linking into a program. Note that calling this function is
|
|
|
|
* optional. If it is not called then the shader will be automatically
|
|
|
|
* compiled when it is linked.
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_shader_compile (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_shader_get_info_log:
|
|
|
|
* @handle: #CoglHandle for a shader.
|
|
|
|
*
|
|
|
|
* Retrieves the information log for a coglobject, can be used in conjunction
|
2009-06-01 11:31:32 -04:00
|
|
|
* with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error
|
2008-10-30 13:25:00 -04:00
|
|
|
* messages that caused a shader to not compile correctly, mainly useful for
|
|
|
|
* debugging purposes.
|
2009-06-01 11:31:32 -04:00
|
|
|
*
|
|
|
|
* Return value: a newly allocated string containing the info log. Use
|
|
|
|
* g_free() to free it
|
2008-10-30 13:25:00 -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
|
|
|
char *
|
|
|
|
cogl_shader_get_info_log (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
2009-05-12 09:15:18 -04:00
|
|
|
* cogl_shader_get_type:
|
2008-10-30 13:25:00 -04:00
|
|
|
* @handle: #CoglHandle for a shader.
|
|
|
|
*
|
2009-05-28 12:18:13 -04:00
|
|
|
* Retrieves the type of a shader #CoglHandle
|
|
|
|
*
|
|
|
|
* Return value: %COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
|
|
|
|
* or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
|
2008-10-30 13:25:00 -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
|
|
|
CoglShaderType
|
|
|
|
cogl_shader_get_type (CoglHandle handle);
|
2009-05-12 09:15:18 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_shader_is_compiled:
|
|
|
|
* @handle: #CoglHandle for a shader.
|
|
|
|
*
|
2009-05-28 12:18:13 -04:00
|
|
|
* Retrieves whether a shader #CoglHandle has been compiled
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the shader object has sucessfully be compiled
|
2009-05-12 09:15:18 -04:00
|
|
|
*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool
|
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
|
|
|
cogl_shader_is_compiled (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_create_program:
|
|
|
|
*
|
|
|
|
* Create a new cogl program object that can be used to replace parts of the GL
|
|
|
|
* rendering pipeline with custom code.
|
|
|
|
*
|
|
|
|
* Returns: a new cogl program.
|
|
|
|
*/
|
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
|
|
|
CoglHandle
|
|
|
|
cogl_create_program (void);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2011-10-20 08:53:04 -04:00
|
|
|
#ifndef COGL_DISABLE_DEPRECATED
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* cogl_program_ref:
|
|
|
|
* @handle: A #CoglHandle to a program.
|
|
|
|
*
|
|
|
|
* Add an extra reference to a program.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Deprecated: 1.0: Please use cogl_handle_ref() instead.
|
|
|
|
*
|
2008-10-30 13:25:00 -04:00
|
|
|
* Returns: @handle
|
|
|
|
*/
|
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
|
|
|
CoglHandle
|
2011-10-20 08:53:04 -04:00
|
|
|
cogl_program_ref (CoglHandle handle) G_GNUC_DEPRECATED;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_unref:
|
|
|
|
* @handle: A #CoglHandle to a program.
|
|
|
|
*
|
|
|
|
* Removes a reference to a program. If it was the last reference the
|
|
|
|
* program object will be destroyed.
|
2011-10-20 08:53:04 -04:00
|
|
|
*
|
|
|
|
* Deprecated: 1.0: Please use cogl_handle_unref() instead.
|
2008-10-30 13:25:00 -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
|
2011-10-20 08:53:04 -04:00
|
|
|
cogl_program_unref (CoglHandle handle) G_GNUC_DEPRECATED;
|
|
|
|
|
|
|
|
#endif /* COGL_DISABLE_DEPRECATED */
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_is_program:
|
|
|
|
* @handle: A CoglHandle
|
|
|
|
*
|
|
|
|
* Gets whether the given handle references an existing program object.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the handle references a program,
|
|
|
|
* %FALSE otherwise
|
|
|
|
*/
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool
|
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
|
|
|
cogl_is_program (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_attach_shader:
|
|
|
|
* @program_handle: a #CoglHandle for a shdaer program.
|
|
|
|
* @shader_handle: a #CoglHandle for a vertex of fragment shader.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Attaches a shader to a program object. A program can have multiple
|
|
|
|
* vertex or fragment shaders but only one of them may provide a
|
|
|
|
* main() function. It is allowed to use a program with only a vertex
|
|
|
|
* shader or only a fragment shader.
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_program_attach_shader (CoglHandle program_handle,
|
|
|
|
CoglHandle shader_handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_link:
|
|
|
|
* @handle: a #CoglHandle for a shader program.
|
|
|
|
*
|
2011-10-20 08:53:04 -04:00
|
|
|
* Links a program making it ready for use. Note that calling this
|
|
|
|
* function is optional. If it is not called the program will
|
|
|
|
* automatically be linked the first time it is used.
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_program_link (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_use:
|
2008-11-18 10:08:40 -05:00
|
|
|
* @handle: a #CoglHandle for a shader program or %COGL_INVALID_HANDLE.
|
2008-10-30 13:25:00 -04:00
|
|
|
*
|
|
|
|
* Activate a specific shader program replacing that part of the GL
|
2008-11-18 10:08:40 -05:00
|
|
|
* rendering pipeline, if passed in %COGL_INVALID_HANDLE the default
|
2008-10-30 13:25:00 -04:00
|
|
|
* behavior of GL is reinstated.
|
2011-10-20 08:53:04 -04:00
|
|
|
*
|
|
|
|
* This function affects the global state of the current Cogl
|
|
|
|
* context. It is much more efficient to attach the shader to a
|
|
|
|
* specific material used for rendering instead by calling
|
|
|
|
* cogl_material_set_user_program().
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_program_use (CoglHandle handle);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_get_uniform_location:
|
|
|
|
* @handle: a #CoglHandle for a shader program.
|
|
|
|
* @uniform_name: the name of a uniform.
|
|
|
|
*
|
2008-11-18 10:08:40 -05:00
|
|
|
* Retrieve the location (offset) of a uniform variable in a shader program,
|
|
|
|
* a uniform is a variable that is constant for all vertices/fragments for a
|
2008-10-30 13:25:00 -04:00
|
|
|
* shader object and is possible to modify as an external parameter.
|
|
|
|
*
|
2008-11-18 10:08:40 -05:00
|
|
|
* Return value: the offset of a uniform in a specified program.
|
|
|
|
* This uniform can be set using cogl_program_uniform_1f() when the
|
|
|
|
* program is in use.
|
2008-10-30 13:25:00 -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
|
|
|
int
|
|
|
|
cogl_program_get_uniform_location (CoglHandle handle,
|
|
|
|
const char *uniform_name);
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2010-08-11 14:18:14 -04:00
|
|
|
/**
|
|
|
|
* cogl_program_set_uniform_1f:
|
|
|
|
* @program: A #CoglHandle for a linked program
|
|
|
|
* @uniform_location: the uniform location retrieved from
|
|
|
|
* cogl_program_get_uniform_location().
|
|
|
|
* @value: the new value of the uniform.
|
|
|
|
*
|
|
|
|
* Changes the value of a floating point uniform for the given linked
|
|
|
|
* @program.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_program_set_uniform_1f (CoglHandle program,
|
|
|
|
int uniform_location,
|
|
|
|
float value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_set_uniform_1i:
|
|
|
|
* @program: A #CoglHandle for a linked program
|
|
|
|
* @uniform_location: the uniform location retrieved from
|
|
|
|
* cogl_program_get_uniform_location().
|
|
|
|
* @value: the new value of the uniform.
|
|
|
|
*
|
|
|
|
* Changes the value of an integer uniform for the given linked
|
|
|
|
* @program.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_program_set_uniform_1i (CoglHandle program,
|
|
|
|
int uniform_location,
|
|
|
|
int value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_set_uniform_float:
|
|
|
|
* @program: A #CoglHandle for a linked program
|
|
|
|
* @uniform_location: the uniform location retrieved from
|
|
|
|
* cogl_program_get_uniform_location().
|
|
|
|
* @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.
|
|
|
|
* @count: For uniform arrays this is the array length otherwise just
|
|
|
|
* pass 1
|
|
|
|
* @value: (array length=count): the new value of the uniform[s].
|
|
|
|
*
|
|
|
|
* Changes the value of a float vector uniform, or uniform array for
|
|
|
|
* the given linked @program.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_program_set_uniform_float (CoglHandle program,
|
|
|
|
int uniform_location,
|
|
|
|
int n_components,
|
|
|
|
int count,
|
|
|
|
const float *value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_set_uniform_int:
|
|
|
|
* @program: A #CoglHandle for a linked program
|
|
|
|
* @uniform_location: the uniform location retrieved from
|
|
|
|
* cogl_program_get_uniform_location().
|
|
|
|
* @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.
|
|
|
|
* @count: For uniform arrays this is the array length otherwise just
|
|
|
|
* pass 1
|
|
|
|
* @value: (array length=count): the new value of the uniform[s].
|
|
|
|
*
|
|
|
|
* Changes the value of a int vector uniform, or uniform array for
|
|
|
|
* the given linked @program.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_program_set_uniform_int (CoglHandle program,
|
|
|
|
int uniform_location,
|
|
|
|
int n_components,
|
|
|
|
int count,
|
|
|
|
const int *value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_set_uniform_matrix:
|
|
|
|
* @program: A #CoglHandle for a linked program
|
|
|
|
* @uniform_location: the uniform location retrieved from
|
|
|
|
* cogl_program_get_uniform_location().
|
|
|
|
* @dimensions: The dimensions of the matrix. So for for example pass
|
|
|
|
* 2 for a 2x2 matrix or 3 for 3x3.
|
|
|
|
* @count: For uniform arrays this is the array length otherwise just
|
|
|
|
* pass 1
|
|
|
|
* @transpose: Whether to transpose the matrix when setting the uniform.
|
|
|
|
* @value: (array length=count): the new value of the uniform.
|
|
|
|
*
|
|
|
|
* Changes the value of a matrix uniform, or uniform array in the
|
|
|
|
* given linked @program.
|
|
|
|
*
|
|
|
|
* Since: 1.4
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cogl_program_set_uniform_matrix (CoglHandle program,
|
|
|
|
int uniform_location,
|
|
|
|
int dimensions,
|
|
|
|
int count,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool transpose,
|
2010-08-11 14:18:14 -04:00
|
|
|
const float *value);
|
|
|
|
|
2010-09-03 11:56:12 -04:00
|
|
|
#ifndef COGL_DISABLE_DEPRECATED
|
|
|
|
|
2008-10-30 13:25:00 -04:00
|
|
|
/**
|
|
|
|
* cogl_program_uniform_1f:
|
2010-08-11 14:18:14 -04:00
|
|
|
* @uniform_no: the uniform to set.
|
2008-10-30 13:25:00 -04:00
|
|
|
* @value: the new value of the uniform.
|
|
|
|
*
|
2008-11-18 10:21:02 -05:00
|
|
|
* Changes the value of a floating point uniform in the currently
|
|
|
|
* used (see cogl_program_use()) shader program.
|
2010-08-11 14:18:14 -04:00
|
|
|
*
|
|
|
|
* Deprecated: 1.4: Use cogl_program_set_uniform_1f() instead.
|
2008-10-30 13:25:00 -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
|
|
|
|
cogl_program_uniform_1f (int uniform_no,
|
2010-09-03 11:56:12 -04:00
|
|
|
float value) G_GNUC_DEPRECATED;
|
2008-10-30 13:25:00 -04:00
|
|
|
|
2008-11-18 10:21:02 -05:00
|
|
|
/**
|
|
|
|
* cogl_program_uniform_1i:
|
2010-08-11 14:18:14 -04:00
|
|
|
* @uniform_no: the uniform to set.
|
2008-11-18 10:21:02 -05:00
|
|
|
* @value: the new value of the uniform.
|
|
|
|
*
|
|
|
|
* Changes the value of an integer uniform in the currently
|
|
|
|
* used (see cogl_program_use()) shader program.
|
2010-08-11 14:18:14 -04:00
|
|
|
*
|
|
|
|
* Deprecated: 1.4: Use cogl_program_set_uniform_1i() instead.
|
2008-11-18 10:21:02 -05: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
|
|
|
|
cogl_program_uniform_1i (int uniform_no,
|
2010-09-03 11:56:12 -04:00
|
|
|
int value) G_GNUC_DEPRECATED;
|
2008-11-18 10:21:02 -05:00
|
|
|
|
2010-08-11 14:18:14 -04:00
|
|
|
/**
|
2008-11-18 10:08:40 -05:00
|
|
|
* cogl_program_uniform_float:
|
|
|
|
* @uniform_no: the uniform to set.
|
|
|
|
* @size: Size of float vector.
|
|
|
|
* @count: Size of array of uniforms.
|
2010-01-05 11:11:45 -05:00
|
|
|
* @value: (array length=count): the new value of the uniform.
|
2008-11-18 10:08:40 -05:00
|
|
|
*
|
|
|
|
* Changes the value of a float vector uniform, or uniform array in the
|
2010-01-05 11:11:45 -05:00
|
|
|
* currently used (see cogl_program_use()) shader program.
|
2010-08-11 14:18:14 -04:00
|
|
|
*
|
|
|
|
* Deprecated: 1.4: Use cogl_program_set_uniform_float() instead.
|
2008-11-18 10:08:40 -05: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
|
|
|
|
cogl_program_uniform_float (int uniform_no,
|
|
|
|
int size,
|
|
|
|
int count,
|
2010-09-03 11:56:12 -04:00
|
|
|
const float *value) G_GNUC_DEPRECATED;
|
2008-11-18 10:08:40 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_uniform_int:
|
|
|
|
* @uniform_no: the uniform to set.
|
|
|
|
* @size: Size of int vector.
|
|
|
|
* @count: Size of array of uniforms.
|
2010-01-05 11:11:45 -05:00
|
|
|
* @value: (array length=count): the new value of the uniform.
|
2008-11-18 10:08:40 -05:00
|
|
|
*
|
|
|
|
* Changes the value of a int vector uniform, or uniform array in the
|
|
|
|
* currently used (see cogl_program_use()) shader program.
|
|
|
|
*/
|
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
|
|
|
|
cogl_program_uniform_int (int uniform_no,
|
|
|
|
int size,
|
|
|
|
int count,
|
2010-09-03 11:56:12 -04:00
|
|
|
const int *value) G_GNUC_DEPRECATED;
|
2008-11-18 10:08:40 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cogl_program_uniform_matrix:
|
|
|
|
* @uniform_no: the uniform to set.
|
|
|
|
* @size: Size of matrix.
|
|
|
|
* @count: Size of array of uniforms.
|
|
|
|
* @transpose: Whether to transpose the matrix when setting the uniform.
|
2010-01-05 11:11:45 -05:00
|
|
|
* @value: (array length=count): the new value of the uniform.
|
2008-11-18 10:08:40 -05:00
|
|
|
*
|
|
|
|
* Changes the value of a matrix uniform, or uniform array in the
|
|
|
|
* currently used (see cogl_program_use()) shader program. The @size
|
|
|
|
* parameter is used to determine the square size of the matrix.
|
|
|
|
*/
|
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
|
|
|
|
cogl_program_uniform_matrix (int uniform_no,
|
|
|
|
int size,
|
|
|
|
int count,
|
Switch use of primitive glib types to c99 equivalents
The coding style has for a long time said to avoid using redundant glib
data types such as gint or gchar etc because we feel that they make the
code look unnecessarily foreign to developers coming from outside of the
Gnome developer community.
Note: When we tried to find the historical rationale for the types we
just found that they were apparently only added for consistent syntax
highlighting which didn't seem that compelling.
Up until now we have been continuing to use some of the platform
specific type such as gint{8,16,32,64} and gsize but this patch switches
us over to using the standard c99 equivalents instead so we can further
ensure that our code looks familiar to the widest range of C developers
who might potentially contribute to Cogl.
So instead of using the gint{8,16,32,64} and guint{8,16,32,64} types this
switches all Cogl code to instead use the int{8,16,32,64}_t and
uint{8,16,32,64}_t c99 types instead.
Instead of gsize we now use size_t
For now we are not going to use the c99 _Bool type and instead we have
introduced a new CoglBool type to use instead of gboolean.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 5967dad2400d32ca6319cef6cb572e81bf2c15f0)
2012-04-16 16:56:40 -04:00
|
|
|
CoglBool transpose,
|
2010-09-03 11:56:12 -04:00
|
|
|
const float *value) G_GNUC_DEPRECATED;
|
|
|
|
|
|
|
|
#endif /* COGL_DISABLE_DEPRECATED */
|
2008-11-18 10:08:40 -05:00
|
|
|
|
2012-11-22 13:01:10 -05:00
|
|
|
COGL_END_DECLS
|
2008-10-30 13:25:00 -04:00
|
|
|
|
|
|
|
#endif /* __COGL_SHADER_H__ */
|