Commit Graph

2574 Commits

Author SHA1 Message Date
Emmanuele Bassi
bafa448666 [texture] Increase verbosity of error messages
The GError messages in set_from_rgb_data() and set_from_yuv_data()
are a little bit too thin on details.
2009-06-01 14:57:18 +01:00
Emmanuele Bassi
8b71fa1acb [docs] Remove misleading text
The documentation for ClutterTexture's set_from_rgb_data() and
set_from_yuv_data() says:

  Note: This function is likely to change in future versions.

This is not true, since they'll remain for the whole 1.x API cycle.
2009-06-01 14:57:18 +01:00
Neil Roberts
3b70e0b6b7 [pango-display-list] Use the CoglAttributeType macros instead of GL_FLOAT
Cogl now has an enum for the VBO attribute type so we should use that
instead of the GL enums.
2009-06-01 14:50:52 +01:00
Neil Roberts
97921a7d13 [pango-display-list] Use indexed vertices on GLES
Now that CoglVertexBuffers support indices we can use them with GLES
to avoid duplicating vertices. Regular GL still uses GL_QUADS because
it is shown to still have a performance benefit over indices with the
Intel drivers.
2009-06-01 14:50:52 +01:00
Neil Roberts
67544f38d4 [cogl-vertex-buffer] Add cogl_vertex_buffer_indices_get_for_quads
This function can be used as an efficient way of drawing groups of
quads without using GL_QUADS. It generates a VBO containing the
indices needed to render using pairs of GL_TRIANGLES. The VBO is
globally cached so that it only needs to be uploaded whenever more
indices are requested than ever before.
2009-06-01 14:50:52 +01:00
Emmanuele Bassi
4afe1e9a8b [actor] Add allocate_available_size()
The allocate_available_size() method is a convenience method in
the same spirit as allocate_preferred_size(). While the latter
will allocate the preferred size of an actor regardless of the
available size provided by the actor's parent -- and thus it's
suitable for simple fixed layout managers like ClutterGroup -- the
former will take into account the available size provided by the
parent and never allocate more than that; it is, thus, suitable
for simple fluid layout managers.
2009-05-29 17:53:19 +01:00
Emmanuele Bassi
293eeed507 [build] Remove cogl-enum-types.h on distclean
The cogl-enum-types.h file is created by glib-mkenums under
/clutter/cogl/common, and then copied in /clutter/cogl in order
to make the inclusion of that file work inside cogl.h.

Since we're copying it in a different location, the Makefile
for that location has to clean up the copy.
2009-05-29 17:50:58 +01:00
Emmanuele Bassi
936f638a42 [build] Fix dist issues
* cogl-deprecated.h is not being installed

* cogl-enum-types.c.in is not part of the dist
2009-05-29 17:10:27 +01:00
Jonas Bonn
faec5c468b Freeze notifiers around property setters
Notifications should be fired off from both the internal timeline and
the wrapping animation here, so notifiers should be frozen around these
property setters.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 16:22:46 +01:00
Jonas Bonn
1187972e45 [animation] Final cleanups to new Animation model
Just a couple of final cleanups after the reimplementation of the
Animation model.

i)  _set_mode does not need to set the timeline on the alpha
ii) freeze notifications around the setting of a new alpha

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 16:22:27 +01:00
Emmanuele Bassi
c5e659d592 [master clock] Use StageManager::peek_stages()
Use the new StageManager::peek_stages() method to avoid a copy
of the stages list.
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
5d4974ed36 [stage manager] Add peek_stages()
We need an method for StageManager that returns a const pointer
to the internal list, to avoid the copy.
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
63c7cc0175 [master clock] Handle Timeline::started signal correctly
The "started" signal is sent first after the timeline has been set to the
'running' state. For this reason, checking if the clock has any running
timelines running will always return true in the "started" signal handler:
the timeline that sent the signal is running.

What needs to be checked in the signal handler is if there are any
timelines running other than the one that emitted the ::started signal,
which we know is running anyway.

This prevents frames from being lost at the beginning of an animation when
a timeline is started after a quiescent period.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1617

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
cbbc1a9ca3 [build] Copy cogl-enum-types.h under the guard
We avoid rebuilding cogl-enum-types.h and cogl-enum-types.c by
using a "guard" -- a stamp file that will block Makefile. Since
we need cogl-enum-types.h into /clutter/cogl as well for the
cogl.h include to work, if we copy the cogl-enum-types.h
unconditionally it will cause a rebuild of the whole COGL; which
will cause a full rebuild.

To solve this, we can copy the header file when generating it
under the stamp file.
2009-05-29 15:13:55 +01:00
Neil Roberts
cfb9508465 [configure] Always execute the AM_CONDITIONAL call for X11_TESTS
Automake gets upset if an AM_CONDITIONAL call is itself conditionally
executed.
2009-05-29 14:31:34 +01:00
Emmanuele Bassi
e565c1f1db [build] Encode the target into the backend library
The libclutter-cogl internal object should be the only dependency
for Clutter, since we are already copying it inside clutter/cogl
for the introspection scanner. For this reason, the backend-specific,
real internal object should be built with the backend encoded into
the file name, like libclutter-common. This makes the build output
a little bit more clear: instead of having two:

  LINK libclutter-cogl-common.la
  ...
  LINK libclutter-cogl.la
  LINK libclutter-cogl.la

We'll have:

  LINK libclutter-cogl-common.la
  ...
  LINK libclutter-cogl-gl.la
  LINK libclutter-cogl.la

Same applies for the GLES backend.
2009-05-29 12:50:48 +01:00
Emmanuele Bassi
b4861cbd21 Use g_once when registering enumeration types
Just like we do with GObject types and G_DEFINE_TYPE, we should
use the g_once_init_enter/g_once_init_leave mechanism to make the
GType registration of enumeration types thread safe.
2009-05-29 12:40:23 +01:00
Emmanuele Bassi
3248bb1b75 [cogl] Generate enumeration GTypes
COGL is starting to have more enumerations than I can handle
by hand. Let's use glib-mkenums and be done with it.
2009-05-29 12:31:47 +01:00
Emmanuele Bassi
7b75f93db1 [docs] Fixes for the API reference
* Add unused symbols

* Document and sync argument names with their gtk-doc counterpart

* Add missing descriptions
2009-05-28 17:18:13 +01:00
Emmanuele Bassi
e51fbebd67 [git ignore] Add blend strings test 2009-05-28 17:18:10 +01:00
Emmanuele Bassi
9557328e4e Merge branch 'master' into 1.0-integration
* master:
  [test-text-perf] Use queue_redraw instead of painting the stage directly
  [actor] In paint when opacity == 0, clear the queued_redraw flag
2009-05-28 15:53:56 +01:00
Neil Roberts
d960ce46e5 [test-text-perf] Use queue_redraw instead of painting the stage directly
If it doesn't queue a redraw and allow the backend to clear and swap
the buffers then the results will be skewed because it is not
predictable when the driver will actually render the scene.
2009-05-28 15:31:05 +01:00
Emmanuele Bassi
7252c14197 [cogl] Make cogl_setup_viewport() a private function
The setup_viewport() function should only be used by Clutter and
not by application code.

It can be emulated by changing the Stage size and perspective and
requeueing a redraw after calling clutter_stage_ensure_viewport().
2009-05-28 14:14:50 +01:00
Emmanuele Bassi
32018584c0 [cogl deprecated] Add backface culling deprecation
The backface culling enabling function was split and renamed, just
like the depth testing one, so we need to add the macro to the
cogl-deprecated.h header.
2009-05-28 14:14:50 +01:00
Robert Bragg
be826ed4e7 [cogl vertex buffers] Give indices a CoglHandle so they are shareable
Previously indices were tightly bound to a particular Cogl vertex buffer
but we would like to be able to share indices so now we have
cogl_vertex_buffer_indices_new () which returns a CoglHandle.

In particular we could like to have a shared set of indices for drawing
lists of quads that can be shared between the pango renderer and the
Cogl journal.
2009-05-28 13:27:54 +01:00
Robert Bragg
f0849fc3e2 [cogl journal] If we are only flushing one quad use a TRIANGLE_FAN
At the moment Cogl doesn't do much batching of quads so most of the time we
are flushing a single quad at a time.  This patch simplifies how we submit
those quads to OpenGL by using glDrawArrays with GL_TRIANGLE_FAN mode
instead of sending indexed vertices using GL_TRIANGLES mode.

Note: I hope to follow up soon with changes that improve our batching and
also move the indices into a VBO so they don't need to be re-validated every
time we call glDrawElements.
2009-05-28 02:43:36 +01:00
Robert Bragg
57cb20dc06 [deprecated defines] Adds some missing cogl_texture_* deprecated defines
To assist people porting code from 0.8, the cogl_texture_* functions that
have been replaced now have defines that give some hint as to how they
should be replaced.
2009-05-28 02:43:36 +01:00
Robert Bragg
605243d952 [cogl] renamed cogl_enable_* to cogl_set_*_enabled + added getters
cogl_enable_depth_test and cogl_enable_backface_culling have been renamed
and now have corresponding getters, the new functions are:
  cogl_set_depth_test_enabled
  cogl_get_depth_test_enabled
  cogl_set_backface_culling_enabled
  cogl_get_backface_culling_enabled
2009-05-28 02:43:36 +01:00
Robert Bragg
96188bab62 [cogl matrix] Support ortho and perspective projections.
This adds cogl_matrix api for multiplying matrices either by a perspective
or ortho projective transform.  The internal matrix stack and current-matrix
APIs also have corresponding support added.

New public API:
cogl_matrix_perspective
cogl_matrix_ortho
cogl_ortho
cogl_set_modelview_matrix
cogl_set_projection_matrix
2009-05-28 02:43:35 +01:00
Robert Bragg
12c8ff8606 [cogl] Remove cogl_{create,destroy}_context from the public API
cogl_create_context is dealt with internally when _cogl_get_default context
is called, and cogl_destroy_context is currently never called.

It might be nicer later to get an object back when creating a context so
Cogl can support multiple contexts, so these functions are being removed
from the API until we get a chance to address context management properly.

For now cogl_destroy_context is still exported as _cogl_destroy_context so
Clutter could at least install a library deinit handler to call it.
2009-05-28 02:43:35 +01:00
Robert Bragg
59bd824404 [vbo indices] tweak add_indices api to return an id and add delete_indices api
Originally cogl_vertex_buffer_add_indices let the user pass in their own unique
ID for the indices; now the Id is generated internally and returned to the
caller.
2009-05-28 02:43:35 +01:00
Robert Bragg
d51faed660 [cogl-vertex-buffer] Seal GL types from the public API
We now have CoglAttributeType and CoglVerticesMode typedefs to replace the
use of GLenum in the public API.
2009-05-28 02:43:35 +01:00
Robert Bragg
6bb6686666 [cogl-vertex-buffers] Support putting index arrays into VBOS
It's now possible to add arrays of indices to a Cogl vertex buffer and
they will be put into an OpenGL vertex buffer object. Since it's quite
common for index arrays to be static it saves the OpenGL driver from
having to validate them repeatedly.

This changes the cogl_vertex_buffer_draw_elements API: It's no longer
possible to provide a pointer to an index array at draw time. So
cogl_vertex_buffer_draw_elements now takes an indices identifier that
should correspond to an idendifier returned when calling
cogl_vertex_buffer_add_indices ()
2009-05-28 02:43:34 +01:00
Robert Bragg
68214fe4b8 [cogl] Remove cogl_flush_gl_state from the API
This is being removed before we release Clutter 1.0 since the implementation
wasn't complete, and so we assume no one is using this yet.  Util we have
someone with a good usecase, we can't pretend to support breaking out into
raw OpenGL.
2009-05-28 02:43:34 +01:00
Robert Bragg
f322da3794 [material] Reduce the material API in preperation for releasing Clutter 1.0
There were a number of functions intended to support creating of new
primitives using materials, but at this point they aren't used outside of
Cogl so until someone has a usecase and we can get feedback on this
API, it's being removed before we release Clutter 1.0.
2009-05-28 02:43:34 +01:00
Robert Bragg
f28d5e481b [cogl-material] Removes all the API made redundant by the blend strings API
This removes the following API:
  cogl_material_set_blend_factors
  cogl_material_set_layer_combine_function
  cogl_material_set_layer_combine_arg_src
  cogl_material_set_layer_combine_arg_op

These were rather awkward to use, so since it's expected very few people are
using them at this point and it should be straight forward to switch over
to blend strings, the API is being removed before we release Clutter 1.0.
2009-05-28 02:43:34 +01:00
Robert Bragg
33994caa71 [cogl-material] Support string based blending and layer combine descriptions
Setting up layer combine functions and blend modes is very awkward to do
programatically.  This adds a parser for string based descriptions which are
more consise and readable.

E.g. a material layer combine function could now be given as:
  "RGBA = ADD (TEXTURE[A], PREVIOUS[RGB])"
or
  "RGB = REPLACE (PREVIOUS)"
  "A = MODULATE (PREVIOUS, TEXTURE)"

The simple syntax and grammar are only designed to expose standard fixed
function hardware, more advanced combining must be done with shaders.

This includes standalone documentation of blend strings covering the aspects
that are common to blending and texture combining, and adds documentation
with examples specific to the new cogl_material_set_blend() and
cogl_material_layer_set_combine() functions.

Note: The hope is to remove the now redundant bits of the material API
before 1.0
2009-05-28 02:43:28 +01:00
Robert Bragg
ef1a771fde [build] Fixes some compiler warnings when building for GLES 2
There were a number of variables shadowing other symbols, and an unused
display variable.
2009-05-28 01:15:41 +01:00
Emmanuele Bassi
ccd3b4c886 [animation] Simplify the Animation code
After long deliberation, the Animation class handling of the
:mode, :duration and :loop properties, as well as the conditions
for creating the Alpha and Timeline instances, came out as far too
complicated for their own good.

This is a rework of the API/parameters matrix and behaviour:

  - :mode accessors will create an Alpha, if needed
  - :duration and :loop accessors will create an Alpha and a Timeline
    if needed
  - :alpha will set or unset the Alpha
  - :timeline will set or unset the Timeline

Plus, more documentation on the Animation class itself.

Many thanks to Jonas Bonn <jonas@southpole.se> for the feedback
and the ideas.
2009-05-27 18:28:37 +01:00
Emmanuele Bassi
6fff1bcdc6 [animatable] Allow validation in ::animate_property
The Animatable interface implementation will always have the computed
value applied, whilst the non-Animatable objects go through the
interval validation first to avoid incurring in assertions and
warnings.

The Animatable::animate_property() should also be able to validate the
property it's supposed to interpolate, and eventually discard it. This
requires adding a return value to the virtual function (and its wrapper
function).

The Animation code will then apply the computed value only if the
animate_property() returns TRUE -- unifying the code path with the
non-Animatable objects.
2009-05-27 13:01:31 +01:00
Emmanuele Bassi
7edaf8ece8 [animation] Proxy properties whenever possible
The Animation class should proxy the :mode, :duration and :loop
properties whenever possible, to avoid them going out of sync when
changed using the Alpha and Timeline instances directly.

Currently, if Timeline:duration is changed, querying Animation:duration
will yield the old value, but the animation itself (being driven by
the Timeline) will use the Timeline's :duration new value. This holds
for the :loop and :mode properties as well.

Instead, the getters for the Animation's :duration, :loop and
:mode properties should ask the relevant object -- if any. The
loop, duration and mode values inside AnimationPrivate should only
be used if no Timeline or no Alpha instances are available, or
when creating new instances.
2009-05-27 12:12:11 +01:00
Emmanuele Bassi
1f44c3584c [animation] Defer the timeline handling to the Alpha
The Animation should not directly manipulate a Timeline instance,
but it should defer to the Alpha all handling of the timeline.

This means that:

  - set_duration() and set_loop() will either create a Timeline or
    will set the :duration and :loop properties on the Timeline; if
    the Timeline must be created, and no Alpha instance is available,
    then a new Alpha instance will be created as well and the newly
    create Timeline will be assigned to the Alpha

  - if set_mode() on an Animation instance without an Alpha, the
    Alpha will be created; a Timeline will also be created

  - set_alpha() will replace the Alpha; if the new Alpha does not
    have a Timeline associated then a Timeline will be created using
    the current :duration and :loop properties of Animation; otherwise,
    if the replaced Alpha had a timeline, the timeline will be
    transferred to the new one
2009-05-27 11:52:40 +01:00
Emmanuele Bassi
331d43196d [build] Decouple COGL debug level from Clutter's
Using --enable-debug, which controls Clutter's debug level, also
defines COGL_ENABLE_DEBUG. This should be left to --enable-cogl-debug
instead, since it's the configure switch that controls COGL debug
level.
2009-05-26 17:25:51 +01:00
Emmanuele Bassi
387ab4c142 [doap] Update
Long overdue update of the DOAP file for Clutter

* Repository update

* Add authors
2009-05-25 17:16:44 +01:00
Emmanuele Bassi
733508b80d [build] More spring clean fixes
* Remove the last if...fi with AS_IF

* Put back the regexp for the mingw32 check that commit 0d1c626a
  inadvertedly removed
2009-05-25 16:52:53 +01:00
Emmanuele Bassi
0d1c626a86 [build] Spring cleanup of configure.ac
Let's try to bring configure.ac into this century, shall we?

* Use the proper shell macros AS_IF and AS_CASE instead of if...fi
  and case...esac

* Check for X11 and relative extensions only when building for GLX
  and EGLX backends

* Add documentation on the behaviour of binary_age and interface_age

* Coalesce all the common checks to avoid redundancy

* Escape everything that requires escaping
2009-05-25 14:04:53 +01:00
Emmanuele Bassi
b05d4be19d Use GLib variant of strcasecmp()
The GLib version of strcasecmp() ignores any non-ASCII character,
unlike the original which is locale-dependent.
2009-05-25 12:42:17 +01:00
Emmanuele Bassi
ec374c7ab9 [build] Clean up cogl-pango Makefile 2009-05-25 12:41:16 +01:00
Emmanuele Bassi
71498a6376 [cogl] Remove max_waste argument from Texture ctors
The CoglTexture constructors expose the "max-waste" argument for
controlling the maximum amount of wasted areas for slicing or,
if set to -1, disables slicing.

Slicing is really relevant only for large images that are never
repeated, so it's a useful feature only in controlled use cases.
Specifying the amount of wasted area is, on the other hand, just
a way to mess up this feature; 99% the times, you either pull this
number out of thin air, hoping it's right, or you try to do the
right thing and you choose the wrong number anyway.

Instead, we can use the CoglTextureFlags to control whether the
texture should not be sliced (useful for Clutter-GST and for the
texture-from-pixmap actors) and provide a reasonable value for
enabling the slicing ourself. At some point, we might even
provide a way to change the default at compile time or at run time,
for particular platforms.

Since max_waste is gone, the :tile-waste property of ClutterTexture
becomes read-only, and it proxies the cogl_texture_get_max_waste()
function.

Inside Clutter, the only cases where the max_waste argument was
not set to -1 are in the Pango glyph cache (which is a POT texture
anyway) and inside the test cases where we want to force slicing;
for the latter we can create larger textures that will be bigger than
the threshold we set.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-05-23 19:35:19 +01:00
Emmanuele Bassi
87465355d3 Add repaint functions
Sometimes it is necessary for third party code to have a
function called during the redraw process, so that you can
update the scenegraph before it is painted.
2009-05-23 19:33:04 +01:00