Commit Graph

4503 Commits

Author SHA1 Message Date
Elliot Smith
e45b8be71b cookbook: Fix key press to examine modifers correctly
The simple key press example in the cookbook used a brittle
and incorrect switch statement to test modifier values. Instead,
use logical "&" of the state with the modifiers we're interested
in to check which keys were pressed.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2223
2010-07-19 14:45:37 +01:00
Emmanuele Bassi
5865d2a4b3 cookbook: Use TESTS_DATA_DIR
We need the correct location for redhand.png if we want to load it
in textures-reflection.
2010-07-18 22:53:56 +01:00
Emmanuele Bassi
dc19e26073 cookbook: Add image and example for text-shadow 2010-07-18 11:20:44 +01:00
Emmanuele Bassi
0dac5e0557 cookbook: Include the textures-reflection example code
Add a section at the end of the recipe containing the full code of the
example.
2010-07-18 11:15:25 +01:00
Neil Roberts
76d8119a7f cogl-material-arbfp: Use separate buffers when calling g_ascii_dtostr
g_ascii_dtostr was being used in four separate arguments to
g_string_append_printf but all invocations of it were using the same
buffer. This would end up with all of the arguments having the same
value which would depend on whichever order the compiler evaluates
them in. This patches changes it to use a multi-dimensional array and
a loop to fill in the separate buffers.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2219
2010-07-18 11:01:05 +01:00
Emmanuele Bassi
90b74458d2 cookbook: Add an empty recipe for shadows under text
Currently, it's just an example and an image, but it should be easy to
flesh it out properly for the "Text" chapter.
2010-07-18 10:56:35 +01:00
Emmanuele Bassi
bb3dc013bf cookbook: Add example code
The cookbook should also include fully functional code examples. We can
even XInclude them into the docbook XML itself.

The examples should be built with the coobook, so that we can always
make sure they are up to date.
2010-07-18 10:53:06 +01:00
Emmanuele Bassi
5f4f2fa3c7 Add gmo files to the Git ignore list 2010-07-17 10:23:57 +01:00
Emmanuele Bassi
6983429e4a material-arbfp: Use locale-independent double to string conversion
The ARBfp programs are created with a printf() wrapper, which usually
fails in non-en locales as soon as you start throwing things like
floating point values in the mix.

We should use the g_ascii_dtostr() function which places a double into a
string buffer in a locale-independent way.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2219
2010-07-16 23:40:34 +01:00
Emmanuele Bassi
6f220399ae cookbook: Use the right tag for the screenshot
Screenshots should be using the <screenshot> tag, not the <figure> one.
2010-07-16 17:31:27 +01:00
Emmanuele Bassi
71dfdf92d7 Merge remote branch 'elliot/cookbook-actor-opacity'
Conflicts:
	doc/cookbook/Makefile.am
2010-07-16 17:23:36 +01:00
Emmanuele Bassi
af6f023a80 cookbook: Add a missing image to the list 2010-07-16 17:20:38 +01:00
Emmanuele Bassi
e92c8d72cc Merge remote branch 'elliot/cookbook-include-videos'
* elliot/cookbook-include-videos:
  cookbook: Tweak so that videos sit inside a paragraph for better spacing
  docs: Note the P_() macro in the HACKING file
  cookbook: Added support for inline video

Conflicts:
	doc/cookbook/Makefile.am
2010-07-16 17:13:12 +01:00
Emmanuele Bassi
ad1613a936 Merge remote branch 'elliot/cookbook-animation-fading'
* elliot/cookbook-animation-fading:
  cookbook: Minor modification to wording to improve clarity
  cookbook: Added recipe for fading actors in/out
2010-07-16 17:12:37 +01:00
Emmanuele Bassi
4170eacd94 cookbook: Add a recipe for texture reflection
A common request: how to create a clone of a texture that looks like a
reflection.
2010-07-16 17:04:31 +01:00
Elliot Smith
7be6ed3334 cookbook: Added a recipe about making an actor transparent
Explains how to make an actor transparent so that other actors
are visible through it.

Also explains a bit more generally about opacity and how
it's computed from the actor, container, and color; and how actor
visibility is affected by depth (fog) and depth order.
2010-07-16 15:34:09 +01:00
Elliot Smith
da22150498 cookbook: Minor modification to wording to improve clarity
Text referred to three animation methods, but only provides
examples for two of them; and in future there may be more/fewer
than 3. So I reworded it.
2010-07-16 12:48:56 +01:00
Elliot Smith
962b3c6885 cookbook: Added recipe for fading actors in/out
Added a recipe showing how to fade actors in/out by
animating their opacity property, using both implicit
animations and ClutterState.
2010-07-16 12:44:39 +01:00
Emmanuele Bassi
3aa3893a11 docbook: Add an introduction to the texture section 2010-07-16 12:01:42 +01:00
Emmanuele Bassi
e3de96c204 po: Fix the LTR string translation 2010-07-16 11:29:28 +01:00
Emmanuele Bassi
a8595435b8 po: Remove unused LINGUAS file
The ALL_LINGUAS variable is generated from the list of po files.
2010-07-16 11:23:04 +01:00
raven
ec81e8d738 Add pl translations
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-16 11:18:02 +01:00
happyaron
9b7579d916 Add zn_CN translations
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-16 11:17:30 +01:00
Elliot Smith
489799bb4d cookbook: Tweak so that videos sit inside a paragraph for better spacing 2010-07-15 17:31:10 +01:00
Emmanuele Bassi
ec7b0b4389 docs: Note the P_() macro in the HACKING file 2010-07-15 17:31:10 +01:00
Elliot Smith
1d9c64ff16 cookbook: Added support for inline video
Amended Makefile to copy content of videos directory into
installation directories. Also copies videos and images
into the html/ directory during the build, so that the
built cookbook can be viewed locally (for testing without
having to install).

Added an XSLT template to transform Docbook <inlinemediaobject>
elements into HTML 5 <video> elements, with a fallback to
link to the video displayed for browsers without HTML 5 support.

Added note to "Contributing" appendix explaining how to put
video into a recipe.
2010-07-15 17:31:10 +01:00
Neil Roberts
6ea2fbc729 Add an internal _cogl_bitmap_new_from_buffer
This function creates a CoglBitmap which internally references a
CoglBuffer. The map and unmap functions will divert to mapping the
buffer. There are also now bind and unbind functions which should be
used instead of map and unmap whenever the data doesn't need to be
read from the CPU but will instead be passed to GL for packing or
unpacking. For bitmaps created from buffers this just binds the
bitmap.

cogl_texture_new_from_buffer now just uses this function to wrap the
buffer in a bitmap rather than trying to bind the buffer
immediately. This means that the buffer will be bound only at the
point right before the texture data is uploaded.

This approach means that using a pixel array will take the fastest
upload route if possible, but can still fallback to copying the data
by mapping the buffer if some conversion is needed. Previously it
would just crash in this case because the texture functions were all
passed a NULL pointer.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2112
2010-07-15 17:27:15 +01:00
Neil Roberts
7eb0d01f9f Add a Cogl debug flag for BITMAP
CoglBitmap will soon want to report notes as it gets more complicated
so this adds a debug flag for it.
2010-07-15 17:27:15 +01:00
Neil Roberts
b780413e5a Try to avoid copying the GdkPixbuf when it is tightly packed
The docs for GdkPixbuf say that the last row of the image won't
necessarily be allocated to the size of the full rowstride. The rest
of Cogl and possibly GL assumes that we can copy the bitmap with
memcpy(height*rowstride) so we previously would copy the pixbuf data
to ensure this. However if the rowstride is the same as bpp*width then
there is no way for the last row to be under-allocated so in this case
we can just directly upload from the gdk pixbuf. Now that CoglBitmap
can be created with a destroy function we can make it keep a reference
to the pixbuf and unref it during its destroy callback. GdkPixbuf
seems to always pack the image with no padding between rows even if it
is RGB so this should end up always avoiding the memcpy.

The fallback code for when we do have to copy the pixbuf is now
simplified so that it copies all of the rows in a single loop. We only
copy the useful region of each row so this should be safe. The
rowstride of the CoglBitmap is now always allocated to bpp*width
regardless of the rowstride of the pixbuf.
2010-07-15 17:25:36 +01:00
Neil Roberts
fc12c42a83 cogl-bitmap: Encapsulate the CoglBitmap even internally
The CoglBitmap struct is now only defined within cogl-bitmap.c so that
all of its members can now only be accessed with accessor
functions. To get to the data pointer for the bitmap image you must
first call _cogl_bitmap_map and later call _cogl_bitmap_unmap. The map
function takes the same arguments as cogl_pixel_array_map so that
eventually we can make a bitmap optionally internally divert to a
pixel array.

There is a _cogl_bitmap_new_from_data function which constructs a new
bitmap object and takes ownership of the data pointer. The function
gets passed a destroy callback which gets called when the bitmap is
freed. This is similar to how gdk_pixbuf_new_from_data
works. Alternatively NULL can be passed for the destroy function which
means that the caller will manage the life of the pointer (but must
guarantee that it stays alive at least until the bitmap is
freed). This mechanism is used instead of the old approach of creating
a CoglBitmap struct on the stack and manually filling in the
members. It could also later be used to create a CoglBitmap that owns
a GdkPixbuf ref so that we don't necessarily have to copy the
GdkPixbuf data when converting to a bitmap.

There is also _cogl_bitmap_new_shared. This creates a bitmap using a
reference to another CoglBitmap for the data. This is a bit of a hack
but it is needed by the atlas texture backend which wants to divert
the set_region virtual to another texture but it needs to override the
format of the bitmap to ignore the premult flag.
2010-07-15 17:24:01 +01:00
Neil Roberts
fd886d9fc2 cogl-texture-2d-sliced: Store the internal format not image format
The 'format' member of CoglTexture2DSliced is returned by
cogl_texture_get_format. All of the other backends return the internal
format of the GL texture in this case. However the sliced backend was
returning the format of the image data used to create the texture. It
doesn't make any sense to retain this information because it doesn't
necessarily indicate the format of the actual texture. This patch
changes it to store the internal format instead.
2010-07-15 14:31:23 +01:00
Emmanuele Bassi
fae35f8411 docs: Note the P_() macro in the HACKING file 2010-07-15 14:26:16 +01:00
Emmanuele Bassi
fd27ca7398 Mark property strings for translation
Both the nick and the blurb fields should be translatable, for UI
builders and other introspection-based tools.
2010-07-15 14:07:07 +01:00
Emmanuele Bassi
8be43b5285 Add P_() macro for translating property strings
The P_() macro adds a context for the property nick and blurb. In order
to make xgettext recognize it, we need to drop glib-gettexize inside the
autogen.sh script and ship a modified Makefile.in.in with Clutter.
2010-07-15 12:09:01 +01:00
Emmanuele Bassi
292597a9e1 build: Use AS_ALL_LINGUAS
The AS_ALL_LINGUAS m4 macro allows configure-time generation of the
ALL_LINGUAS variable from the translations inside po/ instead of using
the LINGUAS file.
2010-07-15 11:36:25 +01:00
Nate Stedman
fff5558ad2 Fixes build with GLX on Mac OS X.
Moves preprocessor #ifdef __linux_ above else statement, avoiding the
lack of an else block if __linux__ is not defined.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2212

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-15 00:31:23 +01:00
Emmanuele Bassi
e7ae71e072 build: Fix include path for Cally's introspection
The introspection scanner does not include '.' by default, so it was
always using the installed copy of Clutter-1.0.gir. Which obviously
wouldn't work if we didn't have one.
2010-07-15 00:27:43 +01:00
Neil Roberts
54b2e1781e gles/cogl-texture-driver.c: Fix the include for cogl-material-private
In ddb9016be4 the GL texture driver backend was changed to include
cogl-material-opengl-private.h instead of cogl-material-private.h.
However the gles texture backend was missed from this so it was giving
a compiler warning about using an undeclared function.
2010-07-14 17:49:16 +01:00
Neil Roberts
ccdcbbb46b cogl-texture-3d: Use glTexSubImage3D through an indirect pointer
glTexSubImage3D was being called directly in cogl-texture-3d.c but the
function is only available since GL version 1.2 so on Windows it won't
be possible to directly link to it. Also under GLES it is only
available conditionally in an extension.
2010-07-14 17:45:15 +01:00
Neil Roberts
943266db3b cogl-texture-3d: Fix the cogl-material-private header include
In ddb9016be4 the texture backends were changed to include
cogl-material-opengl-private.h instead of cogl-material-private.h.
However the 3D texture backend was missed from this so it was giving a
compiler warning about using an undeclared function.
2010-07-14 16:35:33 +01:00
Neil Roberts
d0d72e4d97 cogl-texture-3d: Don't include cogl-texture-2d-private.h
I think this was included by a cut-and-paste error as it isn't needed
anywhere in the source.
2010-07-14 16:34:42 +01:00
Robert Bragg
5e66970385 material: splits out all the state flushing code
This moves the code supporting _cogl_material_flush_gl_state into
cogl-material-opengl.c as part of an effort to reduce the size of
cogl-material.c to keep it manageable.
2010-07-13 19:26:58 +01:00
Robert Bragg
ddb9016be4 material: split the texture unit management out
In general cogl-material.c has become far to large to manage in one
source file. As one of the ways to try and break it down this patch
starts to move some of lower level texture unit state management out
into cogl-material-opengl.c. The naming is such because the plan is to
follow up and migrate the very GL specific state flushing code into the
same file.
2010-07-13 19:26:58 +01:00
Robert Bragg
9e893e684e material: copy_differences: handle copying fog state
When the support for redirecting the legacy fog state through cogl
material was added in 9b9e764dc, the code to handle copying the fog
state in _cogl_material_copy_differences was missed.
2010-07-13 19:26:57 +01:00
Neil Roberts
ceb57087a7 Add a GL_GENERATE_MIPMAP fallback to the texture 2d and 3d backends
The CoglTexture2DSliced backend has a fallback for when the
framebuffer extension is missing so it's not possible to use
glGenerateMipmap. This involves keeping a copy of the upper-left pixel
of the tex image so that we can temporarily enable GL_GENERATE_MIPMAP
on the texture object and do a sub texture update by reuploading the
contents of the first pixel. This patch copies that mechanism to the
2D and 3D backends. The CoglTexturePixel structure which was
previously internal to the sliced backend has been moved to
cogl-texture-private.h so that it can be shared.
2010-07-13 18:41:01 +01:00
Emmanuele Bassi
ff56f4ac6f Merge branch 'wip/xkb-support'
* wip/xkb-support:
  x11: Use XKB to translate keycodes into key symbols
  x11: Use XKB to track the Locks state
  x11: Use XKB detectable auto-repeat
  x11: Add a Keymap ancillary object
  x11: Store the group inside the event platform data
  events: Add platform-data to allocated Events
  build: Check for the XKB extension
2010-07-13 16:12:14 +01:00
Emmanuele Bassi
0cbfabcda4 stage: Add the NO_CLEAR_ON_PAINT hint
Some apps or some use cases don't need to clear the stage on immediate
rendering GPUs. A media player playing a fullscreen video or a
tile-based game, for instance.

These apps are redrawing the whole screen, so we can avoid clearing the
color buffer when preparing to paint the stage, since there is no
blending with the stage color being performed.

We can add an private set of hints to ClutterStage, and expose accessors
for each potential hint; the first hint is the 'no-clear' one.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2058
2010-07-13 14:57:48 +01:00
Neil Roberts
984e04cae8 Make the material functions for setting the p wrap mode public
Now that we have 3D texture support it makes sense to expose the wrap
mode for the p coordinate.
2010-07-13 14:29:07 +01:00
Neil Roberts
192cfa7a58 Rename the third texure coordinate from 'r' to 'p'
Using 'r' to name the third component is problematic because that is
commonly used to represent the red component of a vector representing
a color. Under GLSL this is awkward because the texture swizzling for
a vector uses a single letter for each component and the names for
colors, textures and positions are synonymous. GLSL works around this
by naming the components of the texture s, t, p and q. Cogl already
effectively already exposes this naming because it exposes GLSL so it
makes sense to use that naming consistently. Another alternative could
be u, v and w. This is what Blender and Direct3D use. However the w
component conflicts with the w component of a position vertex.
2010-07-13 14:29:07 +01:00
Neil Roberts
cefc0e381b Add a conformance test for 3D textures
This creates a 3D texture with different colors on all of the images
and renders it using a VBO to verify that the texture coordinates can
select all of the images.
2010-07-13 14:29:02 +01:00