There are various constraints for when we can support multi-texturing and
when they can't be met we try and print a clear warning explaining why the
operation isn't supported, but we shouldn't endlessly repeat the warning for
every primitive of every frame. This patch fixes that.
This is useful because sometimes we need to get the current matrix, which
is too expensive when indirect rendering.
In addition, this virtualization makes it easier to clean up the API in
the future.
All GL functions that are defined in a version later than 1.1 need to
be called through cogl_get_proc_address because the Windows GL DLL
does not export them to directly link against.
When the quad log contains multiple textures (such as when a sliced
texture is drawn) it dispatches the log with multiple calls to
flush_quad_batch and walks a pointer along the list of vertices.
However this pointer was being incremented by only one vertex so the
next quad would be drawn with three of the vertices from the last
quad.
The quad drawing code keeps track of the number of texture units that
have the tex coord array enabled so that in the next call it can
disabled any that are no longer enabled. However it was using 'i+1' as
the count but 'i' is already set to 'n_layers' from the previous for
loop.
Therefore it was disabling an extra texture unit. This doesn't
normally matter but it was causing GLES 2 to pointlessly realize an
extra unit.
This tries to make a number of files more comparable with the intention of
moving some code into cogl/common/
Files normalized:
cogl.c
cogl-context.c
cogl-context.h
cogl-texture.c
When drawing a texture with waste in _cogl_multitexture_unsliced_quad
it scales the texture coordinates so that the waste is not
included. However the formula was the wrong way around so it was
calculating as if the texture coordinates are ordered x1,x2,y1,y2 but
it is actually x1,y1,x2,y2.
When the texture is sliced it drops back to a fallback function and
passes it the texture coordinates from the rectangle. However if no
tex coords are given it would crash. Now it passes the default
0.0->1.0 tex coords instead.
If no texture coordinates are given then texture_unsliced_quad tries
to generate its own coordinates. However it also tries to read the
texture coordinates to check if they are in [0.0,1.0] range so it will
crash before it reaches that.
This updates cogl/gles in line with the integration of CoglMaterial throughout
Cogl that has been done for cogl/gl.
Note: This is still buggy, but at least it builds again and test-actors works.
Some GLES2 specific changes were made, but these haven't been tested yet.
This changes all GLES code to use the OpenGL function names instead of
the cogl_wrap_* names. For GLES2 we now define the OpenGL name to point
to the wrapper, as opposed to defining the wrapper to point to the
OpenGL name for GLES1.
I've also done a quick pass through gl/cogl.c and gles/cogl.c to make
them more easily comparable. (most of the code is now identical)
The script converted calls to COGL_FIXED_MUL(x,y) to (x*y). However
this fails for cases like this:
COGL_FIXED_MUL(a + b, c)
which become
(a + b * c)
The meaning of this is of course different because multiplication has
a higher precedence than addition.
This was causing breakages in cogl_texture_quad_sw when the vertex
coordinates are not in increasing order. This was the case in
test-backface-culling when NPOTs are not available.
Boolean arguments for functions are pretty evil and usually
lead to combinatorial explosion of parameters in case multiple
settings are added.
In the case of the COGL texture constructors we have a boolean
argument for enabling the auto-mipmapping; it is conceivable that
we might want to add more settings for a COGL texture without
breaking API or ABI compatibility, so the boolean argument should
become a bitmask.
The internals have not been changed: instead of checking for
a non-zero value, we check for a bitmask being set.
To deal with all the corner cases that couldn't be scripted a number of patches
were written for the remaining 10% of the effort.
Note: again no API changes were made in Clutter, only in Cogl.
This is the result of running a number of sed and perl scripts over the code to
do 90% of the work in converting from 16.16 fixed to single precision floating
point.
Note: A pristine cogl-fixed.c has been maintained as a standalone utility API
so that applications may still take advantage of fixed point if they
desire for certain optimisations where lower precision may be acceptable.
Note: no API changes were made in Clutter, only in Cogl.
Overview of changes:
- Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use
the CLUTTER_FIXED_ macros.
- Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped
and expanded into code that works with single precision floats instead.
- Uses of cogl_fixed_* have been replaced with single precision math.h
alternatives.
- Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for
angles and math.h replacements.
The changes from the GL version of cogl-texture.c have been mirrored
in the GLES version. This adds the cogl_texture_new_from_bitmap
function and fixes the build errors.
The GLES 2 wrapper needs to set up some state before each
draw. Previously this was acheived by wrapping glDrawArrays. Since the
multiple-texture-rectangle branch merge, glDrawElements is used
instead so we also need a wrapper for that.
It was also directly calling glBindTexture. GLES 2 uses a wrapper for
this function so that it can cope with GL_ALPHA format textures. The
format of the current texture needs to be stored as well as the target
and object number for this to work.
test-cogl-material now runs on GLES 1 using the PVR GLES1 SDK (though since
only 2 texture units are supported the third rotating light map doesn't show)
Note: It currently doesn't build for GLES 2.0
Multitexturing allows blending multiple layers of texture data when texturing
some geometry. A common use is for pre-baked light maps which can give nice
lighting effects relativly cheaply. Another is for dot-3 bump mapping, and
another is applying alpha channel masks.
The dot-3 bump mapping would be really nice one day, but currently cogl doesn't
support lighting so that's not dealt with in this patch.
notable limitations:
- It can only texture rectangles a.t.m - and like cogl_texture_rectangle there
is no support for rotated texturing.
- Sliced textures are not supported. I think I've figured out how to handle
layers with different slice sizes at least for rectangular geometry, but I'm
not sure how complex it becomes once rotations are possible and texturing
arbitrary cogl_polygons.
- Except for this new API, cogl still doesn't know about more than one texture
unit, and so has no way of caching any enables related to other units. So that
things don't break it's currently necessary to disable anything to do with
additional units as soon as we are done with them which isn't ideal.
- No clutter API yet.
There's no point in clearing the index array because it is always the
same sequence of indices regardless of the vertices. Instead it is
just added to when there are more vertices than ever before.
* 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.
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/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.
coordinates
* clutter/cogl/gl/cogl-texture.c: Instead of sorting the vertex
and texture coordinates passed to cogl_texture_rectangle, just
swap both sets whenever the texture coordinates are backward.
Bug 1219 - Clean up cogl.h
* clutter/cogl/cogl.h.in:
* clutter/cogl/cogl-offscreen.h:
* clutter/cogl/cogl-path.h:
* clutter/cogl/cogl-shader.h:
* clutter/cogl/cogl-texture.h:
* clutter/cogl/cogl-types.h: Split up the massive cogl.h file
into sub-header for each section of the API.
* clutter/cogl/gl/*:
* clutter/cogl/gles/*: Update the GL and GLES implementations
of COGL to cope with the new header structure.
* doc/reference/cogl/Makefile.am: Fix symbol retrieval.
Bug 1210 - Add CoglColor API
* clutter/cogl/cogl-color.h:
* clutter/cogl/cogl.h.in:
* clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-color.c:
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl.c:
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl.c: Add a new color-type, to be used by
COGL. CoglColor is optimized to allow the minimum amount of
conversions possible for both GL and GLES implementations.
* clutter/clutter-actor.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-entry.c:
* clutter/clutter-main.c:
* clutter/clutter-rectangle.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c: Use CoglColor when needed.
* clutter/pango/pangoclutter-render.c: Use CoglColor when needed.
* doc/reference/cogl/cogl-docs.sgml:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/test-cogl-offscreen.c:
* tests/test-cogl-primitives.c:
* tests/test-cogl-tex-convert.c:
* tests/test-cogl-tex-foreign.c:
* tests/test-cogl-tex-getset.c:
* tests/test-cogl-tex-polygon.c:
* tests/test-cogl-tex-tile.c:
* tests/test-paint-wrapper.c: Update the tests.
* README: Update release notes.
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.
* 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/gl/cogl-texture.c (_cogl_texture_upload_subregion_to_gl)
(_cogl_texture_upload_to_gl):
* clutter/cogl/gles/cogl-texture.c (_cogl_texture_upload_to_gl)
(_cogl_texture_upload_subregion_to_gl):
When uploading data to a sliced texture, fill the waste pixels
with copies of the edge of the real texture data. Otherwise the
value of the waste pixels are undefined so it will show artifacts
when the texture is scaled with GL_LINEAR and the pixels are
blended in.
* clutter/cogl/gl/cogl-texture.c (cogl_texture_set_region):
* clutter/cogl/gles/cogl-texture.c (cogl_texture_set_region):
Don't attempt to upload any data if the width or height of the
subregion is zero. Thanks to Gwenole Beauchesne.
uniforms for alpha testing.
* clutter/cogl/gles/cogl-gles2-wrapper.c
(cogl_gles2_wrapper_init): Get the uniforms for alpha testing
settings.
(cogl_wrap_glEnable, cogl_wrap_glDisable): Enable/disable alpha
testing.
(cogl_wrap_glAlphaFunc): Filled in the wrapper.
* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: Added alpha
testing.
* clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c
(cogl_wrap_glGetIntegerv): Added a wrapper for glGetIntegerv so
that it can report zero clip planes.
* clutter/cogl/gles/cogl.c:
* clutter/cogl/gles/cogl-texture.c: Use the wrapped version of
glGetIntegerv
* clutter/cogl/gles/cogl-primitives.c (_cogl_path_fill_nodes): Use
_cogl_features_available to check for the stencil buffer instead
of an #ifdef. The stencil buffer is available in the default
profile for the GLES 2 simulator.
glTexParameteri. Call glGenerateMipmap after every change to the
texture image data.
* clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c: Added a wrapper for
glTexParameteri so that it can ignore requests to set
GL_GENERATE_MIPMAP. Added a wrapper for glGenerateMipmap that does
nothing on GLES 1
* clutter/eglx/clutter-stage-egl.h:
* clutter/eglx/clutter-egl-headers.h:
* clutter/eglx/clutter-backend-egl.h:
* clutter/eglx/Makefile.am: Include the GLES and EGL headers via
clutter-egl-headers.h so that the right version can be used
depending on whether the GLES 2 wrapper is being used.
* configure.ac: Added an automake conditional for whether the GLES
2 wrapper should be used.
* clutter/eglx/clutter-stage-egl.c (clutter_stage_egl_realize):
Remove the call to glGetIntegerv to get the max texture size. It
was being called before the GL context was bound so it didn't work
anyway and it was causing trouble for the GLES 2 simulator.
* clutter/cogl/gles/stringify.sh: Shell script to convert the
shaders into a C string.
* clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c: Wrappers for most of the
missing GL functions in GLES 2.
* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl:
* clutter/cogl/gles/cogl-fixed-vertex-shader.glsl: New shaders for
GLES 2
* clutter/cogl/gles/cogl-defines.h.in: Use the @CLUTTER_GL_HEADER@
macro instead of always using the GLES 1 header.
* clutter/cogl/gles/cogl-context.h (CoglContext): Include a field
for the state of the GLES 2 wrapper.
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl.c: Use wrapped versions of the GL
functions where neccessary.
* clutter/cogl/gles/Makefile.am: Add sources for the GLES 2
wrapper and an extra build step to put the GLSL files into a C
string whenever the files change.
* 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:) Implemented a workaround
for missing alpha framebuffer channel. There are still
some issues with detecting whether alpha is present in the
framebuffer. See comments in code. Test-cogl-tex-getset now
successfully retrieves a RGBA texture image data.
(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.
cogl_blend_func caches blending setup much like cogl_enable
does with the enable flags. This separates blending factors
setup from the enable/disable operation in preparation of
the texture image retrieval fix for alpha channel on GLES.
(cogl_enable:) Does not modify blending factors anymore.
* clutter/cogl/gl(es)/cogl-context.h: CoglContext holds two
new variables to cache blending src and dst factors.
* clutter/cogl/gl(es)/cogl-context.c:
(cogl_create_context:) Initialize blending factors.
* clutter/cogl/gles/cogl-texture.c:
(cogl_texture_download_from_gl:) Set blending factors to
CGL_ONE, CGL_ZERO which fixes the slighlty improper behavior
where source colour was actually multiplied with its alpha
value in the result (not noticable on current tests).
* clutter/cogl/gl(es)/cogl-texture.h:
* clutter/cogl/gl(es)/cogl-texture.c:
cogl_texture_new_* functions take a gboolean auto_mipmap argument.
If TRUE automatic mipmap generation is enabled during the process
of slice texture object creation.
(cogl_texture_new_from_foreign:) now allows mipmap min filter
flags.
* clutter/clutter-texture.c:
* clutter/glx/clutter-glx-texture-pixmap.c:
* tests/test-cogl-offscreen.c:
* tests/test-cogl-tex-tile.c:
* tests/test-cogl-tex-convert.c:
* tests/test-cogl-tex-polygon.c:
* tests/test-cogl-tex-getset.c:
Pass FALSE for auto_mipmap to cogl_texture_new_*.
* clutter/pango/pangoclutter-render.c:
(tc_get:) Pass TRUE to cogl_texture_new_with_size and use mipmap
min filter for nicer glyphs at small scales. As a result test-text
has gone all beautiful now.
wrapped in reference-counted CoglHandles instead.
* clutter/cogl/gl/cogl-shader.c:
* clutter/cogl/gl/cogl-shader.h:
* clutter/cogl/gl/cogl-program.c:
* clutter/cogl/gl/cogl-program.h:
New files to hold the shader and program functions.
* clutter/cogl/gl/cogl.c: Removed shader and program functions.
* clutter/cogl/common/cogl-handle.h: New header to define
COGL_HANDLE_DEFINE which helps build functions to create
reference-counted handles. This reduces the amount of duplicated
code.
* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gl/cogl-fbo.c: Converted to use COGL_HANDLE_DEFINE
from cogl-handle.h to avoid duplicating some of the common code.
* clutter/cogl/gles/cogl-defines.h.in:
* clutter/cogl/gl/cogl-defines.h.in: Removed COGLhandle
* clutter/cogl/gl/cogl-context.h: Added handle arrays for programs
and shaders.
* clutter/cogl/gl/cogl-context.c (cogl_create_context): Added
initialisers for shader_handles and program_handles.
(cogl_destroy_context): Added calls to g_array_free for all handle
arrays.
* clutter/cogl/gl/Makefile.am (libclutter_cogl_la_SOURCES): Added
cogl-{program,shader}.{c,h}
* clutter/cogl/common/Makefile.am
(libclutter_cogl_common_la_SOURCES): Added cogl-handle.h
* clutter/cogl/gles/cogl.c:
* clutter/cogl/cogl.h.in: Programs and shaders are now wrapped in
CoglHandles instead of COGLhandles. cogl_program_destroy and
cogl_shader_destroy is now replaced with cogl_program_unref and
cogl_shader_unref. cogl_program_ref and cogl_shader_ref are also
added.
* clutter/clutter-shader.c: Converted to use CoglHandles for the
programs and shaders instead of COGLhandles.
* cogl/cogl-sections.txt: Added cogl_shader_ref,
cogl_shader_unref, cogl_is_shader, cogl_program_ref,
cogl_program_unref, cogl_is_program and cogl_is_offscreen.