Gets whether point sprite coordinate generation is enabled for this texture layer.
the layer number to check.
Returns the wrap mode for the 'p' coordinate of texture lookups on this layer.
the layer number to change.
Returns the wrap mode for the 's' coordinate of texture lookups on this layer.
the layer number to change.
Returns the wrap mode for the 't' coordinate of texture lookups on this layer.
the layer number to change.
This function lets you access a material's internal list of layers for iteration.
Retrieves the number of layers defined for the given material
Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is used with the vertex buffer API.
Retrieves the materials current emission color.
Queries what user program has been associated with the given
material
using cogl_material_set_user_program().
This function removes a layer from your material
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
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)
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)
If not already familiar; please refer here 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.
A Cogl blend string describing the desired blend function.
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)
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)
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)
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)
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.
the index of the layer
a #CoglHandle for the layer object
If not already familiar; you can refer
here for an overview of what blend strings are and there syntax.These are all the functions available for texture combining:
Refer to the
color-source syntax for describing the arguments. The valid source names for texture combining are:Specifies the layer you want define a combine function for
A Cogl blend string describing the desired texture combine function.
Changes the decimation and interpolation filters used when a texture is drawn at other scales than 100%.
the layer number to change.
the filter used when scaling a texture down.
the filter used when magnifying a texture.
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
.
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.
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.
the layer number to change.
the new wrap mode
Sets the wrap mode for the 's' coordinate of texture lookups on this layer.
the layer number to change.
the new wrap mode
Sets the wrap mode for the 't' coordinate of texture lookups on this layer.
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.
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
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)
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.
@param program A #CoglHandle to a linked CoglProgram
Increment the reference count for a #CoglMaterial.
a #CoglMaterial object.
Decrement the reference count for a #CoglMaterial.
a #CoglMaterial object.
Retrieves the current ambient color for
material