Robert Bragg [Thu, 22 Oct 2009 18:01:27 +0000 (19:01 +0100)]
[tests] test-backface-culling: test culling with offscreen rendering
Since offscreen rendering is internally forced to be upside down Cogl
needs to reverse the glFrontFace winding order so as not to interfere
with the use of cogl_set_backface_culling_enabled()
This ensures we test that mechanism.
Robert Bragg [Thu, 22 Oct 2009 15:56:01 +0000 (16:56 +0100)]
[tests] Adds test-cogl-readpixels.c for very basic cogl_read_pixels testing
Mostly this was written to verify that we don't flip the data read back from
an offscreen draw buffer. (since all offscreen rendering is done upside
down)
Robert Bragg [Thu, 22 Oct 2009 11:36:17 +0000 (12:36 +0100)]
[tests] Adds test-cogl-offscreen to validate offscreen draw buffer
This adds a basic test to check that rendering a few colored rectangles
offscreen works and that the modelview gets restored when switching back to
the previous buffer.
Robert Bragg [Wed, 21 Oct 2009 15:06:43 +0000 (16:06 +0100)]
[tests] test-cogl-viewport tests semantics of over/under size viewports
Unlike OpenGL Cogl puts the origin of windows/viewports at the top left
instead of bottom left. This test verifies that we correctly translate Cogl
viewports to OpenGL viewports for the awkward cases where the given viewport
has an offset and/or the viewport has a different size to the current draw
buffer.
Robert Bragg [Mon, 2 Nov 2009 01:23:25 +0000 (01:23 +0000)]
[test-texture-fbo] comment the colors defined in corner_colors
It helps to be able to quickly glance at the definition to see which
quadrant of the test actor should be which color, so when debugging a
problem and looking at the visual output you can easily verify if it's being
flipped upside down/left to right.
Neil Roberts [Thu, 17 Sep 2009 13:25:29 +0000 (14:25 +0100)]
Add a conformance test for clutter_texture_new_from_actor
This contains four tests :-
- A regular onscreen source with a clone next to it
- An offscreen source with a clone. This is currently commented out
because it no longer works.
- An onscreen source with a rectangular clip and a clone.
- An onscreen source with a clip from a path and a clone.
The sources are all a 2x2 grid of colors. Each clone is tested that it
either contains the color that should be at that grid position or that
the stage color is showing through if the source is clipped.
Robert Bragg [Sat, 31 Oct 2009 00:01:44 +0000 (00:01 +0000)]
[cogl-texture-2d-sliced] allow COGL_FORMAT_ANY with _new_with_size()
It's useful when initialzing offscreen draw buffers to be able to ask
Cogl to create a texture of a given size and with the default internal
pixel format.
Robert Bragg [Sun, 1 Nov 2009 23:56:03 +0000 (23:56 +0000)]
[texture] fix rounding when calculating update_fbo viewport offset
When rendering to an fbo for supporting clutter_texture_new_from_actor we
render to an fbo with the same size as the source actor, but with a viewport
the same size as the stage. We offset the viewport so when we render the
source actor in its normal transformed stage position it lands on the fbo.
Previously we were rounding the transformed position given as a float by
truncating the fraction (just using a C cast) but that resulted in an
incorrect pixel offset when rendering offscreen depending on the source
position.
We now simply + 0.5 before casting (or -0.5 for negative numbers)
Robert Bragg [Mon, 2 Nov 2009 01:14:50 +0000 (01:14 +0000)]
[texture] switch to a new design for handling offscreen rendering
For supporting clutter_texture_new_from_actor(): when updating a
ClutterTexture's fbo we previously set up an offset frustum in the
perspective matrix before rendering source actors to an offscreen draw
buffer so as to give a perspective as if it were being drawn at its
original stage location.
Now that Cogl supports offset viewports there is a simpler way...
When we come to render the source actor to our offscreen draw buffer we
now copy the projection matrix from the stage; we create a viewport
that's also the same size as the stage (though larger than the offscreen
draw buffer) and as before we apply the modelview transformations of
the source actors ancestry before painting it.
The only trick we need now is to offset the viewport according to the
transformed (to screen space) allocation of the source actor (something we
required previously too). We negatively offset the stage sized viewport
such that the smaller offscreen draw buffer is positioned to sit underneath
the source actor in stage coordinates.
Robert Bragg [Thu, 24 Sep 2009 13:34:09 +0000 (14:34 +0100)]
[texture] split out fbo update code from cluter_texture_paint
To help keep clutter_texture_paint maintainable this splits out a big
chunk of standalone code that's responsible for updating the fbo when
clutter_texture_new_from_actor has been used.
Robert Bragg [Tue, 13 Oct 2009 21:22:39 +0000 (22:22 +0100)]
[texture] push/pop draw buffer when painting actors to a texture
When updating the FBO for a source actor (to support
clutter_texture_new_from_actor()) we used to simply set an offscreen draw
buffer to be current, paint the source actor and then explicitly set the
window to be current again. This precluded chaining texture_new_from_actor
though because updating another FBO associated with a source actor would end
up restoring the window as the current buffer instead of the previous
offscreen buffer. Now that we use Cogl's draw buffer stack; chaining
clutter_texture_new_from_actor() should be possible.
Robert Bragg [Thu, 22 Oct 2009 23:16:30 +0000 (00:16 +0100)]
[texture] Avoid redundant use of cogl_clip_stack_save when drawing offscreen
Since cogl draw buffers now own their clip state the stage's clip state will
automatically be saved and restored via the cogl_set_draw_buffer API.
Robert Bragg [Sat, 31 Oct 2009 00:00:33 +0000 (00:00 +0000)]
[cogl-draw-buffer] fix Cogl -> GL viewport coord conversion
Before we call glViewport we need to convert Cogl viewport coordinates
(where the origin is defined to be top left) to OpenGL coordinates
(where the origin is defined to be bottom left)
We weren't considering that offscreen rendering is always upside down
and in this case Cogl coordinates == OpenGL coordinates.
Robert Bragg [Fri, 30 Oct 2009 23:57:56 +0000 (23:57 +0000)]
[cogl_clip_push_window_rect] fix Cogl -> GL coordinate conversion
Firstly this now uses the draw buffer height not the viewport height
when we need to perform a y = height - y conversion, since (as the
name suggests) we are dealing with window coordinates not viewport
coordinates.
Secondly this skips any conversion when the current draw buffer is an
offscreen draw buffer since offscreen rendering is always forced to be
upside down and in this case Cogl window coordinates == GL window
coordinates.
Robert Bragg [Mon, 26 Oct 2009 17:51:34 +0000 (17:51 +0000)]
[matrix] Adds cogl_matrix_get_inverse API
This new API takes advantage of the recently imported Mesa code to support
inverse matrix calculation. The matrix code keeps track (via internal
flags) of the transformations a matrix represents so that it can select an
optimized inversion function.
Note: although other aspects of the Cogl matrix API have followed a similar
style to Cairo's matrix API we haven't added a cogl_matrix_invert API
because the inverse of a CoglMatrix is actually cached as part of the
CoglMatrix structure meaning a destructive API like cogl_matrix_invert
doesn't let users take advantage of this caching design.
Robert Bragg [Mon, 26 Oct 2009 11:01:33 +0000 (11:01 +0000)]
[debug] Adds a COGL_DEBUG=matrices debug option
This adds a COGL_DEBUG=matrices debug option that can be used to trace all
matrix manipulation done using the Cogl API. This can be handy when you
break something in such a way that a trace is still comparable with a
previous working version since you can simply diff a log of the broken
version vs the working version to home in on the bug.
Robert Bragg [Mon, 26 Oct 2009 08:23:21 +0000 (08:23 +0000)]
[cogl-matrix] Import Mesa's matrix manipulation code
This pulls in code from Mesa to improve our matrix manipulation support. It
includes support for calculating the inverse of matrices based on top of a
matrix categorizing system that allows optimizing certain matrix types.
(the main thing we were after) but also adds some optimisations for
rotations.
Changes compared to the original code from Mesa:
- Coding style is consistent with the rest of Cogl
- Instead of allocating matrix->m and matrix->inv using malloc, our public
CoglMatrix typedef is large enough to directly contain the matrix, its
inverse, a type and a set of flags.
- Instead of having a _math_matrix_analyse which updates the type, flags and
inverse, we have _math_matrix_update_inverse which essentially does the
same thing (internally making use of _math_matrix_update_type_and_flags())
but with additional guards in place to bail out when the inverse matrix is
still valid.
- When initializing a matrix with the identity matrix we don't immediately
initialize the inverse matrix; rather we just set the dirty flag for the
inverse (since it's likely the user won't request the inverse of the
identity matrix)
Robert Bragg [Thu, 22 Oct 2009 18:09:20 +0000 (19:09 +0100)]
[cogl] avoid any state changes when cogl_set_backface_culling_enable is a nop
This is a simple optimization to bail out of cogl_set_backface_culling_enable
if it's not resulting in a change of state.
Robert Bragg [Thu, 22 Oct 2009 18:01:52 +0000 (19:01 +0100)]
[cogl] Use clockwise face winding for offscreen buffers with culling enabled
Because Cogl defines the origin for texture as top left and offscreen draw
buffers can be used to render to textures, we (internally) force all
offscreen rendering to be upside down. (because OpenGL defines the origin
to be bottom left)
By forcing the users scene to be rendered upside down though we also reverse
the winding order of all the drawn triangles which may interfere with the
users use of backface culling. This patch ensures that we reverse the
winding order for a front face (if culling is in use) while rendering
offscreen so we don't conflict with the users back face culling.
Robert Bragg [Fri, 30 Oct 2009 23:54:13 +0000 (23:54 +0000)]
[main] Use cogl_read_pixels not glReadPixels in clutter-main.c
The debugging function read_pixels_to_file() and _clutter_do_pick were both
directly calling glReadPixels, but we don't wan't Clutter making direct
OpenGL calls and Cogl provides a suitable alternative. It also means
read_pixels_to_file() doesn't need to manually flip the data read due to
differences in Clutter/Cogl coordinate systems.
Robert Bragg [Tue, 3 Nov 2009 12:54:45 +0000 (12:54 +0000)]
[cogl_read_pixels] don't force a 4 byte pack alignment
Technically this change shouldn't make a difference since we are
calling glReadPixels with GL_RGBA GL_UNSIGNED_BYTE which is a 4
byte format and it should always result in the same value according
to how OpenGL calculates the location of sequential rows.
i.e. k = a/s * ceil(snl/a) where:
a = alignment
s = component size (1)
n = number of components per pixel (4)
l = number of pixels in a row
gives:
k = 4/1 * ceil(4l/4) and k = 1/1 * ceil(4l/1) which are equivalent
I'm changing it because I've seen i915 driver code that bails out of
hardware accelerated paths if the alignment isn't 1, and because
conceptually we have no alignment constraints here so even if the current
value has no effect, when we start reading back other formats it may upset
things.
Robert Bragg [Mon, 2 Nov 2009 01:11:21 +0000 (01:11 +0000)]
[cogl_read_pixels] call cogl_flush() before changing glPixelStore state
We were previously calling cogl_flush() after setting up the glPixelStore
state for calling glReadPixels, but flushing the journal could itself
change the glPixelStore state.
Robert Bragg [Mon, 2 Nov 2009 01:10:02 +0000 (01:10 +0000)]
[cogl_read_pixels] ensure we flush the current draw buffer state before reading
Make sure we call _cogl_draw_buffer_flush_state() before glReadPixels() to
be sure we have bound the correct framebuffer.
Robert Bragg [Mon, 2 Nov 2009 01:12:10 +0000 (01:12 +0000)]
[cogl_read_pixels] fixes for calculating the y offset when rendering offscreen
Since offscreen rendering is forced to be upside down we don't need to do
any conversion of the users coordinates to go from Cogl window coordinates
to OpenGL window coordinates.
Robert Bragg [Thu, 22 Oct 2009 15:55:07 +0000 (16:55 +0100)]
[read-pixels] don't flip data when reading from offscreen draw buffers
Since we do all offscreen rendering upside down (so that we can have the
origin for texture coordinates be the top left of textures for the cases
where offscreen draw buffers are bound to textures) we don't need to flip
data read back from an offscreen framebuffer before we we return it to the
user.
Robert Bragg [Wed, 21 Oct 2009 22:22:45 +0000 (23:22 +0100)]
[clip-stack] tidy up transform_point() code
I was originally expecting the code not to handle offset viewports or
viewports with a different size to the framebuffer, but it turns out the
code worked fine. In the process though I think I made the code slightly
more readable.
Robert Bragg [Tue, 3 Nov 2009 13:26:58 +0000 (13:26 +0000)]
[cogl] deprecate cogl_viewport() in favour of cogl_set_viewport()
cogl_viewport only accepted a viewport width and height, but there are times
when it's also desireable to have a viewport offset so that a scene can be
translated after projection but before hitting the framebuffer.
Robert Bragg [Wed, 21 Oct 2009 22:24:28 +0000 (23:24 +0100)]
[cogl_read_pixels] use buffer not viewport height to calculate y offset
glReadPixel takes window coordinates not viewport coordinates so we
shouldn't have been assuming that the viewport height == window height.
Robert Bragg [Wed, 21 Oct 2009 22:20:44 +0000 (23:20 +0100)]
[draw-buffer] Adds cogl_draw_buffer_get_{width,height} API
Simply adds missing API to query the width and height of any Cogl draw buffer.
Robert Bragg [Wed, 21 Oct 2009 22:24:49 +0000 (23:24 +0100)]
[cogl] Make sure Cogl always knows the current window geometry
Because Cogl defines the origin of viewport and window coordinates to be
top-left it always needs to know the size of the current window so that Cogl
window/viewport coordinates can be transformed into OpenGL coordinates.
This also fixes cogl_read_pixels to use the current draw buffer height
instead of the viewport height to determine the OpenGL y coordinate to use
for glReadPixels.
Robert Bragg [Thu, 22 Oct 2009 15:13:01 +0000 (16:13 +0100)]
[cogl] Make sure we draw upside down to offscreen draw buffers
First a few notes about Cogl coordinate systems:
- Cogl defines the window origin, viewport origin and texture coordinates
origin to be top left unlike OpenGL which defines them as bottom left.
- Cogl defines the modelview and projection identity matrices in exactly the
same way as OpenGL.
- I.e. we believe that for 2D centric constructs: windows/framebuffers,
viewports and textures developers are more used to dealing with a top left
origin, but when modeling objects in 3D; an origin at the center with y
going up is quite natural.
The way Cogl handles textures is by uploading data upside down in OpenGL
terms so that bottom left becomes top left. (Note: This also has the
benefit that we don't need to flip the data we get from image decoding
libraries since they typically also consider top left to be the image
origin.)
The viewport and window coords are mostly handled with various y =
height - y tweaks before we pass y coordinates to OpenGL.
Generally speaking though the handling of coordinate spaces in Cogl is a bit
fragile. I guess partly because none of it was design to be, it just
evolved from how Clutter defines its coordinates without much consideration
or testing. I hope to improve this over a number of commits; starting here.
This commit deals with the fact that offscreen draw buffers may be bound to
textures but we don't "upload" the texture data upside down, and so if you
texture from an offscreen draw buffer you need to manually flip the texture
coordinates to get it the right way around. We now force offscreen
rendering to be flipped upside down by tweaking the projection matrix right
before we submit it to OpenGL to scale y by -1. The tweak is entirely
hidden from the user such that if you call cogl_get_projection you will not
see this scale.
Robert Bragg [Thu, 22 Oct 2009 11:35:33 +0000 (12:35 +0100)]
[cogl] Ensure features are initialized first in cogl_create_context
Previously some context initializing was being done without valid feature
flags.
Robert Bragg [Fri, 16 Oct 2009 23:31:26 +0000 (00:31 +0100)]
[clip-stack] Handle flipped rectangles in try_pushing_rect_as_window_rect()
We were ignoring the possibility that the current modelview matrix may flip
the incoming rectangle in which case we didn't calculate a valid scissor
rectangle for clipping.
This fixes: http://bugzilla.o-hand.com/show_bug.cgi?id=1809
(Clipping doesn't work within an FBO)
Robert Bragg [Fri, 25 Sep 2009 13:34:34 +0000 (14:34 +0100)]
[draw-buffers] First pass at overhauling Cogl's framebuffer management
Cogl's support for offscreen rendering was originally written just to support
the clutter_texture_new_from_actor API and due to lack of documentation and
several confusing - non orthogonal - side effects of using the API it wasn't
really possible to use directly.
This commit does a number of things:
- It removes {gl,gles}/cogl-fbo.{c,h} and adds shared cogl-draw-buffer.{c,h}
files instead which should be easier to maintain.
- internally CoglFbo objects are now called CoglDrawBuffers. A
CoglDrawBuffer is an abstract base class that is inherited from to
implement CoglOnscreen and CoglOffscreen draw buffers. CoglOffscreen draw
buffers will initially be used to support the
cogl_offscreen_new_to_texture API, and CoglOnscreen draw buffers will
start to be used internally to represent windows as we aim to migrate some
of Clutter's backend code to Cogl.
- It makes draw buffer objects the owners of the following state:
- viewport
- projection matrix stack
- modelview matrix stack
- clip state
(This means when you switch between draw buffers you will automatically be
switching to their associated viewport, matrix and clip state)
Aside from hopefully making cogl_offscreen_new_to_texture be more useful
short term by having simpler and well defined semantics for
cogl_set_draw_buffer, as mentioned above this is the first step for a couple
of other things:
- Its a step toward moving ownership for windows down from Clutter backends
into Cogl, by (internally at least) introducing the CoglOnscreen draw
buffer. Note: the plan is that cogl_set_draw_buffer will accept on or
offscreen draw buffer handles, and the "target" argument will become
redundant since we will instead query the type of the given draw buffer
handle.
- Because we have a common type for on and offscreen framebuffers we can
provide a unified API for framebuffer management. Things like:
- blitting between buffers
- managing ancillary buffers (e.g. attaching depth and stencil buffers)
- size requisition
- clearing
Robert Bragg [Tue, 20 Oct 2009 15:55:10 +0000 (16:55 +0100)]
[stage-x11] Ensure viewport is initialized before first stage paint
This ensures that glViewport is called before the first stage paint.
Previously _clutter_stage_maybe_setup_viewport (which is done before we
start painting) was bailing out without calling cogl_setup_viewport because
the CLUTTER_STAGE_IN_RESIZE flag may be set if the stage was resized before
the first paint. (NB: The CLUTTER_STAGE_IN_RESIZE flag isn't removed until
we get an explicit event back from the X server since the window manager may
choose to deny/alter the resize.)
We now special case the first resize - where the viewport hasn't previously
been initialized and use the requested geometry to initialize the
glViewport without waiting for a reply from the server.
Robert Bragg [Tue, 15 Sep 2009 21:19:01 +0000 (22:19 +0100)]
[cogl-fbo] Bring the gles code more in line with gl code
Over time the two cogl-fbo.c files have needlessly diverged as bug fixes or
cleanups went into one version but not the other. This tries to bring them
back in line with each other. It should actually be simple enough to move
cogl-fbo.c to be a common file, and simply not build it for GLES 1.1, so
maybe I'll follow up with such a patch soon.
Robert Bragg [Tue, 15 Sep 2009 21:15:03 +0000 (22:15 +0100)]
[cogl-fbo] Remove poorly documented workaround for unknown driver/hardware
The comment just said: "Some implementation require a clear before drawing
to an fbo. Luckily it is affected by scissor test." and did a scissored
clear, which is clearly a driver bug workaround, but for what driver? The
fact that it was copied into the gles backend (or vica versa is also
suspicious since it seems unlikely that the workaround is necessary for both
backends.)
We can easily restore the workaround with a better comment if this problem
really still exists on current drivers, but for now I'd rather minimize
hand-wavey workaround code that can't be tested.
Damien Lespiau [Sun, 1 Nov 2009 14:36:05 +0000 (14:36 +0000)]
texture: Don't compare fbo_source with COGL_INVALID_HANDLE
fbo_source is a ClutterActor, it should be compared to NULL instead of
COGL_INVALID_HANDLE.
Emmanuele Bassi [Fri, 30 Oct 2009 12:11:19 +0000 (12:11 +0000)]
build: Add missing gles/cogl-context-driver.h to dist
The gles/cogl-context-driver.h header file is missing from the
dist target, which means it's not in the tarballs.
Emmanuele Bassi [Fri, 30 Oct 2009 11:02:35 +0000 (11:02 +0000)]
Add run-time version checks
Just like CLUTTER_CHECK_VERSION does version checking at compile
time, we need a way to verify the version of the library that we
are linking against. This is mostly needed for language bindings
and for run-time loadable modules -- when we'll get those.
Neil Roberts [Tue, 27 Oct 2009 13:18:51 +0000 (13:18 +0000)]
[cogl_polygon] Enable COGL_ENABLE_BLEND when use_color is set
Otherwise you can't use the alpha channel of the vertex colors unless
the material has a texture with alpha or the material's color has
alpha less than 255.
Neil Roberts [Tue, 27 Oct 2009 12:38:10 +0000 (12:38 +0000)]
build: Add $(top_buiddir)/clutter/cogl to the include path in clutter/cogl/cogl
Some files try to include "cogl/cogl-defines-gl.h" so
$(top_builddir)/clutter/cogl needs to be in the include path for out of
tree builds to work.
Emmanuele Bassi [Mon, 26 Oct 2009 16:29:31 +0000 (16:29 +0000)]
color: Fix HLS-to-RGB conversion
Apparently, on 64bit systems the floating point noise is enough
to screw up the float-to-int truncation.
The solution is to round up by 0.5 and then use floorf(). This
gives predictable and correct results on both 32bit and 64bit
systems.
Emmanuele Bassi [Mon, 26 Oct 2009 16:02:06 +0000 (16:02 +0000)]
layout: Do not create a LayoutMeta on remove
When calling remove_child_meta() we check if there is a LayoutMeta
already attached to the Actor, and if that LayoutMeta matches the
(manager, container, actor) tuple. If the LayoutMeta does not match,
though, we create a new LayoutMeta instance -- in order to remove it
right afterwards.
Instead of doing this, we can simply check for a matching LayoutMeta
and if present, remove it.
In case of an existing, non-matching LayoutMeta, we're left with a
dangling instance, but it does not matter: the removal happens in the
unparenting phase of a ClutterContainer, so either the Actor will be
destroyed and thus the LayoutMeta will be disposed along with it; or
it will be parented to another container, and thus the LayoutMeta
will be replaced.
Emmanuele Bassi [Mon, 26 Oct 2009 15:10:20 +0000 (15:10 +0000)]
tests: Use the right key symbol for adding children
The test-box-layout should be using CLUTTER_plus instead of a
literal '+'.
Emmanuele Bassi [Mon, 26 Oct 2009 15:09:07 +0000 (15:09 +0000)]
box: Depth level changes should queue a relayout
ClutterBox is not ClutterGroup: a change in the level of an actor
through raise, lower or depth sorting must trigger a relayout.
Emmanuele Bassi [Mon, 26 Oct 2009 15:08:03 +0000 (15:08 +0000)]
box: Check before using the LayoutManager instance
A ClutterBox might not have a ClutterLayoutManager instance
associated -- for instance, during destruction. We should check
for one before calling methods on it.
Emmanuele Bassi [Mon, 26 Oct 2009 11:51:30 +0000 (11:51 +0000)]
texture: Error handling fix
When cogl_texture_new_from_data() fails in clutter_texture_set_from_data()
and no GError is provided, the clutter app will segfault when dereferencing
the GError ** and emitting LOAD_FINISHED signal.
Based on a patch by: Haakon Sporsheim <haakon.sporsheim@gmail.com>
http://bugzilla.openedhand.com/show_bug.cgi?id=1806
Emmanuele Bassi [Mon, 26 Oct 2009 11:42:16 +0000 (11:42 +0000)]
tests: Print out the captured event type
The ::captured-event signal on the Stage is not printing out the
event type.
Emmanuele Bassi [Fri, 23 Oct 2009 16:32:18 +0000 (17:32 +0100)]
docs: Add images for layout managers
It's easier to show the layout manager policy with a simple
screen shot coming from our interactive tests.
Emmanuele Bassi [Fri, 23 Oct 2009 15:44:28 +0000 (16:44 +0100)]
cogl: Avoid C99-isms
Do not declare variables after statements.
Emmanuele Bassi [Fri, 23 Oct 2009 14:46:25 +0000 (15:46 +0100)]
cogl: Remove cogl-current-matrix.c
The cogl-current-matrix.c file is unused since commit
5e5d94dfbed18bf2b4c8c7a7ff9847952b2c4ae2 and it's not compiled
or distributed anymore.
Emmanuele Bassi [Fri, 23 Oct 2009 13:30:15 +0000 (14:30 +0100)]
Update Git ignore rules
Emmanuele Bassi [Fri, 23 Oct 2009 12:55:50 +0000 (13:55 +0100)]
Post-release bump to 1.1.3
Emmanuele Bassi [Fri, 23 Oct 2009 12:38:28 +0000 (13:38 +0100)]
Release 1.1.2 developers snapshot
Emmanuele Bassi [Fri, 23 Oct 2009 11:15:25 +0000 (12:15 +0100)]
build: Make COGL pass distcheck
Some changes to make COGL pass distcheck with Automake 1.11 and
anal-retentiveness turned up to 11.
The "major" change is the flattening of the winsys/ part of COGL,
which is built directly inside libclutter-cogl.la instead of an
intermediate libclutter-cogl-winsys.la object.
Ideally, the whole COGL should be flattened out using a
quasi-non-recursive Automake layout; unfortunately, the driver/
sub-section ships with identical targets and Automake cannot
distinguish GL and GLES objects.
Emmanuele Bassi [Fri, 23 Oct 2009 09:17:40 +0000 (10:17 +0100)]
actor: Identify allocation cycles
If an actor calls directly or indirectly clutter_actor_queue_relayout()
on itself from within the allocate() implementation it will cause a
relayout cycle. This is usually a condition that should be checked by
ClutterActor and we should emit a warning if it is verified.
Emmanuele Bassi [Fri, 23 Oct 2009 09:08:02 +0000 (10:08 +0100)]
actor: Add checks for IN_DESTRUCTION flag
ClutterActor should check whether the current instance is being
destroyed and avoid performing operations like:
• queueing redraws
• queueing relayouts
It should also warn if the actor is being parented to an actor
currently being destroyed.
Emmanuele Bassi [Fri, 23 Oct 2009 08:48:35 +0000 (09:48 +0100)]
actor: Show actor name or type in the state checks warnings
When showing a warning in the state checks we perform to verify that
the invariants are maintained when showing, mapping and realizing, we
should also print out the name of the actor failing the checks. If the
actor has no name, the GType name should be used as a fallback.
Neil Roberts [Thu, 22 Oct 2009 15:55:29 +0000 (16:55 +0100)]
Fix some compilation errors in cogl-gles2-wrapper.c
The changes in
74f2122b6 introduced some syntax errors which were
preventing the GLES2 backend from compiling.
Emmanuele Bassi [Thu, 22 Oct 2009 12:48:49 +0000 (13:48 +0100)]
clone: Set :source as CONSTRUCT
The :source property for ClutterClone is a constructor property, but
it most definitely is not a constructor-only one.
Neil Roberts [Thu, 22 Oct 2009 14:39:30 +0000 (15:39 +0100)]
Remove cogl/{gl,gles}/Makefile.am
These are no longer used anywhere.
Emmanuele Bassi [Wed, 21 Oct 2009 16:44:44 +0000 (17:44 +0100)]
docs: Close the right tag to avoid XML errors
Emmanuele Bassi [Wed, 21 Oct 2009 16:43:34 +0000 (17:43 +0100)]
docs: Rename the Shader and StageManager sections
Emmanuele Bassi [Wed, 21 Oct 2009 15:15:18 +0000 (16:15 +0100)]
tests: Update test-script
Use explicit alpha definition and custom alpha functions.
Emmanuele Bassi [Wed, 21 Oct 2009 15:04:12 +0000 (16:04 +0100)]
alpha: Manually parse the :mode property in ClutterScript
The :mode property for a ClutterAlpha can either be an integer, for
an easing mode logical id, or a string for the easing mode "nickname".
Emmanuele Bassi [Wed, 21 Oct 2009 14:43:01 +0000 (15:43 +0100)]
script, docs: Update documentation for alphas
It is now possible to have Alpha instances defined explicitly for
behaviours, so we need to fix the documentation.
Emmanuele Bassi [Wed, 21 Oct 2009 14:29:25 +0000 (15:29 +0100)]
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
Emmanuele Bassi [Wed, 21 Oct 2009 14:17:50 +0000 (15:17 +0100)]
script: Always allow setting object properties by id reference
The block that allows setting a GObject property holding an object
instance is conditionally depending on the USE_PIXBUF define. This
makes it impossible to reference an object inside ClutterScript on
platforms not using GdkPixbuf.
Emmanuele Bassi [Wed, 21 Oct 2009 14:16:43 +0000 (15:16 +0100)]
behaviour: Notify changes of the :alpha property
The set_alpha() setter of ClutterBehaviour is not emitting notifications
for the alpha property.
Owen W. Taylor [Tue, 6 Oct 2009 03:20:07 +0000 (23:20 -0400)]
Force a relayout when showing an actor
When an actor is hidden, the parent actor is not required to
size request or allocate it. (ClutterGroup does, but, for example,
NbtkBoxLayout doesn't.) This means that the
needs_width_request/needs_height_request/needs_allocate can be
stale when we go to show it again - they are set for the actor
but not the parent. Explicitly setting them to FALSE avoids
clutter_actor_relayout() improperly short-circuiting.
http://bugzilla.openedhand.com/show_bug.cgi?id=1831
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Tue, 20 Oct 2009 21:05:04 +0000 (22:05 +0100)]
text: Invalidate caches and sizes in set_text_internal()
The change in commit
3bbc96e17e5a03ba931c86a5cd2a0ecaa2a3b77b moved the
:text property setter to use set_text_internal(); this function does not
invalidate the Layout cache and does not queue a relayout, thus breaking
the behaviour of ClutterText when setting the contents of the actor using
the property.
http://bugzilla.openedhand.com/show_bug.cgi?id=1851
Robert Bragg [Tue, 20 Oct 2009 13:57:40 +0000 (14:57 +0100)]
[group] Fix copy & paste error from
857b0239e (Use FixedLayout inside Group)
clutter_group_get_preferred_height was calling
clutter_layout_manager_get_preferred_width which e.g. broke
test-actor-clone.
Robert Bragg [Tue, 29 Sep 2009 01:56:23 +0000 (02:56 +0100)]
[gles2] remove lots of redundant matrix stack code
Since we no longer depend on the GL matrix API in Cogl we can remove a lot
of wrapper code from the GLES 2 backend. This is particularly nice given
that there was no code shared between the cogl-matrix-stack API and gles2
wrappers so we had a lot of duplicated logic.
Robert Bragg [Tue, 13 Oct 2009 22:09:42 +0000 (23:09 +0100)]
[cogl] Removes the cogl-current-matrix abstraction
The indirection through this API isn't necessary since we no longer
arbitrate between the OpenGL matrix API and Cogl's client side API. Also it
doesn't help to maintain an OpenGL style matrix mode API for internal use
since it's awkward to keep restoring the MODELVIEW mode and easy enough to
directly work with the matrix stacks of interest.
This replaces use of the _cogl_current_matrix API with direct use of the
_cogl_matrix_stack API. All the unused cogl_current_matrix API is removed
and the matrix utility code left in cogl-current-matrix.c was moved to
cogl.c.
Robert Bragg [Wed, 14 Oct 2009 09:53:48 +0000 (10:53 +0100)]
[matrix-stack] Adds ctx->flushed_matrix_mode to cache the gl matrix mode
This cache of the gl matrix mode lets us avoid repeat calls to glMatrixMode
in _cogl_matrix_stack_flush_to_gl when we have lots of sequential modelview
matrix modifications.
Robert Bragg [Tue, 6 Oct 2009 11:36:32 +0000 (12:36 +0100)]
matrix-stack: more optimization for load_identity case
This goes a bit further than the previous patch, and as a special case
we now simply represent identity matrices using a boolean, and only
lazily initialize them when they need to be modified.
Robert Bragg [Tue, 6 Oct 2009 09:52:07 +0000 (10:52 +0100)]
[matrix-stack] avoid redundant clearing of matrix when using load_identity
The journal always uses an identity matrix since it uses software
transformation. Currently it manually uses glLoadMatrix since previous
experimentation showed that the cogl-matrix-stack gave bad performance, but
it would be nice to fix performance so we only have to care about one path
for loading matrices.
For the common case where we do:
cogl_matrix_stack_push()
cogl_matrix_stack_load_identity()
we were effectively initializing the matrix 3 times. Once due to use of
g_slice_new0, then we had a cogl_matrix_init_identity in
_cogl_matrix_state_new for good measure, and then finally in
cogl_matrix_stack_load_identity we did another cogl_matrix_init_identity.
We don't use g_slice_new0 anymore, _cogl_matrix_state_new is documented as
not initializing the matrix (instead _cogl_matrix_stack_top_mutable now
takes a boolean to choose if new stack entries should be initialised) and so
we now only initialize once in cogl_matrix_stack_load_identity.
Robert Bragg [Tue, 29 Sep 2009 01:58:27 +0000 (02:58 +0100)]
[current-matrix] Adds texture matrix stacks + removes GL matrix API usage
This relates back to an earlier commitment to stop using the OpenGL matrix
API which is considered deprecated. (ref
54159f5a1d029db)
The new texture matrix stacks are hung from a list of (internal only)
CoglTextureUnit structures which the CoglMaterial code internally references
via _cogl_get_texure_unit ().
So we would be left with only the cogl-matrix-stack code being responsible
for glMatrixMode, glLoadMatrix and glLoadIdentity this commit updates the
journal code so it now uses the matrix-stack API instead of GL directly.
Emmanuele Bassi [Mon, 19 Oct 2009 14:31:29 +0000 (15:31 +0100)]
text: Take pre-edit cursor position into account
When determining the cursor position we also need to take into account
the pre-edit cursor position as set by the set_preedit_string()
function.
Emmanuele Bassi [Mon, 19 Oct 2009 11:01:38 +0000 (12:01 +0100)]
docs: Documentation fixes
• Fix list_stages() and peek_stages() documentation
• Fix clutter_text_set_preedit_string() arguments in the header
to match source and documentation
• Add clutter_units_cm() to the private section for Units
• Rename the LayoutManager section
• Add FlowLayout:homogeneous accessors
Emmanuele Bassi [Mon, 19 Oct 2009 10:45:15 +0000 (11:45 +0100)]
Merge branch 'layout-manager'
* layout-manager: (50 commits)
docs: Reword a link
layout, docs: Add more documentation to LayoutManager
layout, docs: Fix description of Bin properties
layout, bin: Use ceilf() instead of casting to int
layout, docs: Add long description for FlowLayout
layout, box: Clean up
layout, box: Write long description for Box
layout, docs: Remove unused functions
layout: Document BoxLayout
layout: Add BoxLayout, a single line layout manager
layout: Report the correct size of FlowLayout
layout: Resizing the stage resizes the FlowLayout box
layout: Use the get_request_mode() getter in BinLayout
layout: Change the request-mode along with the orientation
actor: Add set_request_mode() method
[layout] Remove FlowLayout:wrap
[layout] Rename BinLayout and FlowLayout interactive tests
[layout] Skip invisible children in FlowLayout
[layout] Clean up and document FlowLayout
[layout] Snap children of FlowLayout to column/row
...
Emmanuele Bassi [Mon, 19 Oct 2009 10:44:29 +0000 (11:44 +0100)]
docs: Reword a link
Emmanuele Bassi [Mon, 19 Oct 2009 10:00:23 +0000 (11:00 +0100)]
layout, docs: Add more documentation to LayoutManager
The layout manager reference should have some documentation on how
to use a LayoutManager object inside a container and how to implement
a LayoutManager sub-class correctly.
Emmanuele Bassi [Sun, 18 Oct 2009 16:49:00 +0000 (17:49 +0100)]
build: Add back QUIET_GEN to the GIR generation
Emmanuele Bassi [Sun, 18 Oct 2009 16:15:04 +0000 (17:15 +0100)]
Update ignore file
Emmanuele Bassi [Sun, 18 Oct 2009 16:12:12 +0000 (17:12 +0100)]
build: De-nest the JSON from the introspection rules
The JSON conditional rules can be moved outside the introspection
conditional ones to avoid a nested check, as all the JSON rules do
is setting up variables that may or may not be used.
Emmanuele Bassi [Sun, 18 Oct 2009 16:11:42 +0000 (17:11 +0100)]
build: Use QUIET_GEN when building ClutterJson GIR
Emmanuele Bassi [Sun, 18 Oct 2009 16:00:24 +0000 (17:00 +0100)]
build: Fix up the GIR generation rules
The rules for generating Clutter's introspection data are
still referencing the old COGL layout.
Emmanuele Bassi [Fri, 16 Oct 2009 23:30:37 +0000 (00:30 +0100)]
build: Add CPPFLAGS for the g-ir-scanner command line
When I moved all CPP flags to AM_CPPFLAGS from the INCLUDES directive
I forgot that g-ir-scanner needs those defines as well.
Robert Bragg [Wed, 16 Sep 2009 13:01:57 +0000 (14:01 +0100)]
[cogl-primitives] Split the journal out from cogl-primitives.c
The Journal can be considered a standalone component, so even though
it's currently only used to log quads, it seems better to split it
out into its own file.
Robert Bragg [Sun, 6 Sep 2009 20:47:46 +0000 (21:47 +0100)]
[test-backface-culling] Check that inverted tex coords don't affect culling
The additional check draws another front facing rectangle but this time with
the texture coords flipped on the x axis. The code that handles sliced
textures in cogl-primitives.c makes some suspicious changes to the geometry
when the texture coords are inverted.
Robert Bragg [Wed, 23 Sep 2009 14:11:55 +0000 (15:11 +0100)]
[cogl-spans] split out cogl-spans code from cogl-texture-2d-sliced
When we implement atlas textures we will probably want to use the spans API
to handle texture repeating so it doesn't make sense to leave the code in
cogl-texture-2d-sliced.c. Since it's a standalone set of data structures
and algorithms it also seems reasonable to split out from cogl-texture.
Vladimir Nadvornik [Sun, 30 Aug 2009 10:36:11 +0000 (12:36 +0200)]
[cogl-texture] Split CoglTexture into an abstract class + CoglTexture2dSliced
cogl-texture-2d-sliced provides an implementation of CoglTexture and this
seperation lays the foundation for potentially supporting atlas textures,
pixmap textures (as in GLX_EXT_texture_from_pixmap) and fast-path
GL_TEXTURE_{1D,2D,3D,RECTANGLE} textures in a maintainable fashion.
Robert Bragg [Wed, 16 Sep 2009 10:56:17 +0000 (11:56 +0100)]
[cogl-texture] Seal CoglTexture internals from cogl-primitives.c
cogl-primitives.c was previously digging right into CoglTextures so it could
manually iterate the texture slices for texturing quads and polygons and
because we were missing some state getters we were lazily just poking into
the structures directly.
This adds some extra state getter functions, and adds a higher level
_cogl_texture_foreach_slice () API that hopefully simplifies the way in
which sliced textures may be used to render primitives. This lets you
specify a rectangle in "virtual" texture coords and it will call a given
callback for each slice that intersects that rectangle giving the virtual
coords of the current slice and corresponding "real" texture coordinates for
the underlying gl texture.
At the same time a noteable bug in how we previously iterated sliced
textures was fixed, whereby we weren't correctly handling inverted texture
coordinates. E.g. with the previous code if you supplied texture coords of
tx1=100,ty1=0,tx2=0,ty2=100 (inverted along y axis) that would result in a
back-facing quad, which could be discarded if using back-face culling.
Robert Bragg [Thu, 30 Jul 2009 11:06:02 +0000 (12:06 +0100)]
[docs] switch gl_handle+gl_target docs for cogl_texture_new_from_foreign
The descriptions for gl_handle and gl_target were inverted.
Thanks to Young-Ho Cha for spotting that.
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Robert Bragg [Wed, 29 Jul 2009 16:21:07 +0000 (17:21 +0100)]
[cogl] move clutter/pango to clutter/cogl/pango
As part of the re-organisation of Cogl; move clutter/pango to be part of the
cogl sub-project.
Robert Bragg [Tue, 28 Jul 2009 01:02:02 +0000 (02:02 +0100)]
Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.
Currently this is the structure I'm aiming for:
cogl/
cogl/
<put common source here>
winsys/
cogl-glx.c
cogl-wgl.c
driver/
gl/
gles/
os/ ?
utils/
cogl-fixed
cogl-matrix-stack?
cogl-journal?
cogl-primitives?
pango/
The new winsys component is a starting point for migrating window system
code (i.e. x11,glx,wgl,osx,egl etc) from Clutter to Cogl.
The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.
Overview of the planned structure:
* The winsys/ API is the API that binds OpenGL to a specific window system,
be that X11 or win32 etc. Example are glx, wgl and egl. Much of the logic
under clutter/{glx,osx,win32 etc} should migrate here.
* Note there is also the idea of a winsys-base that may represent a window
system for which there are multiple winsys APIs. An example of this is
x11, since glx and egl may both be used with x11. (currently only Clutter
has the idea of a winsys-base)
* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
GLES 1.1 (fixed funciton) and 2.0 (fully shader based)
* Everything under cogl/ should fundamentally be supporting access to the
GPU. Essentially Cogl's most basic requirement is to provide a nice GPU
Graphics API and drawing a line between this and the utility functionality
we add to support Clutter should help keep this lean and maintainable.
* Code under utils/ as suggested builds on cogl/ adding more convenient
APIs or mechanism to optimize special cases. Broadly speaking you can
compare cogl/ to OpenGL and utils/ to GLU.
* clutter/pango will be moved to clutter/cogl/pango
How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"
Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps
As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
Robert Bragg [Tue, 28 Jul 2009 00:34:33 +0000 (01:34 +0100)]
Make the CoglContext structure a bit more maintainable
This moves most of cogl-context.{c.h} to cogl/common with some driver
specific members now living in a CoglContextDriver struct. Driver specific
context initialization and typedefs now live in
cogl/{gl,gles}/cogl-context-driver.{c,h}
Driver specific members can be found under ctx->drv.stuff
Robert Bragg [Mon, 27 Jul 2009 23:37:11 +0000 (00:37 +0100)]
Improve cogl-texture maintainability by moving 90% into cogl/common
This splits the limited components that differed between
cogl/{gl,gles}/cogl-texture.c into new {gl,gles}/cogl-texture-driver.c files
and the rest that can now be shared into cogl/common/cogl-texture.c