Class
CoglPipeline
Description [src]
final class Cogl.Pipeline : GObject.Object
{
/* No available fields */
}
Functions for creating and manipulating the GPU pipeline
Cogl allows creating and manipulating objects representing the full configuration of the GPU pipeline. In simplified terms the GPU pipeline takes primitive geometry as the input, it first performs vertex processing, allowing you to deform your geometry, then rasterizes that (turning it from pure geometry into fragments) then performs fragment processing including depth testing and texture mapping. Finally it blends the result with the framebuffer.
Constructors
cogl_pipeline_new
Allocates and initializes a default simple pipeline that will color a primitive white.
Instance methods
cogl_pipeline_add_layer_snippet
Adds a shader snippet that will hook on to the given layer of the
pipeline. The exact part of the pipeline that the snippet wraps
around depends on the hook that is given to
cogl_snippet_new(). Note that some hooks can’t be used with a layer
and need to be added with cogl_pipeline_add_snippet()
instead.
cogl_pipeline_add_snippet
Adds a shader snippet to pipeline
. The snippet will wrap around or
replace some part of the pipeline as defined by the hook point in
snippet
. Note that some hook points are specific to a layer and
must be added with cogl_pipeline_add_layer_snippet()
instead.
cogl_pipeline_get_depth_state
Retrieves the current depth state configuration for the given
pipeline
as previously set using cogl_pipeline_set_depth_state().
cogl_pipeline_get_front_face_winding
The order of the vertices within a primitive specifies whether it
is considered to be front or back facing. This function specifies
which order is considered to be the front
faces. COGL_WINDING_COUNTER_CLOCKWISE
sets the front faces to
primitives with vertices in a counter-clockwise order and
COGL_WINDING_CLOCKWISE
sets them to be clockwise. The default is
COGL_WINDING_COUNTER_CLOCKWISE
.
cogl_pipeline_get_layer_filters
Returns the decimation and interpolation filters used when a texture is drawn at other scales than 100%.
cogl_pipeline_get_layer_point_sprite_coords_enabled
Gets whether point sprite coordinate generation is enabled for this texture layer.
cogl_pipeline_get_layer_wrap_mode_s
Returns the wrap mode for the ‘s’ coordinate of texture lookups on this layer.
cogl_pipeline_get_layer_wrap_mode_t
Returns the wrap mode for the ‘t’ coordinate of texture lookups on this layer.
cogl_pipeline_get_point_size
Get the size of points drawn when COGL_VERTICES_MODE_POINTS
is
used with the vertex buffer API.
cogl_pipeline_get_uniform_location
This is used to get an integer representing the uniform with the
name uniform_name
. The integer can be passed to functions such as
cogl_pipeline_set_uniform_1f()
to set the value of a uniform.
cogl_pipeline_get_user_program
Queries what user program has been associated with the given
pipeline
using cogl_pipeline_set_user_program().
cogl_pipeline_set_alpha_test_function
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.
cogl_pipeline_set_blend
Blending occurs after the alpha test function, and combines fragments with the framebuffer.
cogl_pipeline_set_blend_constant
When blending is setup to reference a CONSTANT blend factor then blending will depend on the constant set with this function.
cogl_pipeline_set_cull_face_mode
Sets which faces will be culled when drawing. Face culling can be
used to increase efficiency by avoiding drawing faces that would
get overridden. For example, if a model has gaps so that it is
impossible to see the inside then faces which are facing away from
the screen will never be seen so there is no point in drawing
them. This can be achieved by setting the cull face mode to
COGL_PIPELINE_CULL_FACE_MODE_BACK
.
cogl_pipeline_set_depth_state
This commits all the depth state configured in state
struct to the
given pipeline
. The configuration values are copied into the
pipeline so there is no requirement to keep the CoglDepthState
struct around if you don’t need it any more.
cogl_pipeline_set_front_face_winding
The order of the vertices within a primitive specifies whether it
is considered to be front or back facing. This function specifies
which order is considered to be the front
faces. COGL_WINDING_COUNTER_CLOCKWISE
sets the front faces to
primitives with vertices in a counter-clockwise order and
COGL_WINDING_CLOCKWISE
sets them to be clockwise. The default is
COGL_WINDING_COUNTER_CLOCKWISE
.
cogl_pipeline_set_layer_combine_constant
When you are using the ‘CONSTANT’ color source in a layer combine description then you can use this function to define its value.
cogl_pipeline_set_layer_filters
Changes the decimation and interpolation filters used when a texture is drawn at other scales than 100%.
cogl_pipeline_set_layer_matrix
This function lets you set a matrix that can be used to e.g. translate and rotate a single layer of a pipeline used to fill your geometry.
cogl_pipeline_set_layer_null_texture
Sets the texture for this layer to be the default texture for the given type. The default texture is a 1x1 pixel white texture.
cogl_pipeline_set_layer_point_sprite_coords_enabled
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.
cogl_pipeline_set_layer_wrap_mode
Sets the wrap mode for all three coordinates of texture lookups on
this layer. This is equivalent to calling
cogl_pipeline_set_layer_wrap_mode_s()
and
cogl_pipeline_set_layer_wrap_mode_t()
separately.
cogl_pipeline_set_layer_wrap_mode_s
Sets the wrap mode for the ‘s’ coordinate of texture lookups on this layer.
cogl_pipeline_set_layer_wrap_mode_t
Sets the wrap mode for the ‘t’ coordinate of texture lookups on this layer.
cogl_pipeline_set_per_vertex_point_size
Sets whether to use a per-vertex point size or to use the value set
by cogl_pipeline_set_point_size(). If per-vertex point size is
enabled then the point size can be set for an individual point
either by drawing with a CoglAttribute
with the name
‘cogl_point_size_in’ or by writing to the GLSL builtin
‘cogl_point_size_out’ from a vertex shader snippet.
cogl_pipeline_set_point_size
Changes the size of points drawn when COGL_VERTICES_MODE_POINTS
is
used with the attribute 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.
cogl_pipeline_set_static_name
Set a pipeline name. It may be used for debugging or logging purposes. The string must be a static string, and string. It will not be copied.
cogl_pipeline_set_uniform_1f
Sets a new value for the uniform at uniform_location
. If this
pipeline has a user program attached and is later used as a source
for drawing, the given value will be assigned to the uniform which
can be accessed from the shader’s source. The value for
uniform_location
should be retrieved from the string name of the
uniform by calling cogl_pipeline_get_uniform_location().
cogl_pipeline_set_uniform_1i
Sets a new value for the uniform at uniform_location
. If this
pipeline has a user program attached and is later used as a source
for drawing, the given value will be assigned to the uniform which
can be accessed from the shader’s source. The value for
uniform_location
should be retrieved from the string name of the
uniform by calling cogl_pipeline_get_uniform_location().
cogl_pipeline_set_uniform_float
Sets new values for the uniform at uniform_location
. If this
pipeline has a user program attached and is later used as a source
for drawing, the given values will be assigned to the uniform which
can be accessed from the shader’s source. The value for
uniform_location
should be retrieved from the string name of the
uniform by calling cogl_pipeline_get_uniform_location().
cogl_pipeline_set_uniform_int
Sets new values for the uniform at uniform_location
. If this
pipeline has a user program attached and is later used as a source
for drawing, the given values will be assigned to the uniform which
can be accessed from the shader’s source. The value for
uniform_location
should be retrieved from the string name of the
uniform by calling cogl_pipeline_get_uniform_location().
cogl_pipeline_set_uniform_matrix
Sets new values for the uniform at uniform_location
. If this
pipeline has a user program attached and is later used as a source
for drawing, the given values will be assigned to the uniform which
can be accessed from the shader’s source. The value for
uniform_location
should be retrieved from the string name of the
uniform by calling cogl_pipeline_get_uniform_location().
cogl_pipeline_set_user_program
Associates a linked CoglProgram with the given pipeline so that the program can take full control of vertex and/or fragment processing.
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.