Commit Graph

2602 Commits

Author SHA1 Message Date
Emmanuele Bassi
9ec4c29003 Merge branch 'async-textures'
* async-textures:
  Whitespace fixes in ClutterTexture
  [async-loading] Do not force the texture size on async load
  [async-loading] Update asynchronous image loading
  Add API for extracting image size from a file
  Update/clean and apply the async-texture patch from bug #1144
2009-01-14 15:16:41 +00:00
Emmanuele Bassi
cc1cb6ab36 Merge branch 'animation-improvements'
* animation-improvements:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [docs] Update the ClutterAnimation section
  [animation] Extend ClutterAnimation support to all objects
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
  [animation] Allow registering custom progress function
  [animation] Interval::compute_value should return a boolean
  Animate ClutterColor properties
2009-01-14 15:00:44 +00:00
Neil Roberts
7223b0a1a5 Fix GLES 2 after the multiple-texture-rectangle branch merge
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.
2009-01-13 16:52:39 +00:00
Neil Roberts
763d63b748 Update gtk-doc 'Since' field for cogl_texture_multiple_rectangles
The function has been backported to the 0.8 branch so it will also be
available in Clutter 0.8.6
2009-01-13 16:44:31 +00:00
Robert Bragg
a0c5690d55 Merge commit 'origin/master' into cogl-material
Conflicts:

	clutter/clutter-texture.c
	clutter/cogl/cogl-texture.h
	clutter/cogl/gles/cogl-context.c
	clutter/cogl/gles/cogl-context.h
2009-01-13 13:37:38 +00:00
Robert Bragg
eb8ce66e61 [cogl/gles] Fixes for building for GLES 1 using floats
* This adds GLfixed -> GLfloat conversion
* redefines cogl_wrap_glBlahx macros as glBlahf
* Other misc fixes (mostly corresponding to cogl/gl equivalents)
2009-01-12 17:21:09 +00:00
Emmanuele Bassi
c78d963e90 Add API for extracting image size from a file
For the asynchronous loading we need a function call that parses
a file, given its path, and retrieves the image width and height.

This commit adds cogl_bitmap_get_size_from_file() to the CoglBitmap
API.
2009-01-12 16:52:20 +00:00
Emmanuele Bassi
743b5c03dc Merge branch 'master' into async-textures 2009-01-12 14:43:53 +00:00
Emmanuele Bassi
0ca5eeaeae Declare G_LOG_DOMAIN for COGL
In order to get properly namespaced debug and warning messages
inside COGL code we need to define the G_LOG_DOMAIN macro.
2009-01-12 11:21:06 +00:00
Emmanuele Bassi
918794a256 [docs] Documentation warnings
Fix the various warnings issued by gtk-doc when enabling the API
reference generation for both COGL and Clutter.
2009-01-09 14:26:35 +00:00
Emmanuele Bassi
5dc2b7d5f3 Merge branch 'animatable-iface' into animation-improvements
* animatable-iface:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
2009-01-08 13:38:51 +00:00
Robert Bragg
755f3935f3 Merge branch 'master' into cogl-float 2009-01-08 11:48:00 +00:00
Chris Lord
0866b07f30 Update/clean and apply the async-texture patch from bug #1144 2009-01-07 17:02:43 +00:00
Neil Roberts
1530be0af9 Merge branch multiple-texture-rectangle into master
Bug 1289 - Draw multiple glyphs at once

The multiple-texture-rectangle branch adds a new Cogl texture function
called cogl_texture_multiple_rectangles which is used to draw multiple
rectangles out of a texture using a single GL call. This is
significantly faster than drawing the rectangles with individual calls
on some platforms. The Pango renderer now uses this to speed up
rendering.

The conflicts are just due to the whitespace fixes in cb569a5.

Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
	clutter/cogl/gl/cogl-texture.c
2009-01-07 16:25:26 +00:00
Emmanuele Bassi
df3667dd3a Merge the ClutterText actor
Merge branch 'text-actor'

* text-actor: (108 commits)
  Re-align ClutterText header file
  [text] Fix cursor sizing
  Comments and whitespace fixes to ClutterText
  [docs] Add newly added :single-line-mode accessors
  Update the ignore file
  [tests] Add text field interactive test
  [text] Add single-line-mode to ClutterText
  [text] Fix the deletion actions
  [text] Use cached length when possible
  [tests] Add unit for the ClutterText:password-char property
  [docs] Update the Text section
  [text] Coalesce text visibility and password character
  Allow localizations to change the text direction
  Clean up the update_pango_context() function
  Pass the PangoContext, not the MainContext
  Revert the logic of the PangoContext check
  Remove the binding pool entry from the list
  Remove BindingPool::list_actions()
  Add ClutterActor::create_pango_context()
  Rename the PangoContext creation functions
  ...
2009-01-07 12:06:33 +00:00
Neil Roberts
b6470ab900 [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
The rest of Cogl expects the texture mode to be GL_MODULATE so it
needs to be restored after calling cogl_material_rectangle. Otherwise
cogl_texture_rectangle will fail to blend with the Cogl color properly
and all of the labels will be black.
2009-01-06 18:24:57 +00:00
Neil Roberts
cd71b91440 [cogl-material] Make the user_tex_coords parameter of _rectangle const
The array is only used for input so it should be const.
2009-01-06 16:09:55 +00:00
Neil Roberts
ba2257973e Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
Otherwise they won't get installed
2009-01-06 15:53:35 +00:00
Emmanuele Bassi
e06f170c08 Merge branch 'units-rework'
* units-rework:
  [texture] Do not mix fixed point and units values
  [tests] Fix the actor detection
  [units] Do not use fixed point and units interchangeably
2009-01-05 11:11:10 +00:00
Robert Bragg
0408a5d2c5 [cogl-material] improvements for cogl_material_rectangle
The API has been changed to take an explicit length for the number of
texture coordinates passed, and it's now documented that if there are
more layers to the current material than the number of texture coords
passed, then default coordinates will be generated for the other
layers.

cogl_material_rectangle should now handle the case where a single
sliced texture is supplied as a material layer by falling back to
cogl_texture_rectangle. We are nearly at the point that
cogl_texture_rectangle could be deprecated. A few issues remain
though, such as not considering waste in cogl_material_rectangle.
2008-12-24 01:35:33 +00:00
Robert Bragg
98bd85afaa [cogl-material] Adds a cogl_material_set_color function
The other colors of a material; such as the ambient and diffuse color are
only relevent when we can enable lighting. This adds a basic unlit
color property.

Later cogl_set_source_color can be integrated to either modify the color
of the current source material, or maintain a special singlton CoglMaterial
that is modified by calls to cogl_set_source_color and implicitly made
current.
2008-12-24 01:35:02 +00:00
Robert Bragg
e4548bcdc5 [cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
This flattens the three functions: cogl_material_flush_gl_material_state,
.._flush_gl_alpha_func and .._flush_gl_blend_func into one:
cogl_flush_material_gl_state which doesn't takes a material handle. (the handle
is instead taken from the context.)

This has allows us to avoid re-submitting some state to OpenGL when the
material has not been replaced.

Note: Avoiding redundant state changes for material layers isn't dealt with
in this patch.
2008-12-24 01:33:23 +00:00
Robert Bragg
ef992f55db Merge branch 'master' into cogl-material
Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
2008-12-24 00:59:13 +00:00
Robert Bragg
baa63b7c46 White space clean up across a number of files (only removing trailing spaces)
Removed trailing white space from the following files:
- clutter-clone-texture.c
- clutter-texture.c
- clutter-texture.h
- cogl/cogl-texture.h
- cogl/gl/cogl-context.c
- cogl/gl/cogl-texture.c
- cogl/gl/cogl-context.h
2008-12-24 00:48:32 +00:00
Robert Bragg
5b61106684 [doc] Hooks up cogl-material reference documentation
Adds some more gtk-doc comments to cogl-material.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
1a8a9c4bc8 Updates previous GLES multi-texturing code to use CoglMaterial
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
2008-12-22 16:35:52 +00:00
Robert Bragg
61b8cc1874 Adds a CoglMaterial abstraction, which includes support for multi-texturing
My previous work to provide muti-texturing support has been extended into
a CoglMaterial abstraction that adds control over the texture combine
functions (controlling how multiple texture layers are blended together),
the gl blend function (used for blending the final primitive with the
framebuffer), the alpha function (used to discard fragments based on
their alpha channel), describing attributes such as a diffuse, ambient and
specular color (for use with the standard OpenGL lighting model), and
per layer rotations. (utilizing the new CoglMatrix utility API)

For now the only way this abstraction is exposed is via a new
cogl_material_rectangle function, that is similar to cogl_texture_rectangle
but doesn't take a texture handle (the source material is pulled from
the context), and the array of texture coordinates is extended to be able
to supply coordinates for each layer.

Note: this function doesn't support sliced textures; supporting sliced
textures is a non trivial problem, considering the ability to rotate layers.
Note: cogl_material_rectangle, has quite a few workarounds, for a number of
other limitations within Cogl a.t.m.
Note: The GLES1/2 multi-texturing support has yet to be updated to use
the material abstraction.
2008-12-22 16:35:52 +00:00
Robert Bragg
cdf19f3281 [doc] Hooks up cogl-matrix reference documentation
Adds a few more gtk-doc notes to cogl-matrix.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
af6c78e9b4 Adds CoglMatrix utility code 2008-12-22 16:35:52 +00:00
Robert Bragg
509928cc76 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
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.
2008-12-22 16:35:51 +00:00
Emmanuele Bassi
b4438143e5 Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Neil Roberts
c3e4c6df08 Merge commit 'git-svn' into multiple-texture-rectangle 2008-12-10 12:25:25 +00:00
Neil Roberts
4aea0d6e48 * clutter/cogl/gl/cogl.c:
* clutter/cogl/gl/cogl-defines.h.in:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/common/cogl-mesh.c: Rename the glBufferDataSub
	function to glBufferSubData. When calling glXGetProcAddress with
	the former Mesa returns a stub dispatch function which will
	segfault if you try to use it. With NVIDIA it returns NULL so
	_cogl_features_init decides the card doesn't have VBO support.
2008-12-10 12:13:20 +00:00
Neil Roberts
b11b74fcde Use a single index array
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.
2008-12-09 18:03:29 +00:00
Neil Roberts
8caf39eb00 Merge commit 'git-svn' into multiple-texture-rectangle 2008-12-09 15:10:56 +00:00
Neil Roberts
223c1225ea Support cogl_texture_multiple_rectangles in GL ES backend 2008-12-09 15:10:33 +00:00
Neil Roberts
59aef7488f Minor fix to indentation in gl/cogl-texture.c 2008-12-09 15:01:10 +00:00
Neil Roberts
3f492e6054 Add gtk-doc for cogl_texture_multiple_rectangles 2008-12-09 13:20:32 +00:00
Neil Roberts
778a9f7d67 Use glDrawRangeElements to share vertices
When drawing a quad from cogl_texture_multiple_rectangles share two of
the vertices in each triangle by using indices.
2008-12-09 13:02:28 +00:00
Neil Roberts
3b5eb3afeb Merge commit 'git-svn' into multiple-texture-rectangle
Conflicts:

	clutter/cogl/gl/cogl-texture.c
2008-12-04 18:20:57 +00:00
Neil Roberts
7a276affd6 Use the correct length in _cogl_texture_flush_vertices
The check for whether there are any rectangles to flush was using the
wrong value so it would always flush.

Thanks to Johan Bilien for spotting.
2008-12-04 17:50:03 +00:00
Neil Roberts
58f6aaa589 Bug 1297 - Bring back support for GL_ARB_texture_rectangle
* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign,
	(_cogl_texture_quad_hw, cogl_texture_polygon),
	(_cogl_texture_quad_sw): Support GL_ARB_texture_rectangle textures

	* clutter/glx/clutter-glx-texture-pixmap.c: Use rectangle textures
	when NPOTs are not available or it is forced by the
	CLUTTER_PIXMAP_TEXTURE_RECTANGLE environment variable.

	* clutter/cogl/gl/cogl.c (cogl_enable): Allow enabling
	GL_TEXTURE_RECTANGLE_ARB.
2008-12-04 17:24:33 +00:00
Neil Roberts
10d7cf3273 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
Neil Roberts
be655b05ad Bug 1305 - NPOT textures unaligned to a pixel sometimes have
border artifacts

	* clutter/cogl/gl/cogl-texture.c: Set the wrap mode of a texture
	on demand

	Instead of setting the wrap mode once per texture at creation, it
	is now changed whenever the texture is drawn. The previous value
	is cached so that it isn't changed if the value is the same.

	This is used in _cogl_texture_quad_hw to only enable GL_REPEAT
	mode when the coordinates are not in the range [0,1]. Otherwise it
	can pull in pixels from the other edge when the texture is
	rendered off-pixel.
2008-12-01 16:27:54 +00:00
Neil Roberts
420b1f0791 Use GL_TRIANGLES for the texture vertex array
Most cards don't actually support GL_QUADS and they are deprecated in
GL 3.0 so there is a chance it will perform faster with GL_TRIANGLES
even though it has to submit two extra vertices.
2008-11-28 14:20:07 +00:00
Neil Roberts
c502c5c3f4 Add cogl_texture_multiple_rectangles
This takes an array of sets of 8 floats to describe the rectangles. It
tries to send the geometry with a single glDrawArrays as far as
possible. cogl_texture_rectangle is now just a wrapper around
cogl_texture_multiple_rectangles.
2008-11-28 13:09:04 +00:00
Neil Roberts
47a21cd94f Make cogl_texture_rectangle use the vertex array
cogl_texture_quad_hw and _sw now just add vertices to the vertex
array. The last texture used is stored and if a different texture is
encountered then flushes the vertices. cogl_texture_rectangle always
flushes the vertices after calling either of the functions.
2008-11-28 12:33:19 +00:00
Neil Roberts
5557de30eb Use a GArray for the texture vertices in cogl_texture_polygon
Previously it was a dynamic array that was manually reallocated.
2008-11-27 16:44:39 +00:00
Neil Roberts
f4465ccb05 * clutter/cogl/gl/cogl-texture.c (cogl_texture_rectangle): Fixed
the test for whether to use hardware tiling. Previously it assumed
	that texture coordinates are in increasing order but this is not
	the case since bug 1057 was fixed. The texture coordinates are now
	sorted later. It also allowed negative coordinates which doesn't
	make sense if the texture has waste.
2008-11-26 16:35:25 +00:00
Neil Roberts
50b6ecc56d * clutter/cogl/gl/cogl-texture.c (cogl_texture_polygon): Fix the
equation for calculating texture coordinates when using sliced
	textures. This became broken in revision 3520.
2008-11-24 12:27:48 +00:00