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.
differences and improve maintainability.
* clutter/cogl/gl/cogl-context.h:
Adds a CoglTextureGLVertex typedef + texture_vertices and
texture_vertices_size members to CoglContext for using vertex arrays
like GLES does
* clutter/cogl/gl/cogl-context.c:
Initializes texture_vertices + texture_vertices_size members
* clutter/cogl/gl/cogl-internal.h:
Adds COGL_ENABLE_COLOR_ARRAY
* clutter/cogl/gl/cogl.c:
Add COGL_ENABLE_COLOR_ARRAY support to cogl_enable
* clutter/cogl/gles/cogl-context.h:
Change the CoglTextureGLVertex to use GLfloat for the position
and texture coord attributes and GLubyte for the color.
* clutter/cogl/gles/cogl-texture-private.h:
Adds a wrap_mode member like GL has.
* clutter/cogl/gl/cogl-texture.c
* clutter/cogl/gles/cogl-texture.c:
Improves the comparability of the files, such that the remaining
differences, better reflect the fundamental differences needed
between GL and GLES. Notably GL no longer uses glBegin/glEnd for
submitting vertices, it uses vertex arrays like GLES and this gives
a small but measurable fps improvement for test-text.
* clutter/cogl/gl/cogl-texture.c (cogl_texture_polygon)
(_cogl_texture_quad_sw, _cogl_texture_quad_hw):
* clutter/cogl/gles/cogl-texture.c (cogl_texture_polygon)
(_cogl_texture_quad_sw, _cogl_texture_quad_hw): Enable backface
culling in GL if it is requested.
* clutter/cogl/gles/cogl-texture.c (_cogl_texture_quad_sw)
(_cogl_texture_quad_hw):
* clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw)
(_cogl_texture_quad_hw): Reorder the
vertices so that they are counter-clockwise.
* clutter/cogl/gles/cogl-context.h (CoglContext):
* clutter/cogl/gl/cogl-context.h (CoglContext): Added a flag to
store whether backface culling is currently enabled.
* clutter/cogl/gles/cogl.c (cogl_enable_backface_culling):
* clutter/cogl/gl/cogl.c (cogl_enable_backface_culling): New
function
* doc/reference/cogl/cogl-sections.txt: Add
cogl_enable_backface_culling
* clutter/cogl/gles/cogl.c (error_string): Rename to
_cogl_error_string and remove the static scoping so that it can be
called in cogl-texture etc.
* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign):
* clutter/cogl/gles/cogl-texture.c (cogl_texture_new_from_foreign):
GE(*) can't be used to wrap around calls that use the return
value.
* clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw)
(_cogl_texture_quad_hw, cogl_texture_polygon): Remove GE(*)
wrapper around calls in the middle of a glBegin/glEnd pair which
otherwise always generate an error because glGetError can only be
called outside of the pair.
* clutter/cogl/gl/cogl-internal.h: Include stdio.h when definig
COGL_DEBUG and declare a prototype for _cogl_error_string.
* clutter/cogl/gles/cogl-internal.h: Match GE(*) macro to GL
version.
(cogl_texture_download_from_gl:) Store old blending factors
and restore them when done. The lack of ability to retrieve
the alpha channel now more noticable in test-cogl-tex-getset
since the edges of the hand are not antialiased.
* clutter/cogl/gl(es)/cogl-internal.h: Declare
cogl_blend_func to avoid "implicit implementation" compile
warning.