1
0
Fork 0
mutter-performance-source/cogl.h.in

537 lines
18 KiB
C
Raw Normal View History

/*
* Clutter COGL
*
* A basic GL/GLES Abstraction/Utility Layer
*
* Authored By Matthew Allum <mallum@openedhand.com>
*
* Copyright (C) 2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __COGL_H__
#define __COGL_H__
#define __COGL_H_INSIDE__
#include <glib.h>
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
Fully integrates CoglMaterial throughout the rest of Cogl This glues CoglMaterial in as the fundamental way that Cogl describes how to fill in geometry. It adds cogl_set_source (), which is used to set the material which will be used by all subsequent drawing functions It adds cogl_set_source_texture as a convenience for setting up a default material with a single texture layer, and cogl_set_source_color is now also a convenience for setting up a material with a solid fill. "drawing functions" include, cogl_rectangle, cogl_texture_rectangle, cogl_texture_multiple_rectangles, cogl_texture_polygon (though the cogl_texture_* funcs have been renamed; see below for details), cogl_path_fill/stroke and cogl_vertex_buffer_draw*. cogl_texture_rectangle, cogl_texture_multiple_rectangles and cogl_texture_polygon no longer take a texture handle; instead the current source material is referenced. The functions have also been renamed to: cogl_rectangle_with_texture_coords, cogl_rectangles_with_texture_coords and cogl_polygon respectivly. Most code that previously did: cogl_texture_rectangle (tex_handle, x, y,...); needs to be changed to now do: cogl_set_source_texture (tex_handle); cogl_rectangle_with_texture_coords (x, y,....); In the less likely case where you were blending your source texture with a color like: cogl_set_source_color4ub (r,g,b,a); /* where r,g,b,a isn't just white */ cogl_texture_rectangle (tex_handle, x, y,...); you will need your own material to do that: mat = cogl_material_new (); cogl_material_set_color4ub (r,g,b,a); cogl_material_set_layer (mat, 0, tex_handle)); cogl_set_source_material (mat); Code that uses the texture coordinates, 0, 0, 1, 1 don't need to use cog_rectangle_with_texure_coords since these are the coordinates that cogl_rectangle will use. For cogl_texture_polygon; as well as dropping the texture handle, the n_vertices and vertices arguments were transposed for consistency. So code previously written as: cogl_texture_polygon (tex_handle, 3, verts, TRUE); need to be written as: cogl_set_source_texture (tex_handle); cogl_polygon (verts, 3, TRUE); All of the unit tests have been updated to now use the material API and test-cogl-material has been renamed to test-cogl-multitexture since any textured quad is now technically a test of CoglMaterial but this test specifically creates a material with multiple texture layers. Note: The GLES backend has not been updated yet; that will be done in a following commit.
2009-01-23 16:15:40 +00:00
#include <cogl/cogl-vertex-buffer.h>
#include <cogl/cogl-matrix.h>
#include <cogl/cogl-vertex-buffer.h>
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com> Bug 1209 - Move fixed point API in COGL * clutter/cogl/cogl-fixed.h: * clutter/cogl/cogl.h.in: * clutter/cogl/common/Makefile.am: * clutter/cogl/common/cogl-fixed.c: Add fixed point API, modelled after the ClutterFixed. The CoglFixed API supercedes the ClutterFixed one and avoids the dependency of COGL on Clutter's own API. * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: Update internal usage of ClutterFixed to CoglFixed. * clutter/cogl/gl/Makefile.am: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gl/cogl.c: Ditto, in the GL implementation of the COGL API. * clutter/cogl/gles/Makefile.am: * clutter/cogl/gles/cogl-fbo.c: * clutter/cogl/gles/cogl-gles2-wrapper.c: * clutter/cogl/gles/cogl-primitives.c: * clutter/cogl/gles/cogl-texture.c: * clutter/cogl/gles/cogl.c: Ditto, in the GLES implementation of the COGL API. * clutter/pango/pangoclutter-glyph-cache.c: * clutter/pango/pangoclutter-glyph-cache.h: Ditto, in the Pango renderer glyphs cache. * clutter/clutter-fixed.c: * clutter/clutter-fixed.h: ClutterFixed and related API becomes a simple transition API for bindings and public Clutter API. * clutter/clutter-actor.c: * clutter/clutter-alpha.c: * clutter/clutter-backend.c: * clutter/clutter-behaviour-depth.c: * clutter/clutter-behaviour-ellipse.c: * clutter/clutter-behaviour-path.c: * clutter/clutter-behaviour-rotate.c: * clutter/clutter-behaviour-scale.c: * clutter/clutter-clone-texture.c: * clutter/clutter-color.c: * clutter/clutter-entry.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: * clutter/clutter-timeline.c: * clutter/clutter-units.h: Move from the internal usage of ClutterFixed to CoglFixed. * doc/reference/clutter/clutter-sections.txt: * doc/reference/cogl/cogl-docs.sgml: * doc/reference/cogl/cogl-sections.txt: Update the documentation. * tests/test-cogl-tex-tile.c: * tests/test-project.c: Fix tests after the API change * README: Add release notes.
2008-10-30 16:37:55 +00:00
#include <cogl/cogl-fixed.h>
#include <cogl/cogl-color.h>
#include <cogl/cogl-offscreen.h>
#include <cogl/cogl-material.h>
#include <cogl/cogl-path.h>
#include <cogl/cogl-shader.h>
#include <cogl/cogl-texture.h>
#include <cogl/cogl-types.h>
2008-11-12 Emmanuele Bassi <ebassi@linux.intel.com> * clutter/cogl/cogl-color.h: * clutter/cogl/cogl-path.h: * clutter/cogl/cogl-types.h: * clutter/cogl/common/cogl-color.c: Deprecated cogl_color() in favour of cogl_set_source_color() and friends; store the CoglColor components as unsigned bytes instead of fixed point normalized values; add functions for allocating, copying and freeing CoglColor, for use of language bindings. * clutter/cogl/cogl.h.in: * clutter/cogl/cogl-deprecated.h: Added cogl-deprecated.h, an header file containing the deprecation symbols similar to clutter-deprecated.h. * clutter/cogl/gl/Makefile.am: * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/Makefile.am: * clutter/cogl/gles/cogl-texture.c: * clutter/cogl/gles/cogl.c: Update the GL and GLES implementations of COGL after the CoglColor changes. * clutter/clutter-actor.c: * clutter/clutter-clone-texture.c: * clutter/clutter-entry.c: * clutter/clutter-label.c: * clutter/clutter-rectangle.c: * clutter/clutter-texture.c: Do not use CoglColor whenever it is possible, and use cogl_set_source_color4ub() instead. * clutter/pango/cogl-pango-render.c: Ditto as above. * doc/reference/clutter/subclassing-ClutterActor.xml: * doc/reference/cogl/cogl-sections.txt: Update the documentation. * tests/interactive/test-cogl-offscreen.c: * tests/interactive/test-cogl-primitives.c: * tests/interactive/test-cogl-tex-convert.c: * tests/interactive/test-cogl-tex-foreign.c: * tests/interactive/test-cogl-tex-getset.c: * tests/interactive/test-cogl-tex-polygon.c: * tests/interactive/test-cogl-tex-tile.c: * tests/interactive/test-paint-wrapper.c: Drop the usage of CoglColor whenever it is possible.
2008-11-12 13:57:58 +00:00
#include <cogl/cogl-deprecated.h>
G_BEGIN_DECLS
/**
* SECTION:cogl
* @short_description: General purpose API
*
* General utility functions for COGL.
*/
/* Context manipulation */
/**
* cogl_create_context:
*
* FIXME
*/
2008-04-28 15:36:11 +00:00
gboolean cogl_create_context (void);
/**
* cogl_destroy_context:
*
* FIXME
*/
2008-04-28 15:36:11 +00:00
void cogl_destroy_context (void);
/* Misc */
/**
* cogl_get_features:
*
* Returns all of the features supported by COGL.
*
* Return value: A logical OR of all the supported COGL features.
*
* Since: 0.8
*/
CoglFeatureFlags cogl_get_features (void);
/**
* cogl_features_available:
* @features: A bitmask of features to check for
*
* 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.
*
* Return value: %TRUE if the features are available, %FALSE otherwise.
*/
2008-04-28 15:36:11 +00:00
gboolean cogl_features_available (CoglFeatureFlags features);
/**
* cogl_get_proc_address:
* @name: the name of the function.
*
* 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.
*
* Return value: a pointer to the requested function or %NULL if the
* function is not available.
*/
2008-04-28 15:36:11 +00:00
CoglFuncPtr cogl_get_proc_address (const gchar *name);
/**
* cogl_check_extension:
* @name: extension to check for
* @ext: list of extensions
*
* Check whether @name occurs in list of extensions in @ext.
*
* Returns: %TRUE if the extension occurs in the list, %FALSE otherwize.
*/
2008-04-28 15:36:11 +00:00
gboolean cogl_check_extension (const gchar *name,
const gchar *ext);
/**
* cogl_get_bitmasks:
* @red: Return location for the number of red bits or %NULL
* @green: Return location for the number of green bits or %NULL
* @blue: Return location for the number of blue bits or %NULL
* @alpha: Return location for the number of alpha bits or %NULL
*
* 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.
*/
2008-04-28 15:36:11 +00:00
void cogl_get_bitmasks (gint *red,
gint *green,
gint *blue,
gint *alpha);
/**
* cogl_perspective:
* @fovy: Vertical of view angle in degrees.
* @aspect: Aspect ratio of diesplay
2008-04-28 15:36:11 +00:00
* @z_near: Nearest visible point
* @z_far: Furthest visible point along the z-axis
*
* Replaces the current projection matrix with a perspective matrix
* based on the provided values.
*/
void cogl_perspective (float fovy,
float aspect,
float z_near,
float z_far);
/**
* cogl_frustum:
* @left: Left clipping plane
* @right: Right clipping plane
* @bottom: Bottom clipping plane
* @top: Top clipping plane
* @z_near: Nearest visible point
* @z_far: Furthest visible point along the z-axis
*
* Replaces the current projection matrix with a perspective matrix
* for the given viewing frustum.
*
* Since: 0.8.2
*/
void cogl_frustum (float left,
float right,
float bottom,
float top,
float z_near,
float z_far);
/**
* cogl_setup_viewport:
* @width: Width of the viewport
* @height: Height of the viewport
* @fovy: Field of view angle in degrees
* @aspect: Aspect ratio to determine the field of view along the x-axis
* @z_near: Nearest visible point along the z-axis
* @z_far: Furthest visible point along the z-axis
*
* Replaces the current viewport and projection matrix with the given
* values. The viewport is placed at the top left corner of the window
* with the given width and height. The projection matrix is replaced
* with one that has a viewing angle of @fovy along the y-axis and a
* view scaled according to @aspect along the x-axis. The view is
* clipped according to @z_near and @z_far on the z-axis.
*/
2008-04-28 15:36:11 +00:00
void cogl_setup_viewport (guint width,
guint height,
float fovy,
float aspect,
float z_near,
float z_far);
/**
* cogl_viewport:
* @width: Width of the viewport
* @height: Height of the viewport
*
* Replace the current viewport with the given values.
*
* Since: 0.8.2
*/
void cogl_viewport (guint width,
guint height);
/**
* cogl_push_matrix:
*
* Store the current model-view matrix on the matrix stack. The matrix
* can later be restored with cogl_pop_matrix().
*/
2008-04-28 15:36:11 +00:00
void cogl_push_matrix (void);
/**
* cogl_pop_matrix:
*
* Restore the current model-view matrix from the matrix stack.
*/
2008-04-28 15:36:11 +00:00
void cogl_pop_matrix (void);
/**
* cogl_scale:
* @x: Amount to scale along the x-axis
* @y: Amount to scale along the y-axis
* @z: Amount to scale along the z-axis
*
* Multiplies the current model-view matrix by one that scales the x,
* y and z axes by the given values.
*/
void cogl_scale (float x,
float y,
float z);
/**
* cogl_translate:
* @x: Distance to translate along the x-axis
* @y: Distance to translate along the y-axis
* @z: Distance to translate along the z-axis
*
* Multiplies the current model-view matrix by one that translates the
* model along all three axes according to the given values.
*/
void cogl_translate (float x,
float y,
float z);
/**
* cogl_rotate:
* @angle: Angle in degrees to rotate.
* @x: X-component of vertex to rotate around.
* @y: Y-component of vertex to rotate around.
* @z: Z-component of vertex to rotate around.
*
* 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.
*/
void cogl_rotate (float angle,
float x,
float y,
float z);
/**
* cogl_get_modelview_matrix:
* @m: pointer to a 4x4 array of #float<!-- -->s to receive the matrix
*
* Stores the current model-view matrix in @m. The matrix is in
* column-major order.
*/
void cogl_get_modelview_matrix (float m[16]);
/**
* cogl_get_projection_matrix:
* @m: pointer to a 4x4 array of #float<!-- -->s to receive the matrix
*
* Stores the current projection matrix in @m. The matrix is in
* column-major order.
*/
void cogl_get_projection_matrix (float m[16]);
/**
* cogl_get_viewport:
* @v: pointer to a 4 element array of #float<!-- -->s to
* receive the viewport dimensions.
*
* 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.
*/
void cogl_get_viewport (float v[4]);
/**
* cogl_clip_push:
* @x_offset: left edge of the clip rectangle
* @y_offset: top edge of the clip rectangle
* @width: width of the clip rectangle
* @height: 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 transformed by the
* current model-view matrix.
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
*
* The rectangle is intersected with the current clip region. To undo
* the effect of this function, call cogl_clip_pop().
*/
void cogl_clip_push (float x_offset,
float y_offset,
float width,
float height);
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
/**
* cogl_clip_push_from_path:
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
*
* Sets a new clipping area using the current path. The current path
* is then cleared. The clipping area is intersected with the previous
* clipping area. To restore the previous clipping area, call
* cogl_clip_pop().
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
*
* Since: 1.0
*/
void cogl_clip_push_from_path (void);
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
/**
* cogl_clip_push_from_path_preserve:
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
*
* Sets a new clipping area using the current path. The current path
* is then cleared. The clipping area is intersected with the previous
* clipping area. To restore the previous clipping area, call
* cogl_clip_pop().
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
*
* Since: 1.0
*/
void cogl_clip_push_from_path_preserve (void);
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
/**
* cogl_clip_pop:
*
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
* Reverts the clipping region to the state before the last call to
* cogl_clip_push().
*/
void cogl_clip_pop (void);
Bug 1172 - Disjoint paths and clip to path * clutter/cogl/cogl-path.h: * clutter/cogl/common/cogl-primitives.c: * clutter/cogl/common/cogl-primitives.h: * clutter/cogl/gl/cogl-primitives.c: * clutter/cogl/gles/cogl-primitives.c: Changed the semantics of cogl_path_move_to. Previously this always started a new path but now it instead starts a new disjoint sub path. The path isn't cleared until you call either cogl_path_stroke, cogl_path_fill or cogl_path_new. There are also cogl_path_stroke_preserve and cogl_path_fill_preserve functions. * clutter/cogl/gl/cogl-context.c: * clutter/cogl/gl/cogl-context.h: * clutter/cogl/gles/cogl-context.c: * clutter/cogl/gles/cogl-context.h: Convert the path nodes array to a GArray. * clutter/cogl/gl/cogl-texture.c: * clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure * clutter/cogl/common/cogl-clip-stack.c: * clutter/cogl/common/cogl-clip-stack.h: Simplified the clip stack code quite a bit to make it more maintainable. Previously whenever you added a new clip it would go through a separate route to immediately intersect with the current clip and when you removed it again it would immediately rebuild the entire clip. Now when you add or remove a clip it doesn't do anything immediately but just sets a dirty flag instead. * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/cogl.c: Taken away the code to intersect stencil clips when there is exactly one stencil bit. It won't work with path clips and I don't know of any platform that doesn't have eight or zero stencil bits. It needs at least three bits to intersect a path with an existing clip. cogl_features_init now just decides you don't have a stencil buffer at all if you have less than three bits. * clutter/cogl/cogl.h.in: New functions and documentation. * tests/interactive/test-clip.c: Replaced with a different test that lets you add and remove clips. The three different mouse buttons add clips in different shapes. This makes it easier to test multiple levels of clipping. * tests/interactive/test-cogl-primitives.c: Use cogl_path_stroke_preserve when using the same path again. * doc/reference/cogl/cogl-sections.txt: Document the new functions.
2008-12-04 13:45:09 +00:00
/**
* cogl_clip_ensure:
*
* 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.
*
* Since: 1.0
*/
void cogl_clip_ensure (void);
/**
* cogl_clip_stack_save:
*
* 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().
*
* Since: 0.8.2
*/
void cogl_clip_stack_save (void);
/**
* cogl_clip_stack_restore:
*
* Restore the state of the clipping stack that was previously saved
* by cogl_clip_stack_save().
*
* Since: 0.8.2
*/
void cogl_clip_stack_restore (void);
/**
* cogl_enable_depth_test:
* @setting: %TRUE to enable depth testing 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.
*/
2008-04-28 15:36:11 +00:00
void cogl_enable_depth_test (gboolean setting);
/**
* cogl_enable_backface_culling:
* @setting: %TRUE to enable backface culling or %FALSE to disable.
*
* 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. Only
* calls to cogl_texture_rectangle() and cogl_texture_polygon() are
* affected. Backface culling is disabled by default.
*/
void cogl_enable_backface_culling (gboolean setting);
/**
* cogl_set_fog:
* @fog_color: The color of the fog
* @density: Ignored
* @z_near: Position along z-axis where no fogging should be applied
* @z_far: Position along z-axes where full fogging should be applied
*
* Enables fogging. Fogging causes vertices that are further away from
* the eye to be rendered with a different color. 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 the next call to
* cogl_paint_init().
*/
void cogl_set_fog (const CoglColor *fog_color,
float density,
float z_near,
float z_far);
/**
* cogl_paint_init:
* @color: Background color to clear to
*
* Clears the color buffer to @color. The depth buffer and stencil
* buffers are also cleared and fogging and lighting are disabled.
*/
void cogl_paint_init (const CoglColor *color);
/**
* cogl_set_source:
* @material: A CoglMaterial object
*
* This function sets the source material that will be used to fill subsequent
* geometry emitted via the cogl API.
*
* Note: in the future we may add the ability to set a front facing material,
* and a back facing material, in which case this function will set both to the
* same.
*
* Since 1.0
*/
void cogl_set_source (CoglHandle material);
/**
* cogl_set_source_color:
* @color: a #CoglColor
*
* Sets the source color using normalized values for each component.
* This color will be used for any subsequent drawing operation.
*
* See also cogl_set_source_color4ub() and cogl_set_source_color4f()
* if you already have the color components.
*
* Since: 1.0
*/
void cogl_set_source_color (const CoglColor *color);
/**
* cogl_set_source_color4ub:
* @red: value of the red channel, between 0 and 255
* @green: value of the green channel, between 0 and 255
* @blue: value of the blue channel, between 0 and 255
* @alpha: value of the alpha channel, between 0 and 255
*
* 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.
*
* Since: 1.0
*/
void cogl_set_source_color4ub (guint8 red,
guint8 green,
guint8 blue,
guint8 alpha);
/**
* cogl_set_source_color4f:
* @red: value of the red channel, between 0 and %1.0
* @green: value of the green channel, between 0 and %1.0
* @blue: value of the blue channel, between 0 and %1.0
* @alpha: 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 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.
*
* Since: 1.0
*/
void cogl_set_source_color4f (float red,
float green,
float blue,
float alpha);
/**
* cogl_set_source_texture:
* @texture_handle: The Cogl texture you want as your source
*
* This is a convenience function for creating a material with the first
* layer set to #texture_handle 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>
*
* Since 1.0
*/
void cogl_set_source_texture (CoglHandle texture_handle);
G_END_DECLS
#undef __COGL_H_INSIDE__
#endif /* __COGL_H__ */