4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2007,2008,2009,2011 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 #if !defined(__COGL_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
25 #error "Only <cogl/cogl.h> can be included directly."
28 #ifndef __COGL_PIPELINE_STATE_H__
29 #define __COGL_PIPELINE_STATE_H__
31 #include <cogl/cogl-pipeline.h>
32 #include <cogl/cogl-color.h>
33 #include <cogl/cogl-depth-state.h>
38 #ifdef COGL_ENABLE_EXPERIMENTAL_API
41 * cogl_pipeline_set_color:
42 * @pipeline: A #CoglPipeline object
43 * @color: The components of the color
45 * Sets the basic color of the pipeline, used when no lighting is enabled.
47 * Note that if you don't add any layers to the pipeline then the color
48 * will be blended unmodified with the destination; the default blend
49 * expects premultiplied colors: for example, use (0.5, 0.0, 0.0, 0.5) for
50 * semi-transparent red. See cogl_color_premultiply().
52 * The default value is (1.0, 1.0, 1.0, 1.0)
58 cogl_pipeline_set_color (CoglPipeline *pipeline,
59 const CoglColor *color);
62 * cogl_pipeline_set_color4ub:
63 * @pipeline: A #CoglPipeline object
64 * @red: The red component
65 * @green: The green component
66 * @blue: The blue component
67 * @alpha: The alpha component
69 * Sets the basic color of the pipeline, used when no lighting is enabled.
71 * The default value is (0xff, 0xff, 0xff, 0xff)
77 cogl_pipeline_set_color4ub (CoglPipeline *pipeline,
84 * cogl_pipeline_set_color4f:
85 * @pipeline: A #CoglPipeline object
86 * @red: The red component
87 * @green: The green component
88 * @blue: The blue component
89 * @alpha: The alpha component
91 * Sets the basic color of the pipeline, used when no lighting is enabled.
93 * The default value is (1.0, 1.0, 1.0, 1.0)
99 cogl_pipeline_set_color4f (CoglPipeline *pipeline,
106 * cogl_pipeline_get_color:
107 * @pipeline: A #CoglPipeline object
108 * @color: (out): The location to store the color
110 * Retrieves the current pipeline color.
113 * Stability: Unstable
116 cogl_pipeline_get_color (CoglPipeline *pipeline,
120 * cogl_pipeline_set_ambient:
121 * @pipeline: A #CoglPipeline object
122 * @ambient: The components of the desired ambient color
124 * Sets the pipeline's ambient color, in the standard OpenGL lighting
125 * model. The ambient color affects the overall color of the object.
127 * Since the diffuse color will be intense when the light hits the surface
128 * directly, the ambient will be most apparent where the light hits at a
131 * The default value is (0.2, 0.2, 0.2, 1.0)
134 * Stability: Unstable
137 cogl_pipeline_set_ambient (CoglPipeline *pipeline,
138 const CoglColor *ambient);
141 * cogl_pipeline_get_ambient:
142 * @pipeline: A #CoglPipeline object
143 * @ambient: The location to store the ambient color
145 * Retrieves the current ambient color for @pipeline
148 * Stability: Unstable
151 cogl_pipeline_get_ambient (CoglPipeline *pipeline,
155 * cogl_pipeline_set_diffuse:
156 * @pipeline: A #CoglPipeline object
157 * @diffuse: The components of the desired diffuse color
159 * Sets the pipeline's diffuse color, in the standard OpenGL lighting
160 * model. The diffuse color is most intense where the light hits the
161 * surface directly - perpendicular to the surface.
163 * The default value is (0.8, 0.8, 0.8, 1.0)
166 * Stability: Unstable
169 cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
170 const CoglColor *diffuse);
173 * cogl_pipeline_get_diffuse:
174 * @pipeline: A #CoglPipeline object
175 * @diffuse: The location to store the diffuse color
177 * Retrieves the current diffuse color for @pipeline
180 * Stability: Unstable
183 cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
187 * cogl_pipeline_set_ambient_and_diffuse:
188 * @pipeline: A #CoglPipeline object
189 * @color: The components of the desired ambient and diffuse colors
191 * Conveniently sets the diffuse and ambient color of @pipeline at the same
192 * time. See cogl_pipeline_set_ambient() and cogl_pipeline_set_diffuse().
194 * The default ambient color is (0.2, 0.2, 0.2, 1.0)
196 * The default diffuse color is (0.8, 0.8, 0.8, 1.0)
199 * Stability: Unstable
202 cogl_pipeline_set_ambient_and_diffuse (CoglPipeline *pipeline,
203 const CoglColor *color);
206 * cogl_pipeline_set_specular:
207 * @pipeline: A #CoglPipeline object
208 * @specular: The components of the desired specular color
210 * Sets the pipeline's specular color, in the standard OpenGL lighting
211 * model. The intensity of the specular color depends on the viewport
212 * position, and is brightest along the lines of reflection.
214 * The default value is (0.0, 0.0, 0.0, 1.0)
217 * Stability: Unstable
220 cogl_pipeline_set_specular (CoglPipeline *pipeline,
221 const CoglColor *specular);
224 * cogl_pipeline_get_specular:
225 * @pipeline: A #CoglPipeline object
226 * @specular: The location to store the specular color
228 * Retrieves the pipelines current specular color.
231 * Stability: Unstable
234 cogl_pipeline_get_specular (CoglPipeline *pipeline,
235 CoglColor *specular);
238 * cogl_pipeline_set_shininess:
239 * @pipeline: A #CoglPipeline object
240 * @shininess: The desired shininess; must be >= 0.0
242 * Sets the shininess of the pipeline, in the standard OpenGL lighting
243 * model, which determines the size of the specular highlights. A
244 * higher @shininess will produce smaller highlights which makes the
245 * object appear more shiny.
247 * The default value is 0.0
250 * Stability: Unstable
253 cogl_pipeline_set_shininess (CoglPipeline *pipeline,
257 * cogl_pipeline_get_shininess:
258 * @pipeline: A #CoglPipeline object
260 * Retrieves the pipelines current emission color.
262 * Return value: The pipelines current shininess value
265 * Stability: Unstable
268 cogl_pipeline_get_shininess (CoglPipeline *pipeline);
271 * cogl_pipeline_set_emission:
272 * @pipeline: A #CoglPipeline object
273 * @emission: The components of the desired emissive color
275 * Sets the pipeline's emissive color, in the standard OpenGL lighting
276 * model. It will look like the surface is a light source emitting this
279 * The default value is (0.0, 0.0, 0.0, 1.0)
282 * Stability: Unstable
285 cogl_pipeline_set_emission (CoglPipeline *pipeline,
286 const CoglColor *emission);
289 * cogl_pipeline_get_emission:
290 * @pipeline: A #CoglPipeline object
291 * @emission: The location to store the emission color
293 * Retrieves the pipelines current emission color.
296 * Stability: Unstable
299 cogl_pipeline_get_emission (CoglPipeline *pipeline,
300 CoglColor *emission);
303 * CoglPipelineAlphaFunc:
304 * @COGL_PIPELINE_ALPHA_FUNC_NEVER: Never let the fragment through.
305 * @COGL_PIPELINE_ALPHA_FUNC_LESS: Let the fragment through if the incoming
306 * alpha value is less than the reference alpha value
307 * @COGL_PIPELINE_ALPHA_FUNC_EQUAL: Let the fragment through if the incoming
308 * alpha value equals the reference alpha value
309 * @COGL_PIPELINE_ALPHA_FUNC_LEQUAL: Let the fragment through if the incoming
310 * alpha value is less than or equal to the reference alpha value
311 * @COGL_PIPELINE_ALPHA_FUNC_GREATER: Let the fragment through if the incoming
312 * alpha value is greater than the reference alpha value
313 * @COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL: Let the fragment through if the incoming
314 * alpha value does not equal the reference alpha value
315 * @COGL_PIPELINE_ALPHA_FUNC_GEQUAL: Let the fragment through if the incoming
316 * alpha value is greater than or equal to the reference alpha value.
317 * @COGL_PIPELINE_ALPHA_FUNC_ALWAYS: Always let the fragment through.
319 * Alpha testing happens before blending primitives with the framebuffer and
320 * gives an opportunity to discard fragments based on a comparison with the
321 * incoming alpha value and a reference alpha value. The #CoglPipelineAlphaFunc
322 * determines how the comparison is done.
325 COGL_PIPELINE_ALPHA_FUNC_NEVER = 0x0200,
326 COGL_PIPELINE_ALPHA_FUNC_LESS = 0x0201,
327 COGL_PIPELINE_ALPHA_FUNC_EQUAL = 0x0202,
328 COGL_PIPELINE_ALPHA_FUNC_LEQUAL = 0x0203,
329 COGL_PIPELINE_ALPHA_FUNC_GREATER = 0x0204,
330 COGL_PIPELINE_ALPHA_FUNC_NOTEQUAL = 0x0205,
331 COGL_PIPELINE_ALPHA_FUNC_GEQUAL = 0x0206,
332 COGL_PIPELINE_ALPHA_FUNC_ALWAYS = 0x0207
333 } CoglPipelineAlphaFunc;
334 /* NB: these values come from the equivalents in gl.h */
337 * cogl_pipeline_set_alpha_test_function:
338 * @pipeline: A #CoglPipeline object
339 * @alpha_func: A @CoglPipelineAlphaFunc constant
340 * @alpha_reference: A reference point that the chosen alpha function uses
341 * to compare incoming fragments to.
343 * Before a primitive is blended with the framebuffer, it goes through an
344 * alpha test stage which lets you discard fragments based on the current
345 * alpha value. This function lets you change the function used to evaluate
346 * the alpha channel, and thus determine which fragments are discarded
347 * and which continue on to the blending stage.
349 * The default is %COGL_PIPELINE_ALPHA_FUNC_ALWAYS
352 * Stability: Unstable
355 cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
356 CoglPipelineAlphaFunc alpha_func,
357 float alpha_reference);
360 * cogl_pipeline_get_alpha_test_function:
361 * @pipeline: A #CoglPipeline object
363 * Return value: The alpha test function of @pipeline.
366 * Stability: Unstable
368 CoglPipelineAlphaFunc
369 cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline);
372 * cogl_pipeline_get_alpha_test_reference:
373 * @pipeline: A #CoglPipeline object
375 * Return value: The alpha test reference value of @pipeline.
378 * Stability: Unstable
381 cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline);
384 * cogl_pipeline_set_blend:
385 * @pipeline: A #CoglPipeline object
386 * @blend_string: A <link linkend="cogl-Blend-Strings">Cogl blend string</link>
387 * describing the desired blend function.
388 * @error: return location for a #GError that may report lack of driver
389 * support if you give separate blend string statements for the alpha
390 * channel and RGB channels since some drivers, or backends such as
391 * GLES 1.1, don't support this feature. May be %NULL, in which case a
392 * warning will be printed out using GLib's logging facilities if an
393 * error is encountered.
395 * If not already familiar; please refer <link linkend="cogl-Blend-Strings">here</link>
396 * for an overview of what blend strings are, and their syntax.
398 * Blending occurs after the alpha test function, and combines fragments with
401 * Currently the only blend function Cogl exposes is ADD(). So any valid
402 * blend statements will be of the form:
405 * <channel-mask>=ADD(SRC_COLOR*(<factor>), DST_COLOR*(<factor>))
408 * This is the list of source-names usable as blend factors:
410 * <listitem><para>SRC_COLOR: The color of the in comming fragment</para></listitem>
411 * <listitem><para>DST_COLOR: The color of the framebuffer</para></listitem>
412 * <listitem><para>CONSTANT: The constant set via cogl_pipeline_set_blend_constant()</para></listitem>
415 * The source names can be used according to the
416 * <link linkend="cogl-Blend-String-syntax">color-source and factor syntax</link>,
417 * so for example "(1-SRC_COLOR[A])" would be a valid factor, as would
420 * These can also be used as factors:
422 * <listitem>0: (0, 0, 0, 0)</listitem>
423 * <listitem>1: (1, 1, 1, 1)</listitem>
424 * <listitem>SRC_ALPHA_SATURATE_FACTOR: (f,f,f,1) where f = MIN(SRC_COLOR[A],1-DST_COLOR[A])</listitem>
427 * <note>Remember; all color components are normalized to the range [0, 1]
428 * before computing the result of blending.</note>
430 * <example id="cogl-Blend-Strings-blend-unpremul">
431 * <title>Blend Strings/1</title>
432 * <para>Blend a non-premultiplied source over a destination with
433 * premultiplied alpha:</para>
435 * "RGB = ADD(SRC_COLOR*(SRC_COLOR[A]), DST_COLOR*(1-SRC_COLOR[A]))"
436 * "A = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
440 * <example id="cogl-Blend-Strings-blend-premul">
441 * <title>Blend Strings/2</title>
442 * <para>Blend a premultiplied source over a destination with
443 * premultiplied alpha</para>
445 * "RGBA = ADD(SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))"
449 * The default blend string is:
451 * RGBA = ADD (SRC_COLOR, DST_COLOR*(1-SRC_COLOR[A]))
454 * That gives normal alpha-blending when the calculated color for the pipeline
455 * is in premultiplied form.
457 * Return value: %TRUE if the blend string was successfully parsed, and the
458 * described blending is supported by the underlying driver/hardware. If
459 * there was an error, %FALSE is returned and @error is set accordingly (if
463 * Stability: Unstable
466 cogl_pipeline_set_blend (CoglPipeline *pipeline,
467 const char *blend_string,
471 * cogl_pipeline_set_blend_constant:
472 * @pipeline: A #CoglPipeline object
473 * @constant_color: The constant color you want
475 * When blending is setup to reference a CONSTANT blend factor then
476 * blending will depend on the constant set with this function.
479 * Stability: Unstable
482 cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
483 const CoglColor *constant_color);
486 * cogl_pipeline_set_point_size:
487 * @pipeline: a #CoglPipeline pointer
488 * @point_size: the new point size.
490 * Changes the size of points drawn when %COGL_VERTICES_MODE_POINTS is
491 * used with the vertex buffer API. Note that typically the GPU will
492 * only support a limited minimum and maximum range of point sizes. If
493 * the chosen point size is outside that range then the nearest value
494 * within that range will be used instead. The size of a point is in
495 * screen space so it will be the same regardless of any
496 * transformations. The default point size is 1.0.
499 * Stability: Unstable
502 cogl_pipeline_set_point_size (CoglPipeline *pipeline,
506 * cogl_pipeline_get_point_size:
507 * @pipeline: a #CoglPipeline pointer
509 * Get the size of points drawn when %COGL_VERTICES_MODE_POINTS is
510 * used with the vertex buffer API.
512 * Return value: the point size of the @pipeline.
515 * Stability: Unstable
518 cogl_pipeline_get_point_size (CoglPipeline *pipeline);
521 * cogl_pipeline_get_color_mask:
522 * @pipeline: a #CoglPipeline object.
524 * Gets the current #CoglColorMask of which channels would be written to the
525 * current framebuffer. Each bit set in the mask means that the
526 * corresponding color would be written.
528 * Returns: A #CoglColorMask
530 * Stability: unstable
533 cogl_pipeline_get_color_mask (CoglPipeline *pipeline);
536 * cogl_pipeline_set_color_mask:
537 * @pipeline: a #CoglPipeline object.
538 * @color_mask: A #CoglColorMask of which color channels to write to
539 * the current framebuffer.
541 * Defines a bit mask of which color channels should be written to the
542 * current framebuffer. If a bit is set in @color_mask that means that
543 * color will be written.
546 * Stability: unstable
549 cogl_pipeline_set_color_mask (CoglPipeline *pipeline,
550 CoglColorMask color_mask);
553 * cogl_pipeline_get_user_program:
554 * @pipeline: a #CoglPipeline object.
556 * Queries what user program has been associated with the given
557 * @pipeline using cogl_pipeline_set_user_program().
559 * Return value: The current user program or %COGL_INVALID_HANDLE.
562 * Stability: Unstable
565 cogl_pipeline_get_user_program (CoglPipeline *pipeline);
568 * cogl_pipeline_set_user_program:
569 * @pipeline: a #CoglPipeline object.
570 * @program: A #CoglHandle to a linked CoglProgram
572 * Associates a linked CoglProgram with the given pipeline so that the
573 * program can take full control of vertex and/or fragment processing.
575 * This is an example of how it can be used to associate an ARBfp
576 * program with a #CoglPipeline:
579 * CoglHandle program;
580 * CoglPipeline *pipeline;
582 * shader = cogl_create_shader (COGL_SHADER_TYPE_FRAGMENT);
583 * cogl_shader_source (shader,
585 * "MOV result.color,fragment.color;\n"
587 * cogl_shader_compile (shader);
589 * program = cogl_create_program ();
590 * cogl_program_attach_shader (program, shader);
591 * cogl_program_link (program);
593 * pipeline = cogl_pipeline_new ();
594 * cogl_pipeline_set_user_program (pipeline, program);
596 * cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
597 * cogl_rectangle (0, 0, 100, 100);
600 * It is possibly worth keeping in mind that this API is not part of
601 * the long term design for how we want to expose shaders to Cogl
602 * developers (We are planning on deprecating the cogl_program and
603 * cogl_shader APIs in favour of a "snippet" framework) but in the
604 * meantime we hope this will handle most practical GLSL and ARBfp
607 * Also remember you need to check for either the
608 * %COGL_FEATURE_SHADERS_GLSL or %COGL_FEATURE_SHADERS_ARBFP before
609 * using the cogl_program or cogl_shader API.
612 * Stability: Unstable
615 cogl_pipeline_set_user_program (CoglPipeline *pipeline,
619 * cogl_pipeline_set_depth_state:
620 * @pipeline: A #CoglPipeline object
621 * @state: A #CoglDepthState struct
622 * @error: A #GError to report failures to setup the given @state.
624 * This commits all the depth state configured in @state struct to the
625 * given @pipeline. The configuration values are copied into the
626 * pipeline so there is no requirement to keep the #CoglDepthState
627 * struct around if you don't need it any more.
629 * Note: Since some platforms do not support the depth range feature
630 * it is possible for this function to fail and report an @error.
632 * Returns: TRUE if the GPU supports all the given @state else %FALSE
633 * and returns an @error.
636 * Stability: Unstable
639 cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
640 const CoglDepthState *state,
644 * cogl_pipeline_get_depth_state
645 * @pipeline: A #CoglPipeline object
646 * @state: A destination #CoglDepthState struct
648 * Retrieves the current depth state configuration for the given
649 * @pipeline as previously set using cogl_pipeline_set_depth_state().
652 * Stability: Unstable
655 cogl_pipeline_get_depth_state (CoglPipeline *pipeline,
656 CoglDepthState *state_out);
659 * CoglPipelineCullFaceMode:
660 * @COGL_PIPELINE_CULL_FACE_MODE_NONE: Neither face will be
661 * culled. This is the default.
662 * @COGL_PIPELINE_CULL_FACE_MODE_FRONT: Front faces will be culled.
663 * @COGL_PIPELINE_CULL_FACE_MODE_BACK: Back faces will be culled.
664 * @COGL_PIPELINE_CULL_FACE_MODE_BOTH: All faces will be culled.
666 * Specifies which faces should be culled. This can be set on a
667 * pipeline using cogl_pipeline_set_cull_face_mode().
671 COGL_PIPELINE_CULL_FACE_MODE_NONE,
672 COGL_PIPELINE_CULL_FACE_MODE_FRONT,
673 COGL_PIPELINE_CULL_FACE_MODE_BACK,
674 COGL_PIPELINE_CULL_FACE_MODE_BOTH
675 } CoglPipelineCullFaceMode;
678 * cogl_pipeline_set_cull_face_mode:
679 * @pipeline: A #CoglPipeline
680 * @cull_face_mode: The new mode to set
682 * Sets which faces will be culled when drawing. Face culling can be
683 * used to increase efficiency by avoiding drawing faces that would
684 * get overridden. For example, if a model has gaps so that it is
685 * impossible to see the inside then faces which are facing away from
686 * the screen will never be seen so there is no point in drawing
687 * them. This can be acheived by setting the cull face mode to
688 * %COGL_PIPELINE_CULL_FACE_MODE_BACK.
690 * Face culling relies on the primitives being drawn with a specific
691 * order to represent which faces are facing inside and outside the
692 * model. This order can be specified by calling
693 * cogl_pipeline_set_front_face_winding().
699 cogl_pipeline_set_cull_face_mode (CoglPipeline *pipeline,
700 CoglPipelineCullFaceMode cull_face_mode);
703 * cogl_pipeline_get_cull_face_mode:
705 * Return value: the cull face mode that was previously set with
706 * cogl_pipeline_set_cull_face_mode().
711 CoglPipelineCullFaceMode
712 cogl_pipeline_get_cull_face_mode (CoglPipeline *pipeline);
715 * cogl_pipeline_set_front_face_winding:
717 * The order of the vertices within a primitive specifies whether it
718 * is considered to be front or back facing. This function specifies
719 * which order is considered to be the front
720 * faces. %COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to
721 * primitives with vertices in a counter-clockwise order and
722 * %COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is
723 * %COGL_WINDING_COUNTER_CLOCKWISE.
729 cogl_pipeline_set_front_face_winding (CoglPipeline *pipeline,
730 CoglWinding front_winding);
733 * cogl_pipeline_set_front_face_winding:
735 * The order of the vertices within a primitive specifies whether it
736 * is considered to be front or back facing. This function specifies
737 * which order is considered to be the front
738 * faces. %COGL_WINDING_COUNTER_CLOCKWISE sets the front faces to
739 * primitives with vertices in a counter-clockwise order and
740 * %COGL_WINDING_CLOCKWISE sets them to be clockwise. The default is
741 * %COGL_WINDING_COUNTER_CLOCKWISE.
747 cogl_pipeline_get_front_face_winding (CoglPipeline *pipeline);
750 * cogl_pipeline_set_uniform_1f:
751 * @pipeline: A #CoglPipeline object
752 * @uniform_location: The uniform's location identifier
753 * @value: The new value for the uniform
755 * Sets a new value for the uniform at @uniform_location. If this
756 * pipeline has a user program attached and is later used as a source
757 * for drawing, the given value will be assigned to the uniform which
758 * can be accessed from the shader's source. The value for
759 * @uniform_location should be retrieved from the string name of the
760 * uniform by calling cogl_pipeline_get_uniform_location().
762 * This function should be used to set uniforms that are of type
763 * float. It can also be used to set a single member of a float array
767 * Stability: Unstable
770 cogl_pipeline_set_uniform_1f (CoglPipeline *pipeline,
771 int uniform_location,
775 * cogl_pipeline_set_uniform_1i:
776 * @pipeline: A #CoglPipeline object
777 * @uniform_location: The uniform's location identifier
778 * @value: The new value for the uniform
780 * Sets a new value for the uniform at @uniform_location. If this
781 * pipeline has a user program attached and is later used as a source
782 * for drawing, the given value will be assigned to the uniform which
783 * can be accessed from the shader's source. The value for
784 * @uniform_location should be retrieved from the string name of the
785 * uniform by calling cogl_pipeline_get_uniform_location().
787 * This function should be used to set uniforms that are of type
788 * int. It can also be used to set a single member of a int array
789 * uniform or a sampler uniform.
792 * Stability: Unstable
795 cogl_pipeline_set_uniform_1i (CoglPipeline *pipeline,
796 int uniform_location,
800 * cogl_pipeline_set_uniform_float:
801 * @pipeline: A #CoglPipeline object
802 * @uniform_location: The uniform's location identifier
803 * @n_components: The number of components in the corresponding uniform's type
804 * @count: The number of values to set
805 * @value: Pointer to the new values to set
807 * Sets new values for the uniform at @uniform_location. If this
808 * pipeline has a user program attached and is later used as a source
809 * for drawing, the given values will be assigned to the uniform which
810 * can be accessed from the shader's source. The value for
811 * @uniform_location should be retrieved from the string name of the
812 * uniform by calling cogl_pipeline_get_uniform_location().
814 * This function can be used to set any floating point type uniform,
815 * including float arrays and float vectors. For example, to set a
816 * single vec4 uniform you would use 4 for @n_components and 1 for
817 * @count. To set an array of 8 float values, you could use 1 for
818 * @n_components and 8 for @count.
821 * Stability: Unstable
824 cogl_pipeline_set_uniform_float (CoglPipeline *pipeline,
825 int uniform_location,
831 * cogl_pipeline_set_uniform_int:
832 * @pipeline: A #CoglPipeline object
833 * @uniform_location: The uniform's location identifier
834 * @n_components: The number of components in the corresponding uniform's type
835 * @count: The number of values to set
836 * @value: Pointer to the new values to set
838 * Sets new values for the uniform at @uniform_location. If this
839 * pipeline has a user program attached and is later used as a source
840 * for drawing, the given values will be assigned to the uniform which
841 * can be accessed from the shader's source. The value for
842 * @uniform_location should be retrieved from the string name of the
843 * uniform by calling cogl_pipeline_get_uniform_location().
845 * This function can be used to set any integer type uniform,
846 * including int arrays and int vectors. For example, to set a single
847 * ivec4 uniform you would use 4 for @n_components and 1 for
848 * @count. To set an array of 8 int values, you could use 1 for
849 * @n_components and 8 for @count.
852 * Stability: Unstable
855 cogl_pipeline_set_uniform_int (CoglPipeline *pipeline,
856 int uniform_location,
862 * cogl_pipeline_set_uniform_matrix:
863 * @pipeline: A #CoglPipeline object
864 * @uniform_location: The uniform's location identifier
865 * @dimensions: The size of the matrix
866 * @count: The number of values to set
867 * @transpose: Whether to transpose the matrix
868 * @value: Pointer to the new values to set
870 * Sets new values for the uniform at @uniform_location. If this
871 * pipeline has a user program attached and is later used as a source
872 * for drawing, the given values will be assigned to the uniform which
873 * can be accessed from the shader's source. The value for
874 * @uniform_location should be retrieved from the string name of the
875 * uniform by calling cogl_pipeline_get_uniform_location().
877 * This function can be used to set any matrix type uniform, including
878 * matrix arrays. For example, to set a single mat4 uniform you would
879 * use 4 for @dimensions and 1 for @count. To set an array of 8
880 * mat3 values, you could use 3 for @dimensions and 8 for @count.
882 * If @transpose is %FALSE then the matrix is expected to be in
883 * column-major order or if it is %TRUE then the matrix is in
884 * row-major order. You can pass a #CoglMatrix by calling by passing
885 * the result of cogl_matrix_get_array() in @value and setting
886 * @transpose to %FALSE.
889 * Stability: Unstable
892 cogl_pipeline_set_uniform_matrix (CoglPipeline *pipeline,
893 int uniform_location,
900 * cogl_pipeline_add_snippet:
901 * @pipeline: A #CoglPipeline
902 * @snippet: The #CoglSnippet to add to the vertex processing hook
904 * Adds a shader snippet to @pipeline. The snippet will wrap around or
905 * replace some part of the pipeline as defined by the hook point in
906 * @snippet. Note that some hook points are specific to a layer and
907 * must be added with cogl_pipeline_add_layer_snippet() instead.
910 * Stability: Unstable
913 cogl_pipeline_add_snippet (CoglPipeline *pipeline,
914 CoglSnippet *snippet);
916 #endif /* COGL_ENABLE_EXPERIMENTAL_API */
920 #endif /* __COGL_PIPELINE_STATE_H__ */