Integer representation of an angle such that 1024 corresponds to
full circle (i.e., 2 * pi).
A boolean data type used throughout the Cogl C api. This should be
used in conjunction with the %TRUE and %FALSE macro defines for
setting and testing boolean values.
Type used for storing references to cogl objects, the CoglHandle is
a fully opaque type without any public data members.
Data types for the components of a vertex attribute.
Data is the same size of a byte
Data is the same size of an
unsigned byte
Data is the same size of a short integer
Data is the same size of
an unsigned short integer
Data is the same size of a float
Loads an image file from disk. This function can be safely called from
within a thread.
a #CoglBitmap to the new loaded
image data, or %NULL if loading the image failed.
the file to load.
Parses an image file enough to extract the width and height
of the bitmap.
%TRUE if the image was successfully parsed
the file to check
return location for the bitmap width, or %NULL
return location for the bitmap height, or %NULL
Error codes that can be thrown when performing bitmap
operations. Note that gdk_pixbuf_new_from_file() can also throw
errors directly from the underlying image loading library. For
example, if GdkPixbuf is used then errors #GdkPixbufError<!-- -->s
will be used directly.
Generic failure code, something went
wrong.
Unknown image type.
An image file was broken somehow.
Error enumeration for the blend strings parser
Generic parse error
Argument parse error
Internal parser error
Blend string not
supported by the GPU
Types of auxiliary buffers
Selects the primary color buffer
Selects the depth buffer
Selects the stencil buffer
Target flags for FBOs.
FIXME
FIXME
A structure for holding a color definition. The contents of
the CoglColor structure are private and should never by accessed
directly.
Creates a new (empty) color
a newly-allocated #CoglColor. Use cogl_color_free()
to free the allocated resources
Creates a copy of @color
a newly-allocated #CoglColor. Use cogl_color_free()
to free the allocate resources
the color to copy
Frees the resources allocated by cogl_color_new() and cogl_color_copy()
the color to free
Retrieves the alpha channel of @color as a fixed point
value between 0 and 1.0.
the alpha channel of the passed color
a #CoglColor
Retrieves the alpha channel of @color as a byte value
between 0 and 255
the alpha channel of the passed color
a #CoglColor
Retrieves the alpha channel of @color as a floating point
value between 0.0 and 1.0
the alpha channel of the passed color
a #CoglColor
Retrieves the blue channel of @color as a fixed point
value between 0 and 1.0.
the blue channel of the passed color
a #CoglColor
Retrieves the blue channel of @color as a byte value
between 0 and 255
the blue channel of the passed color
a #CoglColor
Retrieves the blue channel of @color as a floating point
value between 0.0 and 1.0
the blue channel of the passed color
a #CoglColor
Retrieves the green channel of @color as a fixed point
value between 0 and 1.0.
the green channel of the passed color
a #CoglColor
Retrieves the green channel of @color as a byte value
between 0 and 255
the green channel of the passed color
a #CoglColor
Retrieves the green channel of @color as a floating point
value between 0.0 and 1.0
the green channel of the passed color
a #CoglColor
Retrieves the red channel of @color as a fixed point
value between 0 and 1.0.
the red channel of the passed color
a #CoglColor
Retrieves the red channel of @color as a byte value
between 0 and 255
the red channel of the passed color
a #CoglColor
Retrieves the red channel of @color as a floating point
value between 0.0 and 1.0
the red channel of the passed color
a #CoglColor
Sets the values of the passed channels into a #CoglColor
A pointer to a #CoglColor to initialize
value of the red channel, between 0 and 1.0
value of the green channel, between 0 and 1.0
value of the blue channel, between 0 and 1.0
value of the alpha channel, between 0 and 1.0
Sets the values of the passed channels into a #CoglColor
A pointer to a #CoglColor to initialize
a pointer to an array of 4 float color components
Sets the values of the passed channels into a #CoglColor.
A pointer to a #CoglColor to initialize
value of the red channel, between 0 and 255
value of the green channel, between 0 and 255
value of the blue channel, between 0 and 255
value of the alpha channel, between 0 and 255
Converts a non-premultiplied color to a pre-multiplied color. For
example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied
and (0.5, 0, 0, 0.5) when premultiplied.
the color to premultiply
Sets the alpha channel of @color to @alpha.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the alpha channel of @color to @alpha.
a #CoglColor
a byte value between 0 and 255
Sets the alpha channel of @color to @alpha.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the blue channel of @color to @blue.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the blue channel of @color to @blue.
a #CoglColor
a byte value between 0 and 255
Sets the blue channel of @color to @blue.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the values of the passed channels into a #CoglColor
Use cogl_color_init_from_4f instead.
A pointer to a #CoglColor to initialize
value of the red channel, between 0 and %1.0
value of the green channel, between 0 and %1.0
value of the blue channel, between 0 and %1.0
value of the alpha channel, between 0 and %1.0
Sets the values of the passed channels into a #CoglColor.
Use cogl_color_init_from_4ub instead.
A pointer to a #CoglColor to initialize
value of the red channel, between 0 and 255
value of the green channel, between 0 and 255
value of the blue channel, between 0 and 255
value of the alpha channel, between 0 and 255
Sets the green channel of @color to @green.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the green channel of @color to @green.
a #CoglColor
a byte value between 0 and 255
Sets the green channel of @color to @green.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the red channel of @color to @red.
a #CoglColor
a float value between 0.0f and 1.0f
Sets the red channel of @color to @red.
a #CoglColor
a byte value between 0 and 255
Sets the red channel of @color to @red.
a #CoglColor
a float value between 0.0f and 1.0f
Converts @color to the HLS format.
The @hue value is in the 0 .. 360 range. The @luminance and
@saturation values are in the 0 .. 1 range.
a #CoglColor
return location for the hue value or %NULL
return location for the saturation value or %NULL
return location for the luminance value or %NULL
Converts a pre-multiplied color to a non-premultiplied color. For
example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied
and (1.0, 0, 0, 0.5) when non-premultiplied.
the color to unpremultiply
Compares two #CoglColor<!-- -->s and checks if they are the same.
This function can be passed to g_hash_table_new() as the @key_equal_func
parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
%TRUE if the two colors are the same.
a #CoglColor
a #CoglColor
Converts a color expressed in HLS (hue, luminance and saturation)
values into a #CoglColor.
return location for a #CoglColor
hue value, in the 0 .. 360 range
saturation value, in the 0 .. 1 range
luminance value, in the 0 .. 1 range
Defines a bit mask of color channels. This can be used with
cogl_pipeline_set_color_mask() for example to define which color
channels should be written to the current framebuffer when
drawing something.
None of the color channels are masked
Masks the red color channel
Masks the green color channel
Masks the blue color channel
Masks the alpha color channel
All of the color channels are masked
When using depth testing one of these functions is used to compare
the depth of an incoming fragment against the depth value currently
stored in the depth buffer. The function is changed using
cogl_depth_state_set_test_function().
The test is only done when depth testing is explicitly enabled. (See
cogl_depth_state_set_test_enabled())
Never passes.
Passes if the fragment's depth
value is less than the value currently in the depth buffer.
Passes if the fragment's depth
value is equal to the value currently in the depth buffer.
Passes if the fragment's depth
value is less or equal to the value currently in the depth buffer.
Passes if the fragment's depth
value is greater than the value currently in the depth buffer.
Passes if the fragment's depth
value is not equal to the value currently in the depth buffer.
Passes if the fragment's depth
value greater than or equal to the value currently in the depth buffer.
Always passes.
The number 0.5 expressed as a #CoglFixed number.
The number 1 expressed as a #CoglFixed number.
Two times pi, expressed as a #CoglFixed number.
Evaluates to the number of bits used by the #CoglFixed type.
A very small number expressed as a #CoglFixed number.
The biggest number representable using #CoglFixed
The smallest number representable using #CoglFixed
The number pi, expressed as a #CoglFixed number.
Half pi, expressed as a #CoglFixed number.
pi / 4, expressed as #CoglFixed number.
Evaluates to the number of bits used for the non-integer part
of the #CoglFixed type.
Flags for the supported features.
ARB_texture_rectangle support
Non power of two textures are supported
by the hardware. This is a equivalent to the
%COGL_FEATURE_TEXTURE_NPOT_BASIC, %COGL_FEATURE_TEXTURE_NPOT_MIPMAP
and %COGL_FEATURE_TEXTURE_NPOT_REPEAT features combined.
ycbcr conversion support
glReadPixels() support
GLSL support
FBO support
Multisample support on FBOs
Blit support on FBOs
At least 4 clip planes available
Stencil buffer support
VBO support
PBO support
Set if
%COGL_INDICES_TYPE_UNSIGNED_INT is supported in
cogl_vertex_buffer_indices_new().
cogl_material_set_depth_range() support
The hardware supports non power
of two textures, but you also need to check the
%COGL_FEATURE_TEXTURE_NPOT_MIPMAP and %COGL_FEATURE_TEXTURE_NPOT_REPEAT
features to know if the hardware supports npot texture mipmaps
or repeat modes other than
%COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE respectively.
Mipmapping is supported in
conjuntion with non power of two textures.
Repeat modes other than
%COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE are supported by the
hardware.
Whether
cogl_material_set_layer_point_sprite_coords_enabled() is supported.
3D texture support
ARBFP support
Whether cogl_buffer_map() is
supported with CoglBufferAccess including read support.
Whether cogl_buffer_map() is
supported with CoglBufferAccess including write support.
Whether #CoglFramebuffer support rendering the
depth buffer to a texture.
Return values for the #CoglXlibFilterFunc and #CoglWin32FilterFunc functions.
The event was not handled, continues the
processing
Remove the event, stops the processing
Fixed point number using a (16.16) notation.
Calculates base 2 logarithm.
This function is some 2.5 times faster on x86, and over 12 times faster on
fpu-less arm, than using libc log().
base 2 logarithm.
value to calculate base 2 logarithm from
Calculates @x to the @y power.
the power of @x to the @y
base
#CoglFixed exponent
Computes the arc tangent of @a.
the arc tangent of the passed value, in fixed point notation
a #CoglFixed number
Computes the arc tangent of @a / @b but uses the sign of both
arguments to return the angle in right quadrant.
the arc tangent of the passed fraction, in fixed point
notation
the numerator as a #CoglFixed number
the denominator as a #CoglFixed number
Computes the cosine of @angle.
the cosine of the passed angle, in fixed point notation
a #CoglFixed number
Calculates 2 to the @x power.
This function is around 11 times faster on x86, and around 22 times faster
on fpu-less arm than libc pow(2, x).
the power of 2 to the passed value
a #CoglFixed number
Computes the sine of @angle.
the sine of the passed angle, in fixed point notation
a #CoglFixed number
Computes the square root of @x.
the square root of the passed value, in floating point
notation
a #CoglFixed number
Computes the tangent of @angle.
the tangent of the passed angle, in fixed point notation
a #CoglFixed number
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.
Calculates the fog blend factor as:
|[
f = end - eye_distance / end - start
]|
Calculates the fog blend factor as:
|[
f = e ^ -(density * eye_distance)
]|
Calculates the fog blend factor as:
|[
f = e ^ -(density * eye_distance)^2
]|
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.
You should aim to use the smallest data type that gives you enough
range, since it reduces the size of your index array and can help
reduce the demand on memory bandwidth.
Note that %COGL_INDICES_TYPE_UNSIGNED_INT is only supported if the
%COGL_FEATURE_ID_UNSIGNED_INT_INDICES feature is available. This
should always be available on OpenGL but on OpenGL ES it will only
be available if the GL_OES_element_index_uint extension is
advertized.
Your indices are unsigned bytes
Your indices are unsigned shorts
Your indices are unsigned ints
Creates a new material with the configuration copied from the
source material.
We would strongly advise developers to always aim to use
cogl_material_copy() instead of cogl_material_new() whenever there will
be any similarity between two materials. Copying a material helps Cogl
keep track of a materials ancestry which we may use to help minimize GPU
state changes.
Use cogl_pipeline_copy() instead
a pointer to the newly allocated #CoglMaterial
a #CoglMaterial object to copy
Retrieves the current ambient color for @material
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The location to store the ambient color
Retrieves the current material color.
Use cogl_pipeline_get_color() instead
A #CoglMaterial object
The location to store the color
Retrieves the current diffuse color for @material
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The location to store the diffuse color
Retrieves the materials current emission color.
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The location to store the emission color
Gets whether point sprite coordinate generation is enabled for this
texture layer.
Use cogl_pipeline_get_layer_point_sprite_coords_enabled()
instead
whether the texture coordinates will be replaced with
point sprite coordinates.
a #CoglHandle to a material.
the layer number to check.
Returns the wrap mode for the 'p' coordinate of texture lookups on this
layer.
Use cogl_pipeline_get_layer_wrap_mode_p() instead
the wrap mode for the 'p' coordinate of texture lookups on
this layer.
A #CoglMaterial object
the layer number to change.
Returns the wrap mode for the 's' coordinate of texture lookups on this
layer.
Use cogl_pipeline_get_layer_wrap_mode_s() instead
the wrap mode for the 's' coordinate of texture lookups on
this layer.
A #CoglMaterial object
the layer number to change.
Returns the wrap mode for the 't' coordinate of texture lookups on this
layer.
Use cogl_pipeline_get_layer_wrap_mode_t() instead
the wrap mode for the 't' coordinate of texture lookups on
this layer.
A #CoglMaterial object
the layer number to change.
This function lets you access a material's internal list of layers
for iteration.
<note>You should avoid using this API if possible since it was only
made public by mistake and will be deprecated when we have
suitable alternative.</note>
<note>It's important to understand that the list returned may not
remain valid if you modify the material or any of the layers in any
way and so you would have to re-get the list in that
situation.</note>
A
list of #CoglMaterialLayer<!-- -->'s that can be passed to the
cogl_material_layer_* functions. The list is owned by Cogl and it
should not be modified or freed
Deprecated: 1.16: Use cogl_pipeline_get_layers() instead
A #CoglMaterial object
Retrieves the number of layers defined for the given @material
Use cogl_pipeline_get_n_layers() instead
the number of layers
A #CoglMaterial object
Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is
used with the vertex buffer API.
Use cogl_pipeline_get_point_size() instead
the point size of the material.
a #CoglHandle to a material.
Retrieves the materials current emission color.
Use the #CoglSnippet shader api for lighting
The materials current shininess value
A #CoglMaterial object
Retrieves the materials current specular color.
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The location to store the specular color
Queries what user program has been associated with the given
@material using cogl_material_set_user_program().
Use #CoglSnippet api instead instead
The current user program
or %COGL_INVALID_HANDLE.
a #CoglMaterial object.
This function removes a layer from your material
Use cogl_pipeline_remove_layer() instead
A #CoglMaterial object
Specifies the layer you want to remove
Before a primitive is blended with the framebuffer, it goes through an
alpha test stage which lets you discard fragments based on the current
alpha value. This function lets you change the function used to evaluate
the alpha channel, and thus determine which fragments are discarded
and which continue on to the blending stage.
The default is %COGL_MATERIAL_ALPHA_FUNC_ALWAYS
Use cogl_pipeline_set_alpha_test_function() instead
A #CoglMaterial object
A @CoglMaterialAlphaFunc constant
A reference point that the chosen alpha function uses
to compare incoming fragments to.
Sets the material's ambient color, in the standard OpenGL lighting
model. The ambient color affects the overall color of the object.
Since the diffuse color will be intense when the light hits the surface
directly, the ambient will be most apparent where the light hits at a
slant.
The default value is (0.2, 0.2, 0.2, 1.0)
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The components of the desired ambient color
Conveniently sets the diffuse and ambient color of @material at the same
time. See cogl_material_set_ambient() and cogl_material_set_diffuse().
The default ambient color is (0.2, 0.2, 0.2, 1.0)
The default diffuse color is (0.8, 0.8, 0.8, 1.0)
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The components of the desired ambient and diffuse colors
If not already familiar; please refer <link linkend="cogl-Blend-Strings">here</link>
for an overview of what blend strings are, and their syntax.
Blending occurs after the alpha test function, and combines fragments with
the framebuffer.
Currently the only blend function Cogl exposes is ADD(). So any valid
blend statements will be of the form:
|[
<channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
]|
<warning>The brackets around blend factors are currently not
optional!</warning>
This is the list of source-names usable as blend factors:
<itemizedlist>
<listitem><para>SRC_COLOR: The color of the in comming fragment</para></listitem>
<listitem><para>DST_COLOR: The color of the framebuffer</para></listitem>
<listitem><para>CONSTANT: The constant set via cogl_material_set_blend_constant()</para></listitem>
</itemizedlist>
The source names can be used according to the
<link linkend="cogl-Blend-String-syntax">color-source and factor syntax</link>,
so for example "(1-SRC_COLOR[A])" would be a valid factor, as would
"(CONSTANT[RGB])"
These can also be used as factors:
<itemizedlist>
<listitem>0: (0, 0, 0, 0)</listitem>
<listitem>1: (1, 1, 1, 1)</listitem>
<listitem>SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])</listitem>
</itemizedlist>
<note>Remember; all color components are normalized to the range [0, 1]
before computing the result of blending.</note>
<example id="cogl-Blend-Strings-blend-unpremul">
<title>Blend Strings/1</title>
<para>Blend a non-premultiplied source over a destination with
premultiplied alpha:</para>
<programlisting>
"RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
"A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
</programlisting>
</example>
<example id="cogl-Blend-Strings-blend-premul">
<title>Blend Strings/2</title>
<para>Blend a premultiplied source over a destination with
premultiplied alpha</para>
<programlisting>
"RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
</programlisting>
</example>
The default blend string is:
|[
RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
]|
That gives normal alpha-blending when the calculated color for the material
is in premultiplied form.
Use cogl_pipeline_set_blend() instead
%TRUE if the blend string was successfully parsed, and the
described blending is supported by the underlying driver/hardware. If
there was an error, %FALSE is returned and @error is set accordingly (if
present).
A #CoglMaterial object
A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
describing the desired blend function.
When blending is setup to reference a CONSTANT blend factor then
blending will depend on the constant set with this function.
Use cogl_pipeline_set_blend_constant() instead
A #CoglMaterial object
The constant color you want
Sets the basic color of the material, used when no lighting is enabled.
Note that if you don't add any layers to the material then the color
will be blended unmodified with the destination; the default blend
expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for
semi-transparent red. See cogl_color_premultiply().
The default value is (1.0, 1.0, 1.0, 1.0)
Use cogl_pipeline_set_color() instead
A #CoglMaterial object
The components of the color
Sets the basic color of the material, used when no lighting is enabled.
The default value is (1.0, 1.0, 1.0, 1.0)
Use cogl_pipeline_set_color4f() instead
A #CoglMaterial object
The red component
The green component
The blue component
The alpha component
Sets the basic color of the material, used when no lighting is enabled.
The default value is (0xff, 0xff, 0xff, 0xff)
Use cogl_pipeline_set_color4ub() instead
A #CoglMaterial object
The red component
The green component
The blue component
The alpha component
Sets the material's diffuse color, in the standard OpenGL lighting
model. The diffuse color is most intense where the light hits the
surface directly - perpendicular to the surface.
The default value is (0.8, 0.8, 0.8, 1.0)
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The components of the desired diffuse color
Sets the material's emissive color, in the standard OpenGL lighting
model. It will look like the surface is a light source emitting this
color.
The default value is (0.0, 0.0, 0.0, 1.0)
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The components of the desired emissive color
In addition to the standard OpenGL lighting model a Cogl material may have
one or more layers comprised of textures that can be blended together in
order, with a number of different texture combine modes. This function
defines a new texture layer.
The index values of multiple layers do not have to be consecutive; it is
only their relative order that is important.
<note>In the future, we may define other types of material layers, such
as purely GLSL based layers.</note>
Use cogl_pipeline_set_layer() instead
A #CoglMaterial object
the index of the layer
a #CoglHandle for the layer object
If not already familiar; you can refer
<link linkend="cogl-Blend-Strings">here</link> for an overview of what blend
strings are and there syntax.
These are all the functions available for texture combining:
<itemizedlist>
<listitem>REPLACE(arg0) = arg0</listitem>
<listitem>MODULATE(arg0, arg1) = arg0 x arg1</listitem>
<listitem>ADD(arg0, arg1) = arg0 + arg1</listitem>
<listitem>ADD_SIGNED(arg0, arg1) = arg0 + arg1 - 0.5</listitem>
<listitem>INTERPOLATE(arg0, arg1, arg2) = arg0 x arg2 + arg1 x (1 - arg2)</listitem>
<listitem>SUBTRACT(arg0, arg1) = arg0 - arg1</listitem>
<listitem>
<programlisting>
DOT3_RGB(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
(arg0[G] - 0.5)) * (arg1[G] - 0.5) +
(arg0[B] - 0.5)) * (arg1[B] - 0.5))
</programlisting>
</listitem>
<listitem>
<programlisting>
DOT3_RGBA(arg0, arg1) = 4 x ((arg0[R] - 0.5)) * (arg1[R] - 0.5) +
(arg0[G] - 0.5)) * (arg1[G] - 0.5) +
(arg0[B] - 0.5)) * (arg1[B] - 0.5))
</programlisting>
</listitem>
</itemizedlist>
Refer to the
<link linkend="cogl-Blend-String-syntax">color-source syntax</link> for
describing the arguments. The valid source names for texture combining
are:
<variablelist>
<varlistentry>
<term>TEXTURE</term>
<listitem>Use the color from the current texture layer</listitem>
</varlistentry>
<varlistentry>
<term>TEXTURE_0, TEXTURE_1, etc</term>
<listitem>Use the color from the specified texture layer</listitem>
</varlistentry>
<varlistentry>
<term>CONSTANT</term>
<listitem>Use the color from the constant given with
cogl_material_set_layer_constant()</listitem>
</varlistentry>
<varlistentry>
<term>PRIMARY</term>
<listitem>Use the color of the material as set with
cogl_material_set_color()</listitem>
</varlistentry>
<varlistentry>
<term>PREVIOUS</term>
<listitem>Either use the texture color from the previous layer, or
if this is layer 0, use the color of the material as set with
cogl_material_set_color()</listitem>
</varlistentry>
</variablelist>
<refsect2 id="cogl-Layer-Combine-Examples">
<title>Layer Combine Examples</title>
<para>This is effectively what the default blending is:</para>
<informalexample><programlisting>
RGBA = MODULATE (PREVIOUS, TEXTURE)
</programlisting></informalexample>
<para>This could be used to cross-fade between two images, using
the alpha component of a constant as the interpolator. The constant
color is given by calling cogl_material_set_layer_constant.</para>
<informalexample><programlisting>
RGBA = INTERPOLATE (PREVIOUS, TEXTURE, CONSTANT[A])
</programlisting></informalexample>
</refsect2>
<note>You can't give a multiplication factor for arguments as you can
with blending.</note>
Use cogl_pipeline_set_layer_combine() instead
%TRUE if the blend string was successfully parsed, and the
described texture combining is supported by the underlying driver and
or hardware. On failure, %FALSE is returned and @error is set
A #CoglMaterial object
Specifies the layer you want define a combine function for
A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
describing the desired texture combine function.
When you are using the 'CONSTANT' color source in a layer combine
description then you can use this function to define its value.
Use cogl_pipeline_set_layer_combine_constant()
instead
A #CoglMaterial object
Specifies the layer you want to specify a constant used
for texture combining
The constant color you want
Changes the decimation and interpolation filters used when a texture is
drawn at other scales than 100%.
Use cogl_pipeline_set_layer_filters() instead
A #CoglMaterial object
the layer number to change.
the filter used when scaling a texture down.
the filter used when magnifying a texture.
This function lets you set a matrix that can be used to e.g. translate
and rotate a single layer of a material used to fill your geometry.
Use cogl_pipeline_set_layer_matrix() instead
A #CoglMaterial object
the index for the layer inside @material
the transformation matrix for the layer
When rendering points, if @enable is %TRUE then the texture
coordinates for this layer will be replaced with coordinates that
vary from 0.0 to 1.0 across the primitive. The top left of the
point will have the coordinates 0.0,0.0 and the bottom right will
have 1.0,1.0. If @enable is %FALSE then the coordinates will be
fixed for the entire point.
This function will only work if %COGL_FEATURE_POINT_SPRITE is
available. If the feature is not available then the function will
return %FALSE and set @error.
Use cogl_pipeline_set_layer_point_sprite_coords_enabled()
instead
%TRUE if the function succeeds, %FALSE otherwise.
a #CoglHandle to a material.
the layer number to change.
whether to enable point sprite coord generation.
Sets the wrap mode for all three coordinates of texture lookups on
this layer. This is equivalent to calling
cogl_material_set_layer_wrap_mode_s(),
cogl_material_set_layer_wrap_mode_t() and
cogl_material_set_layer_wrap_mode_p() separately.
Use cogl_pipeline_set_layer_wrap_mode() instead
A #CoglMaterial object
the layer number to change.
the new wrap mode
Sets the wrap mode for the 'p' coordinate of texture lookups on
this layer. 'p' is the third coordinate.
Use cogl_pipeline_set_layer_wrap_mode_p() instead
A #CoglMaterial object
the layer number to change.
the new wrap mode
Sets the wrap mode for the 's' coordinate of texture lookups on this layer.
Use cogl_pipeline_set_layer_wrap_mode_s() instead
A #CoglMaterial object
the layer number to change.
the new wrap mode
Sets the wrap mode for the 't' coordinate of texture lookups on this layer.
Use cogl_pipeline_set_layer_wrap_mode_t() instead
A #CoglMaterial object
the layer number to change.
the new wrap mode
Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is
used with the vertex buffer API. Note that typically the GPU will
only support a limited minimum and maximum range of point sizes. If
the chosen point size is outside that range then the nearest value
within that range will be used instead. The size of a point is in
screen space so it will be the same regardless of any
transformations. The default point size is 1.0.
Use cogl_pipeline_set_point_size() instead
a material.
the new point size.
Sets the shininess of the material, in the standard OpenGL lighting
model, which determines the size of the specular highlights. A
higher @shininess will produce smaller highlights which makes the
object appear more shiny.
The default value is 0.0
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The desired shininess; must be >= 0.0
Sets the material's specular color, in the standard OpenGL lighting
model. The intensity of the specular color depends on the viewport
position, and is brightest along the lines of reflection.
The default value is (0.0, 0.0, 0.0, 1.0)
Use the #CoglSnippet shader api for lighting
A #CoglMaterial object
The components of the desired specular color
Associates a linked CoglProgram with the given material so that the
program can take full control of vertex and/or fragment processing.
This is an example of how it can be used to associate an ARBfp
program with a #CoglMaterial:
|[
CoglHandle shader;
CoglHandle program;
CoglMaterial *material;
shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
cogl_shader_source (shader,
"!!ARBfp1.0\n"
"MOV result.color,fragment.color;\n"
"END\n");
cogl_shader_compile (shader);
program = cogl_create_program ();
cogl_program_attach_shader (program, shader);
cogl_program_link (program);
material = cogl_material_new ();
cogl_material_set_user_program (material, program);
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_rectangle (0, 0, 100, 100);
]|
It is possibly worth keeping in mind that this API is not part of
the long term design for how we want to expose shaders to Cogl
developers (We are planning on deprecating the cogl_program and
cogl_shader APIs in favour of a "snippet" framework) but in the
meantime we hope this will handle most practical GLSL and ARBfp
requirements.
Also remember you need to check for either the
%COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
using the cogl_program or cogl_shader API.
Use #CoglSnippet api instead instead
a #CoglMaterial object.
A #CoglHandle to a linked CoglProgram
Allocates and initializes a blank white material
Use cogl_pipeline_new() instead
a pointer to a new #CoglMaterial
Increment the reference count for a #CoglMaterial.
Use cogl_object_ref() instead
the @material.
a #CoglMaterial object.
Decrement the reference count for a #CoglMaterial.
Use cogl_object_unref() instead
a #CoglMaterial object.
Alpha testing happens before blending primitives with the framebuffer and
gives an opportunity to discard fragments based on a comparison with the
incoming alpha value and a reference alpha value. The #CoglMaterialAlphaFunc
determines how the comparison is done.
Never let the fragment through.
Let the fragment through if the incoming
alpha value is less than the reference alpha value
Let the fragment through if the incoming
alpha value equals the reference alpha value
Let the fragment through if the incoming
alpha value is less than or equal to the reference alpha value
Let the fragment through if the incoming
alpha value is greater than the reference alpha value
Let the fragment through if the incoming
alpha value does not equal the reference alpha value
Let the fragment through if the incoming
alpha value is greater than or equal to the reference alpha value.
Always let the fragment through.
Texture filtering is used whenever the current pixel maps either to more
than one texture element (texel) or less than one. These filter enums
correspond to different strategies used to come up with a pixel color, by
possibly referring to multiple neighbouring texels and taking a weighted
average or simply using the nearest texel.
Measuring in manhatten distance from the,
current pixel center, use the nearest texture texel
Use the weighted average of the 4 texels
nearest the current pixel center
Select the mimap level whose
texel size most closely matches the current pixel, and use the
%COGL_MATERIAL_FILTER_NEAREST criterion
Select the mimap level whose
texel size most closely matches the current pixel, and use the
%COGL_MATERIAL_FILTER_LINEAR criterion
Select the two mimap levels
whose texel size most closely matches the current pixel, use
the %COGL_MATERIAL_FILTER_NEAREST criterion on each one and take
their weighted average
Select the two mimap levels
whose texel size most closely matches the current pixel, use
the %COGL_MATERIAL_FILTER_LINEAR criterion on each one and take
their weighted average
Queries the currently set downscaling filter for a material later
No replacement
the current downscaling filter
A #CoglMaterialLayer object
Queries the currently set downscaling filter for a material layer
No replacement
the current downscaling filter
a #CoglHandle for a material layer
Extracts a texture handle for a specific layer.
<note>In the future Cogl may support purely GLSL based layers; for those
layers this function which will likely return %COGL_INVALID_HANDLE if you
try to get the texture handle from them. Considering this scenario, you
should call cogl_material_layer_get_type() first in order check it is of
type %COGL_MATERIAL_LAYER_TYPE_TEXTURE before calling this function.</note>
No replacement
a #CoglHandle for the texture inside the layer
A #CoglMaterialLayer object
Retrieves the type of the layer
Currently there is only one type of layer defined:
%COGL_MATERIAL_LAYER_TYPE_TEXTURE, but considering we may add purely GLSL
based layers in the future, you should write code that checks the type
first.
No replacement
the type of the layer
A #CoglMaterialLayer object
Gets the wrap mode for the 'p' coordinate of texture lookups on
this layer. 'p' is the third coordinate.
Use cogl_pipeline_layer_get_wrap_mode_p() instead
the wrap mode value for the p coordinate.
A #CoglMaterialLayer object
Gets the wrap mode for the 's' coordinate of texture lookups on this layer.
Use cogl_pipeline_layer_get_wrap_mode_s() instead
the wrap mode value for the s coordinate.
A #CoglMaterialLayer object
Gets the wrap mode for the 't' coordinate of texture lookups on this layer.
Use cogl_pipeline_layer_get_wrap_mode_t() instead
the wrap mode value for the t coordinate.
A #CoglMaterialLayer object
Available types of layers for a #CoglMaterial. This enumeration
might be expanded in later versions.
The layer represents a
<link linkend="cogl-Textures">texture</link>
The wrap mode specifies what happens when texture coordinates
outside the range 0→1 are used. Note that if the filter mode is
anything but %COGL_MATERIAL_FILTER_NEAREST then texels outside the
range 0→1 might be used even when the coordinate is exactly 0 or 1
because OpenGL will try to sample neighbouring pixels. For example
if you are trying to render the full texture then you may get
artifacts around the edges when the pixels from the other side are
merged in if the wrap mode is set to repeat.
The texture will be repeated. This
is useful for example to draw a tiled background.
The coordinates outside the
range 0→1 will sample copies of the edge pixels of the
texture. This is useful to avoid artifacts if only one copy of
the texture is being rendered.
Cogl will try to automatically
decide which of the above two to use. For cogl_rectangle(), it
will use repeat mode if any of the texture coordinates are
outside the range 0→1, otherwise it will use clamp to edge. For
cogl_polygon() it will always use repeat mode. For
cogl_vertex_buffer_draw() it will use repeat mode except for
layers that have point sprite coordinate generation enabled. This
is the default value.
A CoglMatrix holds a 4x4 transform matrix. This is a single precision,
column-major matrix which means it is compatible with what OpenGL expects.
A CoglMatrix can represent transforms such as, rotations, scaling,
translation, sheering, and linear projections. You can combine these
transforms by multiplying multiple matrices in the order you want them
applied.
The transformation of a vertex (x, y, z, w) by a CoglMatrix is given by:
|[
x_new = xx * x + xy * y + xz * z + xw * w
y_new = yx * x + yy * y + yz * z + yw * w
z_new = zx * x + zy * y + zz * z + zw * w
w_new = wx * x + wy * y + wz * z + ww * w
]|
Where w is normally 1
<note>You must consider the members of the CoglMatrix structure read only,
and all matrix modifications must be done via the cogl_matrix API. This
allows Cogl to annotate the matrices internally. Violation of this will give
undefined results. If you need to initialize a matrix with a constant other
than the identity matrix you can use cogl_matrix_init_from_array().</note>
Allocates a new #CoglMatrix on the heap and initializes it with
the same values as @matrix.
A newly allocated #CoglMatrix which
should be freed using cogl_matrix_free()
A 4x4 transformation matrix you want to copy
Frees a #CoglMatrix that was previously allocated via a call to
cogl_matrix_copy().
A 4x4 transformation matrix you want to free
Multiplies @matrix by the given frustum perspective matrix.
A 4x4 transformation matrix
X position of the left clipping plane where it
intersects the near clipping plane
X position of the right clipping plane where it
intersects the near clipping plane
Y position of the bottom clipping plane where it
intersects the near clipping plane
Y position of the top clipping plane where it intersects
the near clipping plane
The distance to the near clipping plane (Must be positive)
The distance to the far clipping plane (Must be positive)
Casts @matrix to a float array which can be directly passed to OpenGL.
a pointer to the float array
A 4x4 transformation matrix
Gets the inverse transform of a given matrix and uses it to initialize
a new #CoglMatrix.
<note>Although the first parameter is annotated as const to indicate
that the transform it represents isn't modified this function may
technically save a copy of the inverse transform within the given
#CoglMatrix so that subsequent requests for the inverse transform may
avoid costly inversion calculations.</note>
%TRUE if the inverse was successfully calculated or %FALSE
for degenerate transformations that can't be inverted (in this case the
@inverse matrix will simply be initialized with the identity matrix)
A 4x4 transformation matrix
The destination for a 4x4 inverse transformation matrix
Initializes @matrix with the contents of @array
A 4x4 transformation matrix
A linear array of 16 floats (column-major order)
Resets matrix to the identity matrix:
|[
.xx=1; .xy=0; .xz=0; .xw=0;
.yx=0; .yy=1; .yz=0; .yw=0;
.zx=0; .zy=0; .zz=1; .zw=0;
.wx=0; .wy=0; .wz=0; .ww=1;
]|
A 4x4 transformation matrix
Resets matrix to the (tx, ty, tz) translation matrix:
|[
.xx=1; .xy=0; .xz=0; .xw=tx;
.yx=0; .yy=1; .yz=0; .yw=ty;
.zx=0; .zy=0; .zz=1; .zw=tz;
.wx=0; .wy=0; .wz=0; .ww=1;
]|
A 4x4 transformation matrix
x coordinate of the translation vector
y coordinate of the translation vector
z coordinate of the translation vector
Determines if the given matrix is an identity matrix.
%TRUE if @matrix is an identity matrix else %FALSE
A #CoglMatrix
Applies a view transform @matrix that positions the camera at
the coordinate (@eye_position_x, @eye_position_y, @eye_position_z)
looking towards an object at the coordinate (@object_x, @object_y,
@object_z). The top of the camera is aligned to the given world up
vector, which is normally simply (0, 1, 0) to map up to the
positive direction of the y axis.
Because there is a lot of missleading documentation online for
gluLookAt regarding the up vector we want to try and be a bit
clearer here.
The up vector should simply be relative to your world coordinates
and does not need to change as you move the eye and object
positions. Many online sources may claim that the up vector needs
to be perpendicular to the vector between the eye and object
position (partly because the man page is somewhat missleading) but
that is not necessary for this function.
<note>You should never look directly along the world-up
vector.</note>
<note>It is assumed you are using a typical projection matrix where
your origin maps to the center of your viewport.</note>
<note>Almost always when you use this function it should be the first
transform applied to a new modelview transform</note>
A 4x4 transformation matrix
The X coordinate to look from
The Y coordinate to look from
The Z coordinate to look from
The X coordinate of the object to look at
The Y coordinate of the object to look at
The Z coordinate of the object to look at
The X component of the world's up direction vector
The Y component of the world's up direction vector
The Z component of the world's up direction vector
Multiplies the two supplied matrices together and stores
the resulting matrix inside @result.
<note>It is possible to multiply the @a matrix in-place, so
@result can be equal to @a but can't be equal to @b.</note>
The address of a 4x4 matrix to store the result in
A 4x4 transformation matrix
A 4x4 transformation matrix
Multiplies @matrix by a parallel projection matrix.
Use cogl_matrix_orthographic()
A 4x4 transformation matrix
The coordinate for the left clipping plane
The coordinate for the right clipping plane
The coordinate for the bottom clipping plane
The coordinate for the top clipping plane
Multiplies @matrix by the described perspective matrix
<note>You should be careful not to have to great a @z_far / @z_near
ratio since that will reduce the effectiveness of depth testing
since there wont be enough precision to identify the depth of
objects near to each other.</note>
A 4x4 transformation matrix
Vertical field of view angle in degrees.
The (width over height) aspect ratio for display
The distance to the near clipping plane (Must be positive,
and must not be 0)
The distance to the far clipping plane (Must be positive)
Multiplies @matrix with a rotation matrix that applies a rotation
of @angle degrees around the specified 3D vector.
A 4x4 transformation matrix
The angle you want to rotate in degrees
X component of your rotation vector
Y component of your rotation vector
Z component of your rotation vector
Multiplies @matrix with a transform matrix that scales along the X,
Y and Z axis.
A 4x4 transformation matrix
The X scale factor
The Y scale factor
The Z scale factor
Transforms a point whos position is given and returned as four float
components.
A 4x4 transformation matrix
The X component of your points position
The Y component of your points position
The Z component of your points position
The W component of your points position
Multiplies @matrix with a transform matrix that translates along
the X, Y and Z axis.
A 4x4 transformation matrix
The X translation you want to apply
The Y translation you want to apply
The Z translation you want to apply
Replaces @matrix with its transpose. Ie, every element (i,j) in the
new matrix is taken from element (j,i) in the old matrix.
A #CoglMatrix
Compares two matrices to see if they represent the same
transformation. Although internally the matrices may have different
annotations associated with them and may potentially have a cached
inverse matrix these are not considered in the comparison.
A 4x4 transformation matrix
A 4x4 transformation matrix
This creates an offscreen buffer object using the given @texture as the
primary color buffer. It doesn't just initialize the contents of the
offscreen buffer with the @texture; they are tightly bound so that
drawing to the offscreen buffer effectivly updates the contents of the
given texture. You don't need to destroy the offscreen buffer before
you can use the @texture again.
<note>This only works with low-level #CoglTexture types such as
#CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not
with meta-texture types such as #CoglTexture2DSliced.</note>
Use cogl_offscreen_new_with_texture instead.
a newly instantiated #CoglOffscreen
framebuffer or %NULL if it wasn't possible to create the
buffer.
A #CoglTexture pointer
This creates an offscreen framebuffer object using the given
@texture as the primary color buffer. It doesn't just initialize
the contents of the offscreen buffer with the @texture; they are
tightly bound so that drawing to the offscreen buffer effectively
updates the contents of the given texture. You don't need to
destroy the offscreen buffer before you can use the @texture again.
<note>This api only works with low-level #CoglTexture types such as
#CoglTexture2D, #CoglTexture3D and #CoglTextureRectangle, and not
with meta-texture types such as #CoglTexture2DSliced.</note>
The storage for the framebuffer is actually allocated lazily
so this function will never return %NULL to indicate a runtime
error. This means it is still possible to configure the framebuffer
before it is really allocated.
Simple applications without full error handling can simply rely on
Cogl to lazily allocate the storage of framebuffers but you should
be aware that if Cogl encounters an error (such as running out of
GPU memory) then your application will simply abort with an error
message. If you need to be able to catch such exceptions at runtime
then you can explicitly allocate your framebuffer when you have
finished configuring it by calling cogl_framebuffer_allocate() and
passing in a #CoglError argument to catch any exceptions.
a newly instantiated #CoglOffscreen
framebuffer.
A #CoglTexture pointer
Increments the reference count on the @offscreen framebuffer.
cogl_object_ref() should be used in new code.
For convenience it returns the
given @offscreen
A pointer to a #CoglOffscreen framebuffer
Decreases the reference count for the @offscreen buffer and frees it when
the count reaches 0.
cogl_object_unref() should be used in new code.
A pointer to a #CoglOffscreen framebuffer
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 endianness of the system.
For the formats with non byte aligned components the component
order specifies the order within a 16-bit or 32-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.
Any format
8 bits alpha mask
RGB, 16 bits
RGBA, 16 bits
RGBA, 16 bits
Not currently supported
Single luminance component
RG, 16 bits. Note that red-green textures
are only available if %COGL_FEATURE_ID_TEXTURE_RG is advertised.
See cogl_texture_set_components() for details.
RGB, 24 bits
BGR, 24 bits
RGBA, 32 bits
BGRA, 32 bits
ARGB, 32 bits
ABGR, 32 bits
RGBA, 32 bits, 10 bpc
BGRA, 32 bits, 10 bpc
ARGB, 32 bits, 10 bpc
ABGR, 32 bits, 10 bpc
Premultiplied RGBA, 32 bits
Premultiplied BGRA, 32 bits
Premultiplied ARGB, 32 bits
Premultiplied ABGR, 32 bits
Premultiplied RGBA, 16 bits
Premultiplied RGBA, 16 bits
Premultiplied RGBA, 32 bits, 10 bpc
Premultiplied BGRA, 32 bits, 10 bpc
Premultiplied ARGB, 32 bits, 10 bpc
Premultiplied ABGR, 32 bits, 10 bpc
Evaluates to 180 / pi in fixed point notation.
Flags for cogl_framebuffer_read_pixels_into_bitmap()
Read from the color buffer
Maximum argument that can be passed to cogl_sqrti() for which the
resulting error is < 10%
Maximum argument that can be passed to cogl_sqrti() for which the
resulting error is < 5%
Maximum argument that can be passed to cogl_sqrti() function.
Types of shaders
A program for proccessing vertices
A program for processing fragments
Represents how draw should affect the two buffers
of a stereo framebuffer. See cogl_framebuffer_set_stereo_mode().
draw to both stereo buffers
draw only to the left stereo buffer
draw only to the left stereo buffer
Error enumeration for Cogl
The @COGL_SYSTEM_ERROR_UNSUPPORTED error can be thrown for a
variety of reasons. For example:
<itemizedlist>
<listitem><para>You've tried to use a feature that is not
advertised by cogl_has_feature(). This could happen if you create
a 2d texture with a non-power-of-two size when
%COGL_FEATURE_ID_TEXTURE_NPOT is not advertised.</para></listitem>
<listitem><para>The GPU can not handle the configuration you have
requested. An example might be if you try to use too many texture
layers in a single #CoglPipeline</para></listitem>
<listitem><para>The driver does not support some
configuration.</para></listiem>
</itemizedlist>
Currently this is only used by Cogl API marked as experimental so
this enum should also be considered experimental.
You tried to use a feature or
configuration not currently available.
You tried to allocate a resource
such as a texture and there wasn't enough memory.
Increment the reference count for a cogl texture.
Use cogl_object_ref() instead
the @texture pointer.
a #CoglTexture.
Decrement the reference count for a cogl texture.
Use cogl_object_unref() instead
a #CoglTexture.
Explicitly allocates the storage for the given @texture which
allows you to be sure that there is enough memory for the
texture and if not then the error can be handled gracefully.
<note>Normally applications don't need to use this api directly
since the texture will be implicitly allocated when data is set on
the texture, or if the texture is attached to a #CoglOffscreen
framebuffer and rendered too.</note>
%TRUE if the texture was successfully allocated,
otherwise %FALSE and @error will be updated if it
wasn't %NULL.
A #CoglTexture
Queries what components the given @texture stores internally as set
via cogl_texture_set_components().
For textures created by the ‘_with_size’ constructors the default
is %COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take
a %CoglBitmap or a data pointer default to the same components as
the pixel format of the data.
a #CoglTexture pointer.
Copies the pixel data from a cogl texture to system memory.
<note>Don't pass the value of cogl_texture_get_rowstride() as the
@rowstride argument, the rowstride should be the rowstride you
want for the destination @data buffer not the rowstride of the
source texture</note>
the size of the texture data in bytes
a #CoglTexture pointer.
the #CoglPixelFormat to store the texture as.
the rowstride of @data in bytes or pass 0 to calculate
from the bytes-per-pixel of @format multiplied by the
@texture width.
memory location to write the @texture's contents, or %NULL
to only query the data size through the return value.
Queries the GL handles for a GPU side texture through its #CoglTexture.
If the texture is spliced the data for the first sub texture will be
queried.
%TRUE if the handle was successfully retrieved, %FALSE
if the handle was invalid
a #CoglTexture pointer.
pointer to return location for the
textures GL handle, or %NULL.
pointer to return location for the
GL target type, or %NULL.
Queries the height of a cogl texture.
the height of the GPU side texture in pixels
a #CoglTexture pointer.
Queries the maximum wasted (unused) pixels in one dimension of a GPU side
texture.
the maximum waste
a #CoglTexture pointer.
Queries the pre-multiplied alpha status for internally stored red,
green and blue components for the given @texture as set by
cogl_texture_set_premultiplied().
By default the pre-multipled state is @TRUE.
%TRUE if red, green and blue components are
internally stored pre-multiplied by the alpha
value or %FALSE if not.
a #CoglTexture pointer.
Queries the width of a cogl texture.
the width of the GPU side texture in pixels
a #CoglTexture pointer.
Queries if a texture is sliced (stored as multiple GPU side tecture
objects).
%TRUE if the texture is sliced, %FALSE if the texture
is stored as a single GPU texture
a #CoglTexture pointer.
Affects the internal storage format for this texture by specifying
what components will be required for sampling later.
This api affects how data is uploaded to the GPU since unused
components can potentially be discarded from source data.
For textures created by the ‘_with_size’ constructors the default
is %COGL_TEXTURE_COMPONENTS_RGBA. The other constructors which take
a %CoglBitmap or a data pointer default to the same components as
the pixel format of the data.
Note that the %COGL_TEXTURE_COMPONENTS_RG format is not available
on all drivers. The availability can be determined by checking for
the %COGL_FEATURE_ID_TEXTURE_RG feature. If this format is used on
a driver where it is not available then %COGL_TEXTURE_ERROR_FORMAT
will be raised when the texture is allocated. Even if the feature
is not available then %COGL_PIXEL_FORMAT_RG_88 can still be used as
an image format as long as %COGL_TEXTURE_COMPONENTS_RG isn't used
as the texture's components.
a #CoglTexture pointer.
Affects the internal storage format for this texture by specifying
whether red, green and blue color components should be stored as
pre-multiplied alpha values.
This api affects how data is uploaded to the GPU since Cogl will
convert source data to have premultiplied or unpremultiplied
components according to this state.
For example if you create a texture via
cogl_texture_2d_new_with_size() and then upload data via
cogl_texture_set_data() passing a source format of
%COGL_PIXEL_FORMAT_RGBA_8888 then Cogl will internally multiply the
red, green and blue components of the source data by the alpha
component, for each pixel so that the internally stored data has
pre-multiplied alpha components. If you instead upload data that
already has pre-multiplied components by passing
%COGL_PIXEL_FORMAT_RGBA_8888_PRE as the source format to
cogl_texture_set_data() then the data can be uploaded without being
converted.
By default the @premultipled state is @TRUE.
a #CoglTexture pointer.
Whether any internally stored red, green or blue
components are pre-multiplied by an alpha
component.
Sets the pixels in a rectangular subregion of @texture from an in-memory
buffer containing pixel data.
<note>The region set can't be larger than the source @data</note>
%TRUE if the subregion upload was successful, and
%FALSE otherwise
a #CoglTexture.
upper left coordinate to use from source data.
upper left coordinate to use from source data.
upper left destination horizontal coordinate.
upper left destination vertical coordinate.
width of destination region to write. (Must be less
than or equal to @width)
height of destination region to write. (Must be less
than or equal to @height)
width of source data buffer.
height of source data buffer.
the #CoglPixelFormat used in the source buffer.
rowstride of source buffer (computed from width if none
specified)
the actual pixel data.
See cogl_texture_set_components().
Only the alpha component
Red and green components. Note that
this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
is advertised.
Red, green and blue components
Red, green, blue and alpha components
Only a depth component
Error codes that can be thrown when allocating textures.
Unsupported size
Unsupported format
A primitive texture type that is
unsupported by the driver was used
Flags to pass to the cogl_texture_new_* family of functions.
No flags specified
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
this flag when using other filtering modes
Disables the slicing of the texture
Disables the insertion of the texture inside
the texture atlas used by Cogl
Constants representing the underlying hardware texture type of a
#CoglTexture.
A #CoglTexture2D
A #CoglTexture3D
A #CoglTextureRectangle
Used to specify vertex information when calling cogl_polygon()
Model x-coordinate
Model y-coordinate
Model z-coordinate
Texture x-coordinate
Texture y-coordinate
The color to use at this vertex. This is ignored if
use_color is %FALSE when calling cogl_polygon()
Different ways of interpreting vertices when drawing.
FIXME, equivalent to
<constant>GL_POINTS</constant>
FIXME, equivalent to <constant>GL_LINES</constant>
FIXME, equivalent to
<constant>GL_LINE_LOOP</constant>
FIXME, equivalent to
<constant>GL_LINE_STRIP</constant>
FIXME, equivalent to
<constant>GL_TRIANGLES</constant>
FIXME, equivalent to
<constant>GL_TRIANGLE_STRIP</constant>
FIXME, equivalent to <constant>GL_TRIANGLE_FAN</constant>
Enum used to represent the two directions of rotation. This can be
used to set the front face for culling by calling
cogl_pipeline_set_front_face_winding().
Vertices are in a clockwise order
Vertices are in a counter-clockwise order
Computes the cosine of @angle
the cosine of the passed angle
an angle expressed using #CoglAngle
Computes the sine of @angle
the sine of the passed angle
an angle expressed using #CoglAngle
Computes the tangent of @angle
the tangent of the passed angle
an angle expressed using #CoglAngle
We do not advise nor reliably support the interleaving of raw GL drawing and
Cogl drawing functions, but if you insist, cogl_begin_gl() and cogl_end_gl()
provide a simple mechanism that may at least give you a fighting chance of
succeeding.
Note: this doesn't help you modify the behaviour of Cogl drawing functions
through the modification of GL state; that will never be reliably supported,
but if you are trying to do something like:
|[
{
- setup some OpenGL state.
- draw using OpenGL (e.g. glDrawArrays() )
- reset modified OpenGL state.
- continue using Cogl to draw
}
]|
You should surround blocks of drawing using raw GL with cogl_begin_gl()
and cogl_end_gl():
|[
{
cogl_begin_gl ();
- setup some OpenGL state.
- draw using OpenGL (e.g. glDrawArrays() )
- reset modified OpenGL state.
cogl_end_gl ();
- continue using Cogl to draw
}
]|
Don't ever try and do:
|[
{
- setup some OpenGL state.
- use Cogl to draw
- reset modified OpenGL state.
}
]|
When the internals of Cogl evolves, this is very liable to break.
This function will flush all batched primitives, and subsequently flush
all internal Cogl state to OpenGL as if it were going to draw something
itself.
The result is that the OpenGL modelview matrix will be setup; the state
corresponding to the current source material will be set up and other world
state such as backface culling, depth and fogging enabledness will be sent
to OpenGL.
<note>No special material state is flushed, so if you want Cogl to setup a
simplified material state it is your responsibility to set a simple source
material before calling cogl_begin_gl(). E.g. by calling
cogl_set_source_color4ub().</note>
<note>It is your responsibility to restore any OpenGL state that you modify
to how it was after calling cogl_begin_gl() if you don't do this then the
result of further Cogl calls is undefined.</note>
<note>You can not nest begin/end blocks.</note>
Again we would like to stress, we do not advise the use of this API and if
possible we would prefer to improve Cogl than have developers require raw
OpenGL.
Use the #CoglGLES2Context api instead
Check whether @name occurs in list of extensions in @ext.
OpenGL is an implementation detail for Cogl and so it's
not appropriate to expose OpenGL extensions through the Cogl API. This
function can be replaced by the following equivalent code:
|[
CoglBool retval = (strstr (ext, name) != NULL) ? TRUE : FALSE;
]|
%TRUE if the extension occurs in the list, %FALSE otherwise.
extension to check for
list of extensions
Clears all the auxiliary buffers identified in the @buffers mask, and if
that includes the color buffer then the specified @color is used.
Use cogl_framebuffer_clear() api instead
Background color to clear to
A mask of #CoglBufferBit<!-- -->'s identifying which auxiliary
buffers to clear
Ensures that the current clipping region has been set in GL. This
will automatically be called before any Cogl primitives but it
maybe be neccessary to call if you are using raw GL calls with
clipping.
Calling this function has no effect
Reverts the clipping region to the state before the last call to
cogl_clip_push().
Use cogl_framebuffer_pop_clip() instead
Specifies a rectangular clipping area for all subsequent drawing
operations. Any drawing commands that extend outside the rectangle
will be clipped so that only the portion inside the rectangle will
be displayed. The rectangle dimensions are transformed by the
current model-view matrix.
The rectangle is intersected with the current clip region. To undo
the effect of this function, call cogl_clip_pop().
The x, y, width, height arguments are inconsistent
with other API that specify rectangles in model space, and when used
with a coordinate space that puts the origin at the center and y+
extending up, it's awkward to use. Please use
cogl_framebuffer_push_rectangle_clip()
left edge of the clip rectangle
top edge of the clip rectangle
width of the clip rectangle
height of the clip rectangle
Sets a new clipping area using a 2D shaped described with a
#CoglPrimitive. The shape must not contain self overlapping
geometry and must lie on a single 2D plane. A bounding box of the
2D shape in local coordinates (the same coordinates used to
describe the shape) must be given. It is acceptable for the bounds
to be larger than the true bounds but behaviour is undefined if the
bounds are smaller than the true bounds.
The primitive is transformed by the current model-view matrix and
the silhouette is intersected with the previous clipping area. To
restore the previous clipping area, call
cogl_clip_pop().
Use cogl_framebuffer_push_primitive_clip()
instead
A #CoglPrimitive describing a flat 2D shape
x coordinate for the top-left corner of the primitives
bounds
y coordinate for the top-left corner of the primitives
bounds
x coordinate for the bottom-right corner of the primitives
bounds
y coordinate for the bottom-right corner of the
primitives bounds.
Specifies a rectangular clipping area for all subsequent drawing
operations. Any drawing commands that extend outside the rectangle
will be clipped so that only the portion inside the rectangle will
be displayed. The rectangle dimensions are transformed by the
current model-view matrix.
The rectangle is intersected with the current clip region. To undo
the effect of this function, call cogl_clip_pop().
Use cogl_framebuffer_push_rectangle_clip()
instead
x coordinate for top left corner of the clip rectangle
y coordinate for top left corner of the clip rectangle
x coordinate for bottom right corner of the clip rectangle
y coordinate for bottom right corner of the clip rectangle
Specifies a rectangular clipping area for all subsequent drawing
operations. Any drawing commands that extend outside the rectangle
will be clipped so that only the portion inside the rectangle will
be displayed. The rectangle dimensions are not transformed by the
current model-view matrix.
The rectangle is intersected with the current clip region. To undo
the effect of this function, call cogl_clip_pop().
Use cogl_framebuffer_push_scissor_clip() instead
left edge of the clip rectangle in window coordinates
top edge of the clip rectangle in window coordinates
width of the clip rectangle
height of the clip rectangle
Specifies a rectangular clipping area for all subsequent drawing
operations. Any drawing commands that extend outside the rectangle
will be clipped so that only the portion inside the rectangle will
be displayed. The rectangle dimensions are not transformed by the
current model-view matrix.
The rectangle is intersected with the current clip region. To undo
the effect of this function, call cogl_clip_pop().
Use cogl_framebuffer_push_scissor_clip() instead
left edge of the clip rectangle in window coordinates
top edge of the clip rectangle in window coordinates
width of the clip rectangle
height of the clip rectangle
Restore the state of the clipping stack that was previously saved
by cogl_clip_stack_save().
This was originally added to allow us to restore
the clip stack when switching back from an offscreen framebuffer,
but it's not necessary anymore given that framebuffers now own
separate clip stacks which will be automatically switched between
when a new buffer is set. Calling this function has no effect
Save the entire state of the clipping stack and then clear all
clipping. The previous state can be returned to with
cogl_clip_stack_restore(). Each call to cogl_clip_push() after this
must be matched by a call to cogl_clip_pop() before calling
cogl_clip_stack_restore().
This was originally added to allow us to save the
clip stack when switching to an offscreen framebuffer, but it's
not necessary anymore given that framebuffers now own separate
clip stacks which will be automatically switched between when a
new buffer is set. Calling this function has no effect
Compares two #CoglColor<!-- -->s and checks if they are the same.
This function can be passed to g_hash_table_new() as the @key_equal_func
parameter, when using #CoglColor<!-- -->s as keys in a #GHashTable.
%TRUE if the two colors are the same.
a #CoglColor
a #CoglColor
Converts a color expressed in HLS (hue, luminance and saturation)
values into a #CoglColor.
return location for a #CoglColor
hue value, in the 0 .. 360 range
saturation value, in the 0 .. 1 range
luminance value, in the 0 .. 1 range
Create a new cogl program object that can be used to replace parts of the GL
rendering pipeline with custom code.
Use #CoglSnippet api
a new cogl program.
Create a new shader handle, use cogl_shader_source() to set the
source code to be used on it.
Use #CoglSnippet api
a new shader handle.
COGL_SHADER_TYPE_VERTEX or COGL_SHADER_TYPE_FRAGMENT.
Prints the contents of a #CoglMatrix to stdout.
A #CoglMatrix
This function disables fogging, so primitives drawn afterwards will not be
blended with any previously set fog color.
Use #CoglSnippet shader api for fog
This is the counterpart to cogl_begin_gl() used to delimit blocks of drawing
code using raw OpenGL. Please refer to cogl_begin_gl() for full details.
Use the #CoglGLES2Context api instead
Checks whether the given COGL features are available. Multiple
features can be checked for by or-ing them together with the '|'
operator. %TRUE is only returned if all of the requested features
are available.
Use cogl_has_feature() instead
%TRUE if the features are available, %FALSE otherwise.
A bitmask of features to check for
This function should only need to be called in exceptional circumstances.
As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.
It only ensure that the underlying driver is issued all the commands
necessary to draw the batched primitives. It provides no guarantees about
when the driver will complete the rendering.
This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.
If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals. For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs itself for the material API.
Queries the common #CoglPixelFormat of all color buffers attached
to this framebuffer. For an offscreen framebuffer created with
cogl_offscreen_new_with_texture() this will correspond to the format
of the texture.
This API is deprecated because it is missleading to report a
#CoglPixelFormat for the internal format of the @framebuffer since
#CoglPixelFormat is such a precise format description and it's
only the set of components and the premultiplied alpha status
that is really known.
Deprecated 1.18: Removed since it is misleading
A #CoglFramebuffer framebuffer
Replaces the current projection matrix with a perspective matrix
for a given viewing frustum defined by 4 side clip planes that
all cross through the origin and 2 near and far clip planes.
Use cogl_framebuffer_frustum() instead
X position of the left clipping plane where it
intersects the near clipping plane
X position of the right clipping plane where it
intersects the near clipping plane
Y position of the bottom clipping plane where it
intersects the near clipping plane
Y position of the top clipping plane where it intersects
the near clipping plane
The distance to the near clipping plane (Must be positive)
The distance to the far clipping plane (Must be positive)
Queries if backface culling has been enabled via
cogl_set_backface_culling_enabled()
Use cogl_pipeline_get_cull_face_mode() instead
%TRUE if backface culling is enabled, and %FALSE otherwise
Gets the number of bitplanes used for each of the color components
in the color buffer. Pass %NULL for any of the arguments if the
value is not required.
Use cogl_framebuffer_get_red/green/blue/alpha_bits()
instead
Return location for the number of red bits or %NULL
Return location for the number of green bits or %NULL
Return location for the number of blue bits or %NULL
Return location for the number of alpha bits or %NULL
Queries if depth testing has been enabled via cogl_set_depth_test_enable()
Use cogl_pipeline_set_depth_state() instead
%TRUE if depth testing is enabled, and %FALSE otherwise
Returns all of the features supported by COGL.
Use cogl_foreach_feature() instead
A logical OR of all the supported COGL features.
Stores the current model-view matrix in @matrix.
Use cogl_framebuffer_get_modelview_matrix()
instead
return location for the model-view matrix
Retrieves the #GOptionGroup used by Cogl to parse the command
line options. Clutter uses this to handle the Cogl command line
options during its initialization process.
Not replaced
a #GOptionGroup
Gets a pointer to a given GL or GL ES extension function. This acts
as a wrapper around glXGetProcAddress() or whatever is the
appropriate function for the current backend.
<note>This function should not be used to query core opengl API
symbols since eglGetProcAddress for example doesn't allow this and
and may return a junk pointer if you do.</note>
a pointer to the requested function or %NULL if the
function is not available.
the name of the function.
Stores the current projection matrix in @matrix.
Use cogl_framebuffer_get_projection_matrix()
instead
return location for the projection matrix
Returns the current source material as previously set using
cogl_set_source().
<note>You should typically consider the returned material immutable
and not try to change any of its properties unless you own a
reference to that material. At times you may be able to get a
reference to an internally managed materials and the result of
modifying such materials is undefined.</note>
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
The current source material.
Stores the current viewport in @v. @v[0] and @v[1] get the x and y
position of the viewport and @v[2] and @v[3] get the width and
height.
Use cogl_framebuffer_get_viewport4fv()
instead
pointer to a 4 element array
of #float<!-- -->s to receive the viewport dimensions.
Use cogl_matrix_get_gtype() instead.
the GType for the registered "CoglMatrix" boxed type. This
can be used for example to define GObject properties that accept a
#CoglMatrix value.
Increases the reference count of @handle by 1
the handle, with its reference count increased
a #CoglHandle
Drecreases the reference count of @handle by 1; if the reference
count reaches 0, the resources allocated by @handle will be freed
a #CoglHandle
Checks whether @object is a #CoglBitmap
%TRUE if the passed @object represents a bitmap,
and %FALSE otherwise
a #CoglObject pointer
Gets whether the given handle references an existing material object.
Use cogl_is_pipeline() instead
%TRUE if the handle references a #CoglMaterial,
%FALSE otherwise
A CoglHandle
Determines whether the given #CoglObject references an offscreen
framebuffer object.
%TRUE if @object is a #CoglOffscreen framebuffer,
%FALSE otherwise
A pointer to a #CoglObject
Gets whether the given handle references an existing program object.
Use #CoglSnippet api
%TRUE if the handle references a program,
%FALSE otherwise
A CoglHandle
Gets whether the given handle references an existing shader object.
Use #CoglSnippet api
%TRUE if the handle references a shader,
%FALSE otherwise
A CoglHandle
Gets whether the given object references a texture object.
%TRUE if the @object references a texture, and
%FALSE otherwise
A #CoglObject pointer
Checks whether @handle is a Vertex Buffer Object
Use the #CoglPrimitive api instead
%TRUE if the handle is a VBO, and %FALSE
otherwise
a #CoglHandle for a vertex buffer object
Checks whether @handle is a handle to the indices for a vertex
buffer object
Use the #CoglPrimitive api instead
%TRUE if the handle is indices, and %FALSE
otherwise
a #CoglHandle
Increment the reference count for a #CoglMaterial.
Use cogl_object_ref() instead
the @material.
a #CoglMaterial object.
Decrement the reference count for a #CoglMaterial.
Use cogl_object_unref() instead
a #CoglMaterial object.
Compares two matrices to see if they represent the same
transformation. Although internally the matrices may have different
annotations associated with them and may potentially have a cached
inverse matrix these are not considered in the comparison.
A 4x4 transformation matrix
A 4x4 transformation matrix
Replaces the current projection matrix with an orthographic projection
matrix. See <xref linkend="cogl-ortho-matrix"/> to see how the matrix is
calculated.
<figure id="cogl-ortho-matrix">
<title></title>
<graphic fileref="cogl_ortho.png" format="PNG"/>
</figure>
<note>This function copies the arguments from OpenGL's glOrtho() even
though they are unnecessarily confusing due to the z near and z far
arguments actually being a "distance" from the origin, where
negative values are behind the viewer, instead of coordinates for
the z clipping planes which would have been consistent with the
left, right bottom and top arguments.</note>
Use cogl_framebuffer_orthographic() instead
The coordinate for the left clipping plane
The coordinate for the right clipping plane
The coordinate for the bottom clipping plane
The coordinate for the top clipping plane
Replaces the current projection matrix with a perspective matrix
based on the provided values.
<note>You should be careful not to have to great a @z_far / @z_near
ratio since that will reduce the effectiveness of depth testing
since there wont be enough precision to identify the depth of
objects near to each other.</note>
Use cogl_framebuffer_perspective() instead
Vertical field of view angle in degrees.
The (width over height) aspect ratio for display
The distance to the near clipping plane (Must be positive)
The distance to the far clipping plane (Must be positive)
Draws a convex polygon using the current source material to fill / texture
with according to the texture coordinates passed.
If @use_color is %TRUE then the color will be changed for each vertex using
the value specified in the color member of #CoglTextureVertex. This can be
used for example to make the texture fade out by setting the alpha value of
the color.
All of the texture coordinates must be in the range [0,1] and repeating the
texture is not supported.
Because of the way this function is implemented it will currently
only work if either the texture is not sliced or the backend is not
OpenGL ES and the minifying and magnifying functions are both set
to COGL_MATERIAL_FILTER_NEAREST.
An array of #CoglTextureVertex structs
The length of the vertices array
%TRUE if the color member of #CoglTextureVertex should be used
Restore cogl_set_draw_buffer() state.
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
Restores the framebuffer that was previously at the top of the stack.
All subsequent drawing will be redirected to this framebuffer.
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
Restores the current model-view matrix from the matrix stack.
Use cogl_framebuffer_pop_matrix() instead
Removes the material at the top of the source stack. The material
at the top of this stack defines the GPU state used to process
later primitives as defined by cogl_set_source().
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
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.
Use #CoglSnippet api
a #CoglHandle for a shdaer program.
a #CoglHandle for a vertex of fragment shader.
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
shader object and is possible to modify as an external parameter.
Use #CoglSnippet api instead
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.
a #CoglHandle for a shader program.
the name of a uniform.
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.
Use #CoglSnippet api
a #CoglHandle for a shader program.
Add an extra reference to a program.
Use #CoglSnippet api
@handle
A #CoglHandle to a program.
Changes the value of a floating point uniform for the given linked
@program.
Use #CoglSnippet api instead
A #CoglHandle for a linked program
the uniform location retrieved from
cogl_program_get_uniform_location().
the new value of the uniform.
Changes the value of an integer uniform for the given linked
@program.
Use #CoglSnippet api instead
A #CoglHandle for a linked program
the uniform location retrieved from
cogl_program_get_uniform_location().
the new value of the uniform.
Changes the value of a float vector uniform, or uniform array for
the given linked @program.
Use #CoglSnippet api instead
A #CoglHandle for a linked program
the uniform location retrieved from
cogl_program_get_uniform_location().
The number of components for the uniform. For
example with glsl you'd use 3 for a vec3 or 4 for a vec4.
For uniform arrays this is the array length otherwise just
pass 1
the new value of the uniform[s].
Changes the value of a int vector uniform, or uniform array for
the given linked @program.
Use #CoglSnippet api instead
A #CoglHandle for a linked program
the uniform location retrieved from
cogl_program_get_uniform_location().
The number of components for the uniform. For
example with glsl you'd use 3 for a vec3 or 4 for a vec4.
For uniform arrays this is the array length otherwise just
pass 1
the new value of the uniform[s].
Changes the value of a matrix uniform, or uniform array in the
given linked @program.
Use #CoglSnippet api instead
A #CoglHandle for a linked program
the uniform location retrieved from
cogl_program_get_uniform_location().
The dimensions of the matrix. So for for example pass
2 for a 2x2 matrix or 3 for 3x3.
For uniform arrays this is the array length otherwise just
pass 1
Whether to transpose the matrix when setting the uniform.
the new value of the uniform.
Changes the value of a floating point uniform in the currently
used (see cogl_program_use()) shader program.
Use #CoglSnippet api
the uniform to set.
the new value of the uniform.
Changes the value of an integer uniform in the currently
used (see cogl_program_use()) shader program.
Use #CoglSnippet api
the uniform to set.
the new value of the uniform.
Changes the value of a float vector uniform, or uniform array in the
currently used (see cogl_program_use()) shader program.
Use #CoglSnippet api
the uniform to set.
Size of float vector.
Size of array of uniforms.
the new value of the uniform.
Changes the value of a int vector uniform, or uniform array in the
currently used (see cogl_program_use()) shader program.
Use #CoglSnippet api
the uniform to set.
Size of int vector.
Size of array of uniforms.
the new value of the uniform.
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.
Use #CoglSnippet api
the uniform to set.
Size of matrix.
Size of array of uniforms.
Whether to transpose the matrix when setting the uniform.
the new value of the uniform.
Removes a reference to a program. If it was the last reference the
program object will be destroyed.
Use #CoglSnippet api
A #CoglHandle to a program.
Activate a specific shader program replacing that part of the GL
rendering pipeline, if passed in %COGL_INVALID_HANDLE the default
behavior of GL is reinstated.
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().
Use #CoglSnippet api
a #CoglHandle for a shader program or %COGL_INVALID_HANDLE.
Save cogl_set_draw_buffer() state.
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
Redirects all subsequent drawing to the specified framebuffer. This can
either be an offscreen buffer created with cogl_offscreen_new_to_texture ()
or in the future it may be an onscreen framebuffer too.
You should understand that a framebuffer owns the following state:
<itemizedlist>
<listitem><simpara>The projection matrix</simpara></listitem>
<listitem><simpara>The modelview matrix stack</simpara></listitem>
<listitem><simpara>The viewport</simpara></listitem>
<listitem><simpara>The clip stack</simpara></listitem>
</itemizedlist>
So these items will automatically be saved and restored when you
push and pop between different framebuffers.
Also remember a newly allocated framebuffer will have an identity matrix for
the projection and modelview matrices which gives you a coordinate space
like OpenGL with (-1, -1) corresponding to the top left of the viewport,
(1, 1) corresponding to the bottom right and +z coming out towards the
viewer.
If you want to set up a coordinate space like Clutter does with (0, 0)
corresponding to the top left and (framebuffer_width, framebuffer_height)
corresponding to the bottom right you can do so like this:
|[
static void
setup_viewport (unsigned int width,
unsigned int height,
float fovy,
float aspect,
float z_near,
float z_far)
{
float z_camera;
CoglMatrix projection_matrix;
CoglMatrix mv_matrix;
cogl_set_viewport (0, 0, width, height);
cogl_perspective (fovy, aspect, z_near, z_far);
cogl_get_projection_matrix (&projection_matrix);
z_camera = 0.5 * projection_matrix.xx;
cogl_matrix_init_identity (&mv_matrix);
cogl_matrix_translate (&mv_matrix, -0.5f, -0.5f, -z_camera);
cogl_matrix_scale (&mv_matrix, 1.0f / width, -1.0f / height, 1.0f / width);
cogl_matrix_translate (&mv_matrix, 0.0f, -1.0 * height, 0.0f);
cogl_set_modelview_matrix (&mv_matrix);
}
static void
my_init_framebuffer (ClutterStage *stage,
CoglFramebuffer *framebuffer,
unsigned int framebuffer_width,
unsigned int framebuffer_height)
{
ClutterPerspective perspective;
clutter_stage_get_perspective (stage, &perspective);
cogl_push_framebuffer (framebuffer);
setup_viewport (framebuffer_width,
framebuffer_height,
perspective.fovy,
perspective.aspect,
perspective.z_near,
perspective.z_far);
}
]|
The previous framebuffer can be restored by calling cogl_pop_framebuffer()
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
A #CoglFramebuffer object, either onscreen or offscreen.
Stores the current model-view matrix on the matrix stack. The matrix
can later be restored with cogl_pop_matrix().
Use cogl_framebuffer_push_matrix() instead
Pushes the given @material to the top of the source stack. The
material at the top of this stack defines the GPU state used to
process later primitives as defined by cogl_set_source().
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
A #CoglMaterial
This reads a rectangle of pixels from the current framebuffer where
position (0, 0) is the top left. The pixel at (x, y) is the first
read, and the data is returned with a rowstride of (width * 4).
Currently Cogl assumes that the framebuffer is in a premultiplied
format so if @format is non-premultiplied it will convert it. To
read the pixel values without any conversion you should either
specify a format that doesn't use an alpha channel or use one of
the formats ending in PRE.
Use cogl_framebuffer_read_pixels() instead
The window x position to start reading from
The window y position to start reading from
The width of the rectangle you want to read
The height of the rectangle you want to read
Identifies which auxillary buffer you want to read
(only COGL_READ_PIXELS_COLOR_BUFFER supported currently)
The pixel format you want the result in
(only COGL_PIXEL_FORMAT_RGBA_8888 supported currently)
The location to write the pixel data.
Fills a rectangle at the given coordinates with the current source material
X coordinate of the top-left corner
Y coordinate of the top-left corner
X coordinate of the bottom-right corner
Y coordinate of the bottom-right corner
This function draws a rectangle using the current source material to
texture or fill with. As a material may contain multiple texture layers
this interface lets you supply texture coordinates for each layer of the
material.
The first pair of coordinates are for the first layer (with the smallest
layer index) and if you supply less texture coordinates than there are
layers in the current source material then default texture coordinates
(0.0, 0.0, 1.0, 1.0) are generated.
x coordinate upper left on screen.
y coordinate upper left on screen.
x coordinate lower right on screen.
y coordinate lower right on screen.
An array containing groups of
4 float values: [tx1, ty1, tx2, ty2] that are interpreted as two texture
coordinates; one for the upper left texel, and one for the lower right
texel. Each value should be between 0.0 and 1.0, where the coordinate
(0.0, 0.0) represents the top left of the texture, and (1.0, 1.0) the
bottom right.
The length of the tex_coords array. (e.g. for one layer
and one group of texture coordinates, this would be 4)
Draw a rectangle using the current material and supply texture coordinates
to be used for the first texture layer of the material. To draw the entire
texture pass in @tx1=0.0 @ty1=0.0 @tx2=1.0 @ty2=1.0.
x coordinate upper left on screen.
y coordinate upper left on screen.
x coordinate lower right on screen.
y coordinate lower right on screen.
x part of texture coordinate to use for upper left pixel
y part of texture coordinate to use for upper left pixel
x part of texture coordinate to use for lower right pixel
y part of texture coordinate to use for left pixel
Draws a series of rectangles in the same way that
cogl_rectangle() does. In some situations it can give a
significant performance boost to use this function rather than
calling cogl_rectangle() separately for each rectangle.
@verts should point to an array of #float<!-- -->s with
@n_rects * 4 elements. Each group of 4 values corresponds to the
parameters x1, y1, x2, and y2, and have the same
meaning as in cogl_rectangle().
an array of vertices
number of rectangles to draw
Draws a series of rectangles in the same way that
cogl_rectangle_with_texture_coords() does. In some situations it can give a
significant performance boost to use this function rather than
calling cogl_rectangle_with_texture_coords() separately for each rectangle.
@verts should point to an array of #float<!-- -->s with
@n_rects * 8 elements. Each group of 8 values corresponds to the
parameters x1, y1, x2, y2, tx1, ty1, tx2 and ty2 and have the same
meaning as in cogl_rectangle_with_texture_coords().
an array of vertices
number of rectangles to draw
Multiplies the current model-view matrix by one that rotates the
model around the vertex specified by @x, @y and @z. The rotation
follows the right-hand thumb rule so for example rotating by 10
degrees about the vertex (0, 0, 1) causes a small counter-clockwise
rotation.
Use cogl_framebuffer_rotate() instead
Angle in degrees to rotate.
X-component of vertex to rotate around.
Y-component of vertex to rotate around.
Z-component of vertex to rotate around.
Multiplies the current model-view matrix by one that scales the x,
y and z axes by the given values.
Use cogl_framebuffer_pop_matrix() instead
Amount to scale along the x-axis
Amount to scale along the y-axis
Amount to scale along the z-axis
Sets whether textures positioned so that their backface is showing
should be hidden. This can be used to efficiently draw two-sided
textures or fully closed cubes without enabling depth testing. This
only affects calls to the cogl_rectangle* family of functions and
cogl_vertex_buffer_draw*. Backface culling is disabled by default.
Use cogl_pipeline_set_cull_face_mode() instead
%TRUE to enable backface culling or %FALSE to disable.
Sets whether depth testing is enabled. If it is disabled then the
order that actors are layered on the screen depends solely on the
order specified using clutter_actor_raise() and
clutter_actor_lower(), otherwise it will also take into account the
actor's depth. Depth testing is disabled by default.
Use cogl_pipeline_set_depth_state() instead
%TRUE to enable depth testing or %FALSE to disable.
Redirects all subsequent drawing to the specified framebuffer. This
can either be an offscreen buffer created with
cogl_offscreen_new_to_texture () or you can revert to your original
on screen window buffer.
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
A #CoglBufferTarget that specifies what kind of framebuffer you
are setting as the render target.
If you are setting a framebuffer of type COGL_OFFSCREEN_BUFFER
then this is a CoglHandle for the offscreen buffer.
Enables fogging. Fogging causes vertices that are further away from the eye
to be rendered with a different color. The color is determined according to
the chosen fog mode; at it's simplest the color is linearly interpolated so
that vertices at @z_near are drawn fully with their original color and
vertices at @z_far are drawn fully with @fog_color. Fogging will remain
enabled until you call cogl_disable_fog().
<note>The fogging functions only work correctly when primitives use
unmultiplied alpha colors. By default Cogl will premultiply textures
and cogl_set_source_color() will premultiply colors, so unless you
explicitly load your textures requesting an unmultiplied internal format
and use cogl_material_set_color() you can only use fogging with fully
opaque primitives. This might improve in the future when we can depend
on fragment shaders.</note>
Use #CoglSnippet shader api for fog
The color of the fog
A #CoglFogMode that determines the equation used to calculate the
fogging blend factor.
Used by %COGL_FOG_MODE_EXPONENTIAL and by
%COGL_FOG_MODE_EXPONENTIAL_SQUARED equations.
Position along Z axis where no fogging should be applied
Position along Z axis where full fogging should be applied
This redirects all subsequent drawing to the specified framebuffer. This can
either be an offscreen buffer created with cogl_offscreen_new_to_texture ()
or in the future it may be an onscreen framebuffers too.
The latest drawing apis take explicit
#CoglFramebuffer arguments so this stack of
framebuffers shouldn't be used anymore.
A #CoglFramebuffer object, either onscreen or offscreen.
Loads @matrix as the new model-view matrix.
Use cogl_framebuffer_set_modelview_matrix()
instead
the new model-view matrix
Loads matrix as the new projection matrix.
Use cogl_framebuffer_set_projection_matrix()
instead
the new projection matrix
This function changes the material at the top of the source stack.
The material at the top of this stack defines the GPU state used to
process subsequent primitives, such as rectangles drawn with
cogl_rectangle() or vertices drawn using cogl_vertex_buffer_draw().
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
A #CoglMaterial
This is a convenience function for creating a solid fill source material
from the given color. This color will be used for any subsequent drawing
operation.
The color will be premultiplied by Cogl, so the color should be
non-premultiplied. For example: use (1.0, 0.0, 0.0, 0.5) for
semi-transparent red.
See also cogl_set_source_color4ub() and cogl_set_source_color4f()
if you already have the color components.
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
a #CoglColor
This is a convenience function for creating a solid fill source material
from the given color using normalized values for each component. This color
will be used for any subsequent drawing operation.
The value for each component is a fixed point number in the range
between 0 and %1.0. If the values passed in are outside that
range, they will be clamped.
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
value of the red channel, between 0 and %1.0
value of the green channel, between 0 and %1.0
value of the blue channel, between 0 and %1.0
value of the alpha channel, between 0 and %1.0
This is a convenience function for creating a solid fill source material
from the given color using unsigned bytes for each component. This
color will be used for any subsequent drawing operation.
The value for each component is an unsigned byte in the range
between 0 and 255.
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
value of the red channel, between 0 and 255
value of the green channel, between 0 and 255
value of the blue channel, between 0 and 255
value of the alpha channel, between 0 and 255
This is a convenience function for creating a material with the first
layer set to @texture and setting that material as the source with
cogl_set_source.
Note: There is no interaction between calls to cogl_set_source_color
and cogl_set_source_texture. If you need to blend a texture with a color then
you can create a simple material like this:
<programlisting>
material = cogl_material_new ();
cogl_material_set_color4ub (material, 0xff, 0x00, 0x00, 0x80);
cogl_material_set_layer (material, 0, tex_handle);
cogl_set_source (material);
</programlisting>
Latest drawing apis all take an explicit
#CoglPipeline argument so this stack of
#CoglMaterial<!-- -->s shouldn't be used.
The #CoglTexture you want as your source
Replaces the current viewport with the given values.
Use cogl_framebuffer_set_viewport() instead
X offset of the viewport
Y offset of the viewport
Width of the viewport
Height of the viewport
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.
Use #CoglSnippet api
#CoglHandle for a shader.
Retrieves the information log for a coglobject, can be used in conjunction
with cogl_shader_get_parameteriv() to retrieve the compiler warnings/error
messages that caused a shader to not compile correctly, mainly useful for
debugging purposes.
Use #CoglSnippet api
a newly allocated string containing the info log. Use
g_free() to free it
#CoglHandle for a shader.
Retrieves the type of a shader #CoglHandle
Use #CoglSnippet api
%COGL_SHADER_TYPE_VERTEX if the shader is a vertex processor
or %COGL_SHADER_TYPE_FRAGMENT if the shader is a frament processor
#CoglHandle for a shader.
Retrieves whether a shader #CoglHandle has been compiled
Use #CoglSnippet api
%TRUE if the shader object has sucessfully be compiled
#CoglHandle for a shader.
Add an extra reference to a shader.
Use #CoglSnippet api
@handle
A #CoglHandle to a shader.
Replaces the current source associated with a shader with a new
one.
Please see <link
linkend="cogl-Shaders-and-Programmable-Pipeline.description">above</link>
for a description of the recommended format for the shader code.
Use #CoglSnippet api
#CoglHandle for a shader.
Shader source.
Removes a reference to a shader. If it was the last reference the
shader object will be destroyed.
Use #CoglSnippet api
A #CoglHandle to a shader.
Very fast fixed point implementation of square root for integers.
This function is at least 6x faster than clib sqrt() on x86, and (this is
not a typo!) about 500x faster on ARM without FPU. It's error is less than
5% for arguments smaller than %COGL_SQRTI_ARG_5_PERCENT and less than 10%
for narguments smaller than %COGL_SQRTI_ARG_10_PERCENT. The maximum
argument that can be passed to this function is %COGL_SQRTI_ARG_MAX.
integer square root.
integer value
Increment the reference count for a cogl texture.
Use cogl_object_ref() instead
the @texture pointer.
a #CoglTexture.
Decrement the reference count for a cogl texture.
Use cogl_object_unref() instead
a #CoglTexture.
Multiplies the current model-view matrix by the given matrix.
Use cogl_framebuffer_transform() instead
the matrix to multiply with the current model-view
Multiplies the current model-view matrix by one that translates the
model along all three axes according to the given values.
Use cogl_framebuffer_translate() instead
Distance to translate along the x-axis
Distance to translate along the y-axis
Distance to translate along the z-axis
Adds an attribute to a buffer, or replaces a previously added
attribute with the same name.
You either can use one of the built-in names such as "gl_Vertex", or
"gl_MultiTexCoord0" to add standard attributes, like positions, colors
and normals, or you can add custom attributes for use in shaders.
The number of vertices declared when calling cogl_vertex_buffer_new()
determines how many attribute values will be read from the supplied
@pointer.
The data for your attribute isn't copied anywhere until you call
cogl_vertex_buffer_submit(), or issue a draw call which automatically
submits pending attribute changes. so the supplied pointer must remain
valid until then. If you are updating an existing attribute (done by
re-adding it) then you still need to re-call cogl_vertex_buffer_submit()
to commit the changes to the GPU. Be carefull to minimize the number
of calls to cogl_vertex_buffer_submit(), though.
<note>If you are interleving attributes it is assumed that each interleaved
attribute starts no farther than +- stride bytes from the other attributes
it is interleved with. I.e. this is ok:
<programlisting>
|-0-0-0-0-0-0-0-0-0-0|
</programlisting>
This is not ok:
<programlisting>
|- - - - -0-0-0-0-0-0 0 0 0 0|
</programlisting>
(Though you can have multiple groups of interleved attributes)</note>
Use the #CoglPrimitive api instead
A vertex buffer handle
The name of your attribute. It should be a valid GLSL
variable name and standard attribute types must use one of following
built-in names: (Note: they correspond to the built-in names of GLSL)
<itemizedlist>
<listitem>"gl_Color"</listitem>
<listitem>"gl_Normal"</listitem>
<listitem>"gl_MultiTexCoord0, gl_MultiTexCoord1, ..."</listitem>
<listitem>"gl_Vertex"</listitem>
</itemizedlist>
To support adding multiple variations of the same attribute the name
can have a detail component, E.g. "gl_Color::active" or
"gl_Color::inactive"
The number of components per attribute and must be 1, 2,
3 or 4
a #CoglAttributeType specifying the data type of each component.
If %TRUE, this specifies that values stored in an integer
format should be mapped into the range [-1.0, 1.0] or [0.0, 1.0]
for unsigned values. If %FALSE they are converted to floats
directly.
This specifies the number of bytes from the start of one attribute
value to the start of the next value (for the same attribute). So, for
example, with a position interleved with color like this:
XYRGBAXYRGBAXYRGBA, then if each letter represents a byte, the
stride for both attributes is 6. The special value 0 means the
values are stored sequentially in memory.
This addresses the first attribute in the vertex array. This
must remain valid until you either call cogl_vertex_buffer_submit() or
issue a draw call.
Deletes an attribute from a buffer. You will need to call
cogl_vertex_buffer_submit() or issue a draw call to commit this
change to the GPU.
Use the #CoglPrimitive api instead
A vertex buffer handle
The name of a previously added attribute
Disables a previosuly added attribute.
Since it can be costly to add and remove new attributes to buffers; to make
individual buffers more reuseable it is possible to enable and disable
attributes before using a buffer for drawing.
You don't need to call cogl_vertex_buffer_submit() after using this
function.
Use the #CoglPrimitive api instead
A vertex buffer handle
The name of the attribute you want to disable
Allows you to draw geometry using all or a subset of the
vertices in a vertex buffer.
Any un-submitted attribute changes are automatically submitted before
drawing.
Use the #CoglPrimitive api instead
A vertex buffer handle
A #CoglVerticesMode specifying how the vertices should be
interpreted.
Specifies the index of the first vertex you want to draw with
Specifies the number of vertices you want to draw.
This function lets you use an array of indices to specify the vertices
within your vertex buffer that you want to draw. The indices themselves
are created by calling cogl_vertex_buffer_indices_new ()
Any un-submitted attribute changes are automatically submitted before
drawing.
Use the #CoglPrimitive api instead
A vertex buffer handle
A #CoglVerticesMode specifying how the vertices should be
interpreted.
A CoglHandle for a set of indices allocated via
cogl_vertex_buffer_indices_new ()
Specifies the minimum vertex index contained in indices
Specifies the maximum vertex index contained in indices
An offset into named indices. The offset marks the first
index to use for drawing.
Specifies the number of vertices you want to draw.
Enables a previosuly disabled attribute.
Since it can be costly to add and remove new attributes to buffers; to make
individual buffers more reuseable it is possible to enable and disable
attributes before using a buffer for drawing.
You don't need to call cogl_vertex_buffer_submit() after using this function
Use the #CoglPrimitive api instead
A vertex buffer handle
The name of the attribute you want to enable
Retrieves the number of vertices that @handle represents
Use the #CoglPrimitive api instead
the number of vertices
A vertex buffer handle
Creates a vertex buffer containing the indices needed to draw pairs
of triangles from a list of vertices grouped as quads. There will
be at least @n_indices entries in the buffer (but there may be
more).
The indices will follow this pattern:
0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7 ... etc
For example, if you submit vertices for a quad like like that shown
in <xref linkend="quad-indices-order"/> then you can request 6
indices to render two triangles like those shown in <xref
linkend="quad-indices-triangles"/>.
<figure id="quad-indices-order">
<title>Example of vertices submitted to form a quad</title>
<graphic fileref="quad-indices-order.png" format="PNG"/>
</figure>
<figure id="quad-indices-triangles">
<title>Illustration of the triangle indices that will be generated</title>
<graphic fileref="quad-indices-triangles.png" format="PNG"/>
</figure>
Use the #CoglPrimitive api instead
A %CoglHandle containing the indices. The handled is
owned by Cogl and should not be modified or unref'd.
the number of indices in the vertex buffer.
Queries back the data type used for the given indices
Use the #CoglPrimitive api instead
The CoglIndicesType used
An indices handle
Depending on how much geometry you are submitting it can be worthwhile
optimizing the number of redundant vertices you submit. Using an index
array allows you to reference vertices multiple times, for example
during triangle strips.
Use the #CoglPrimitive api instead
A CoglHandle for the indices which you can pass to
cogl_vertex_buffer_draw_elements().
a #CoglIndicesType specifying the data type used for
the indices.
Specifies the address of
your array of indices
The number of indices in indices_array
Creates a new vertex buffer that you can use to add attributes.
Use the #CoglPrimitive api instead
a new #CoglHandle
The number of vertices that your attributes will correspond to.
Increment the reference count for a vertex buffer
Use cogl_object_ref() instead
the @handle.
a @CoglHandle.
Submits all the user added attributes to the GPU; once submitted, the
attributes can be used for drawing.
You should aim to minimize calls to this function since it implies
validating your data; it potentially incurs a transport cost (especially if
you are using GLX indirect rendering) and potentially a format conversion
cost if the GPU doesn't natively support any of the given attribute formats.
Use the #CoglPrimitive api instead
A vertex buffer handle
Decrement the reference count for a vertex buffer
Use cogl_object_unref() instead
a @CoglHandle.
Replace the current viewport with the given values.
Use cogl_framebuffer_set_viewport instead
Width of the viewport
Height of the viewport