1
0
Fork 0
Commit graph

237 commits

Author SHA1 Message Date
Emmanuele Bassi
110489ee58 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
Neil Roberts
de114dead7 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
453697fcad 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
616c082a7c 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
de27da0e5b [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
1c114be31a 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
946c075a2a Merge branch 'master' into async-textures 2009-01-12 14:43:53 +00:00
Emmanuele Bassi
ed991fe3c5 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
2693ea3ddc [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
Chris Lord
2cea22e6a0 Update/clean and apply the async-texture patch from bug #1144 2009-01-07 17:02:43 +00:00
Neil Roberts
805b88d4c0 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
Neil Roberts
12ea2933bd [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
606d34f2aa [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
f5288b1918 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
Robert Bragg
377f114046 [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
e77a784714 [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
462c45da3c [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
bb938ac4ff 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
cb569a5443 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
aee2589cc6 [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
eb3b48e9ff 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
40b0bb4e95 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
63047e1907 [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
fa8d6dc69b Adds CoglMatrix utility code 2008-12-22 16:35:52 +00:00
Robert Bragg
ea643ca0f8 [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
Neil Roberts
e21fee39b4 Merge commit 'git-svn' into multiple-texture-rectangle 2008-12-10 12:25:25 +00:00
Neil Roberts
dc6545ccd1 * 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
9537f8e4ae 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
0bedd891fb Support cogl_texture_multiple_rectangles in GL ES backend 2008-12-09 15:10:33 +00:00
Neil Roberts
8fc949bfaf Minor fix to indentation in gl/cogl-texture.c 2008-12-09 15:01:10 +00:00
Neil Roberts
73974de482 Add gtk-doc for cogl_texture_multiple_rectangles 2008-12-09 13:20:32 +00:00
Neil Roberts
bf72b8cdc3 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
bafcfca797 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
e3f077d55f 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
98035e4d8a 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
89e7552ca3 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
55cec1f651 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
29505dd0ba 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
b312cd2d55 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
10942e8e04 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
93ea1681bb 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
ce189e7d77 * 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
8ff85615b3 * 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
Neil Roberts
21617cc0f1 Bug 1271 - mingw compiling failed: undefined reference to
`_glDrawRangeElements@24'

	Resolve glDrawRangeElements with cogl_get_proc_address instead of
	calling it directly because functions defined in GL > 1.1 are not
	directly exported under Windows.

	* clutter/cogl/common/cogl-mesh.c: Use the function pointer from
	the context

	* clutter/cogl/gl/cogl-context.c (cogl_create_context): Initialise
	function pointer.

	* clutter/cogl/gl/cogl-context.h (CoglContext): Add a function
	pointer

	* clutter/cogl/gl/cogl-defines.h.in: Add a typedef for the
	function pointer.

	* clutter/cogl/gl/cogl.c (_cogl_features_init): Resolve
	glDrawRangeElements
2008-11-21 16:18:58 +00:00
Robert Bragg
2705547469 * clutter/cogl/common/cogl-mesh.c:
Re-works validate_custom_attribute_name() so it doesn't access an
	un-initialised variable.
2008-11-18 16:24:31 +00:00
Robert Bragg
39aa5c27b5 A comparison of gl/cogl-texture.c and gles/cogl-texture.c, to reduce
differences and improve maintainability.

	* clutter/cogl/gl/cogl-context.h:
	Adds a CoglTextureGLVertex typedef + texture_vertices and
	texture_vertices_size members to CoglContext for using vertex arrays
	like GLES does

	* clutter/cogl/gl/cogl-context.c:
	Initializes texture_vertices + texture_vertices_size members

	* clutter/cogl/gl/cogl-internal.h:
	Adds COGL_ENABLE_COLOR_ARRAY

	* clutter/cogl/gl/cogl.c:
	Add COGL_ENABLE_COLOR_ARRAY support to cogl_enable

	* clutter/cogl/gles/cogl-context.h:
	Change the CoglTextureGLVertex to use GLfloat for the position
	and texture coord attributes and GLubyte for the color.

	* clutter/cogl/gles/cogl-texture-private.h:
	Adds a wrap_mode member like GL has.

	* clutter/cogl/gl/cogl-texture.c
	* clutter/cogl/gles/cogl-texture.c:
	Improves the comparability of the files, such that the remaining
	differences, better reflect the fundamental differences needed
	between GL and GLES. Notably GL no longer uses glBegin/glEnd for
	submitting vertices, it uses vertex arrays like GLES and this gives
	a small but measurable fps improvement for test-text.
2008-11-18 16:24:09 +00:00
Robert Bragg
41ec02c8b5 * clutter/cogl/gl/cogl-internal.h
* clutter/cogl/gles/cogl-internal.h:
	Removes semicolon after the GE() macro since that breaks using it as a
	single statement.
2008-11-18 16:23:40 +00:00
Emmanuele Bassi
837d17aefc 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/cogl/cogl-shader.h: Add a function for setting an
	integer uniform, similar to cogl_program_uniform_1f().

	* clutter/cogl/gl/cogl-program.c: Implement the GL version
	of cogl_program_uniform_1i().

	* clutter/cogl/gles/cogl-program.c: Implement the GLES version
	of cogl_program_uniform_1i().
2008-11-18 15:21:02 +00:00
Emmanuele Bassi
af0cb47570 2008-11-18 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1049 - Clutter doesn't support most GLSL uniforms (patch
	by Chris Lord and Neil Roberts)

	* README: Update release notes.

	* clutter/Makefile.am:
	* clutter/clutter-shader-types.[ch]: Add GValue types for
	shader values.

	* clutter/clutter-actor.[ch]: Update the shader API to use
	the newly added GValue support for GLSL shader uniform
	setters.

	* clutter/clutter-shader.[ch]: Add float and integer convenience
	API for single value GLSL uniform setters.

	* clutter/cogl/cogl-shader.h: Add new uniform setters.

	* clutter/cogl/gl/cogl-context.c:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gl/cogl-defines.h.in:
	* clutter/cogl/gl/cogl-program.c:
	* clutter/cogl/gl/cogl.c: Update the GL implementation of COGL
	to handle the GLSL uniform setters.

	* clutter/cogl/gles/cogl-gles2-wrapper.c:
	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-internal.h:
	* clutter/cogl/gles/cogl-program.c: Update the GLES 2.0 implementation
	of COGL to handle the GLSL uniform setters.

	* doc/reference/clutter/clutter-sections.txt:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/interactive/test-fbo.c:
	* tests/interactive/test-shader.c: Update the shader tests.
2008-11-18 15:08:40 +00:00
Neil Roberts
0ae150e462 * clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c:
	Initialise the 'tex' sampler uniform to 0. The GLSL spec
	specifically says that you must initialize sampler uniforms. This
	fixes texturing for GLES 2 when using the PowerVR simulator via
	software Mesa.
2008-11-13 14:44:27 +00:00
Robert Bragg
3d2a1e2d81 Gets the mesh API working with GLES2
* clutter/cogl/common/cogl-mesh.c:
	Make sure we use the appropriate cogl_wrap_gl* funcs as appropriate

	* clutter/cogl/gles/cogl-gles2-wrapper.c
	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	In our glColorPointer wrapper we needed to mark our color attribute
	as normalized.

	* tests/conform/Makefile.am:
	When creating unit test symlinks we use the -l gtester option to
	list tests, but when using the PVR SDK the test binary also spews
	out some extra info that caused lots of random symlinks to be
	created. We now grep for lines starting with a '/'

	* tests/conform/test-mesh-contiguous.c
	* tests/conform/test-mesh-mutability.c:
	Use cogl_set_source_color instead of directly calling glColor4ub
2008-11-13 14:28:16 +00:00
Emmanuele Bassi
c823bf9c83 2008-11-12 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl-path.h:
	* clutter/cogl/cogl-types.h:
	* clutter/cogl/common/cogl-color.c: Deprecated cogl_color()
	in favour of cogl_set_source_color() and friends; store the
	CoglColor components as unsigned bytes instead of fixed point
	normalized values; add functions for allocating, copying and
	freeing CoglColor, for use of language bindings.

	* clutter/cogl/cogl.h.in:
	* clutter/cogl/cogl-deprecated.h: Added cogl-deprecated.h,
	an header file containing the deprecation symbols similar
	to clutter-deprecated.h.

	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/Makefile.am:
	* clutter/cogl/gles/cogl-texture.c:
	* clutter/cogl/gles/cogl.c: Update the GL and GLES implementations
	of COGL after the CoglColor changes.

	* clutter/clutter-actor.c:
	* clutter/clutter-clone-texture.c:
	* clutter/clutter-entry.c:
	* clutter/clutter-label.c:
	* clutter/clutter-rectangle.c:
	* clutter/clutter-texture.c: Do not use CoglColor whenever it
	is possible, and use cogl_set_source_color4ub() instead.

	* clutter/pango/cogl-pango-render.c: Ditto as above.

	* doc/reference/clutter/subclassing-ClutterActor.xml:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/interactive/test-cogl-offscreen.c:
	* tests/interactive/test-cogl-primitives.c:
	* tests/interactive/test-cogl-tex-convert.c:
	* tests/interactive/test-cogl-tex-foreign.c:
	* tests/interactive/test-cogl-tex-getset.c:
	* tests/interactive/test-cogl-tex-polygon.c:
	* tests/interactive/test-cogl-tex-tile.c:
	* tests/interactive/test-paint-wrapper.c: Drop the usage of
	CoglColor whenever it is possible.
2008-11-12 13:57:58 +00:00
Neil Roberts
0ff710d37b Bug 1057 - cogl_texture_rectangle doesn't support backward
coordinates

	* clutter/cogl/gl/cogl-texture.c: Instead of sorting the vertex
	and texture coordinates passed to cogl_texture_rectangle, just
	swap both sets whenever the texture coordinates are backward.
2008-11-12 13:03:09 +00:00
Neil Roberts
f59da4d7a4 * clutter/cogl/gles/Makefile.am (libclutterinclude_HEADERS):
* clutter/cogl/gl/Makefile.am (libclutterinclude_HEADERS):
	* clutter/cogl/common/Makefile.am
	(libclutter_cogl_common_la_SOURCES): Move cogl-mesh.h into the
	headers for libclutter so that it will get installed.
2008-11-12 12:08:44 +00:00
Neil Roberts
1fd2156a99 Fix warnings in mesh tests
* tests/conform/test-mesh-mutability.c (on_paint):
	* tests/conform/test-mesh-interleved.c (on_paint):
	* tests/conform/test-mesh-contiguous.c (on_paint): Use g_usleep
	instead of sleep

	* tests/conform/test-mesh-mutability.c (queue_redraw):
	* tests/conform/test-mesh-interleved.c (queue_redraw):
	* tests/conform/test-mesh-contiguous.c (queue_redraw): Added
	missing return statement

	* clutter/cogl/cogl-mesh.h: Add a declaration for
	cogl_mesh_submit

	* clutter/cogl/common/cogl-mesh.c (cogl_mesh_submit): Move the
	documentation to cogl-mesh.h to match the rest of the functions
2008-11-12 10:55:06 +00:00
Robert Bragg
16897e0729 Bug 1164 - Implements the proposed Mesh API
* clutter/cogl/cogl-mesh.h
	* clutter/cogl/cogl-types.h
	* clutter/cogl/cogl.h.in
	* clutter/cogl/common/Makefile.am
	* clutter/cogl/common/cogl-mesh-private.h
	* clutter/cogl/common/cogl-mesh.c
	* clutter/cogl/gl/cogl-context.c
	* clutter/cogl/gl/cogl-context.h
	* clutter/cogl/gl/cogl-defines.h.in
	* clutter/cogl/gl/cogl.c
	* clutter/cogl/gles/cogl-context.c
	* clutter/cogl/gles/cogl-context.h
	* doc/reference/cogl/cogl-docs.sgml
	* doc/reference/cogl/cogl-sections.txt:
	The Mesh API provides a means for submitting an extensible number of
	per vertex attributes to OpenGL in a way that doesn't require format
	conversions and so that the data can be mapped into the GPU (in vertex
	buffer objects) for - hopefully - fast re-use.

	There are a number of things we can potentially use this API for, but
	right now this just provides a foundation to build on. Please read
	the extensive list of TODO items in cogl-mesh.c for examples.

	Please refer to the cogl-mesh section in the reference manual for
	documentation of the API.

	* tests/conform/Makefile.am
	* tests/conform/test-conform-main.c
	* tests/conform/test-mesh-contiguous.c
	* tests/conform/test-mesh-interleved.c
	* tests/conform/test-mesh-mutability.c:
	Privides basic coverage testing for the mesh API.
2008-11-10 18:53:14 +00:00
Neil Roberts
f7d447cfde * clutter/cogl/gles/cogl.c (cogl_perspective):
* clutter/cogl/common/cogl-fixed.c (cogl_fixed_sin)
	(cogl_angle_sin, cogl_angle_tan, cogl_fixed_sqrt): Replaced uses
	of 1 + ~x with just -x which is equivalent and easier to
	understand.
2008-11-06 11:42:11 +00:00
Neil Roberts
a15ae21bd2 * clutter/cogl/gl/cogl.c (cogl_perspective): Use the accurate
64-bit multiplication macro instead of COGL_FIXED_FAST_DIV for
	calculating xmax as was done previously. This fixes
	test-perspective and other tests that had a gone a bit skewiff.
2008-11-04 12:43:06 +00:00
Emmanuele Bassi
e3788338e4 2008-11-03 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/cogl/gl/Makefile.am: Whitespace fixes.

	* clutter/cogl/gles/Makefile.am: Put back a missing backslash
	that broke the GLES build.
2008-11-03 23:58:13 +00:00
Emmanuele Bassi
7393c6a463 2008-11-03 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1231 - Build fails in gles flavour in revision 3442

	* clutter/cogl/gles/cogl-context.h: Fix remaining use of
	ClutterFixed over CoglFixed. (Michael Boccara)
2008-11-03 23:54:38 +00:00
Emmanuele Bassi
d30c52ffd4 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl-fixed.h:
	* clutter/cogl/cogl-offscreen.h:
	* clutter/cogl/cogl-path.h:
	* clutter/cogl/cogl-shader.h:
	* clutter/cogl/cogl-texture.h:
	* clutter/cogl/cogl-types.h: Add copyright and licensing
	notice to the newly added files.
2008-10-30 17:57:41 +00:00
Emmanuele Bassi
90f4b1d492 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1219 - Clean up cogl.h

	* clutter/cogl/cogl.h.in:
	* clutter/cogl/cogl-offscreen.h:
	* clutter/cogl/cogl-path.h:
	* clutter/cogl/cogl-shader.h:
	* clutter/cogl/cogl-texture.h:
	* clutter/cogl/cogl-types.h: Split up the massive cogl.h file
	into sub-header for each section of the API.

	* clutter/cogl/gl/*:
	* clutter/cogl/gles/*: Update the GL and GLES implementations
	of COGL to cope with the new header structure.

	* doc/reference/cogl/Makefile.am: Fix symbol retrieval.
2008-10-30 17:25:00 +00:00
Emmanuele Bassi
a32eca26b6 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1212 - Allow only a single include file for Clutter

	* clutter/*.h: Only allow including clutter.h in third
	party code.

	* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl-fixed.h:
	* clutter/cogl/cogl.h.in: Only allow including cogl.h in
	third party code.

	* clutter/cogl/common/Makefile.am:
	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gles/Makefile.am:
	* clutter/eglnative/Makefile.am:
	* clutter/eglx/Makefile.am:
	* clutter/fruity/Makefile.am:
	* clutter/glx/Makefile.am:
	* clutter/glx/clutter-glx.h:
	* clutter/osx/Makefile.am:
	* clutter/pango/Makefile.am:
	* clutter/sdl/Makefile.am:
	* clutter/win32/Makefile.am:
	* clutter/x11/Makefile.am: Fix build environment.

	* clutter/x11/clutter-x11-texture-pixmap.h:
	* clutter/x11/clutter-x11.h: Fix inclusion rules.

	* tests/test-pixmap.c: Fix inclusion of GdkPixbuf header.

	* README: Update release notes.
2008-10-30 17:04:34 +00:00
Emmanuele Bassi
36e30239af 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1211 - Drop ClutterFeatureFlags usage from COGL

	* clutter/cogl/cogl.h.in:
	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/cogl.c: Do not use ClutterFeatureFlags
	when CoglFeatureFlags will do. This removes the last usage
	of Clutter API inside COGL.
2008-10-30 16:52:56 +00:00
Emmanuele Bassi
a547cdbc4d 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1210 - Add CoglColor API

	* clutter/cogl/cogl-color.h:
	* clutter/cogl/cogl.h.in:
	* clutter/cogl/common/Makefile.am:
	* clutter/cogl/common/cogl-color.c:
	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/Makefile.am:
	* clutter/cogl/gles/cogl-texture.c:
	* clutter/cogl/gles/cogl.c: Add a new color-type, to be used by
	COGL. CoglColor is optimized to allow the minimum amount of
	conversions possible for both GL and GLES implementations.

	* clutter/clutter-actor.c:
	* clutter/clutter-clone-texture.c:
	* clutter/clutter-entry.c:
	* clutter/clutter-main.c:
	* clutter/clutter-rectangle.c:
	* clutter/clutter-stage.c:
	* clutter/clutter-texture.c: Use CoglColor when needed.

	* clutter/pango/pangoclutter-render.c: Use CoglColor when needed.

	* doc/reference/cogl/cogl-docs.sgml:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/test-cogl-offscreen.c:
	* tests/test-cogl-primitives.c:
	* tests/test-cogl-tex-convert.c:
	* tests/test-cogl-tex-foreign.c:
	* tests/test-cogl-tex-getset.c:
	* tests/test-cogl-tex-polygon.c:
	* tests/test-cogl-tex-tile.c:
	* tests/test-paint-wrapper.c: Update the tests.

	* README: Update release notes.
2008-10-30 16:50:07 +00:00
Emmanuele Bassi
911b395c8a 2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1209 - Move fixed point API in COGL

	* clutter/cogl/cogl-fixed.h:
	* clutter/cogl/cogl.h.in:
	* clutter/cogl/common/Makefile.am:
	* clutter/cogl/common/cogl-fixed.c: Add fixed point API, modelled
	after the ClutterFixed. The CoglFixed API supercedes the ClutterFixed
	one and avoids the dependency of COGL on Clutter's own API.

	* clutter/cogl/common/cogl-clip-stack.c:
	* clutter/cogl/common/cogl-primitives.c:
	* clutter/cogl/common/cogl-primitives.h: Update internal usage of
	ClutterFixed to CoglFixed.

	* clutter/cogl/gl/Makefile.am:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c: Ditto, in the GL implementation of the
	COGL API.

	* clutter/cogl/gles/Makefile.am:
	* clutter/cogl/gles/cogl-fbo.c:
	* clutter/cogl/gles/cogl-gles2-wrapper.c:
	* clutter/cogl/gles/cogl-primitives.c:
	* clutter/cogl/gles/cogl-texture.c:
	* clutter/cogl/gles/cogl.c: Ditto, in the GLES implementation of
	the COGL API.

	* clutter/pango/pangoclutter-glyph-cache.c:
	* clutter/pango/pangoclutter-glyph-cache.h: Ditto, in the Pango
	renderer glyphs cache.

	* clutter/clutter-fixed.c:
	* clutter/clutter-fixed.h: ClutterFixed and related API becomes
	a simple transition API for bindings and public Clutter API.

	* clutter/clutter-actor.c:
	* clutter/clutter-alpha.c:
	* clutter/clutter-backend.c:
	* clutter/clutter-behaviour-depth.c:
	* clutter/clutter-behaviour-ellipse.c:
	* clutter/clutter-behaviour-path.c:
	* clutter/clutter-behaviour-rotate.c:
	* clutter/clutter-behaviour-scale.c:
	* clutter/clutter-clone-texture.c:
	* clutter/clutter-color.c:
	* clutter/clutter-entry.c:
	* clutter/clutter-stage.c:
	* clutter/clutter-texture.c:
	* clutter/clutter-timeline.c:
	* clutter/clutter-units.h: Move from the internal usage of
	ClutterFixed to CoglFixed.

	* doc/reference/clutter/clutter-sections.txt:
	* doc/reference/cogl/cogl-docs.sgml:
	* doc/reference/cogl/cogl-sections.txt: Update the documentation.

	* tests/test-cogl-tex-tile.c:
	* tests/test-project.c: Fix tests after the API change

	* README: Add release notes.
2008-10-30 16:37:55 +00:00
Neil Roberts
04ce490c0a Bug 1074 - FBOs on GLES
* clutter/cogl/gles/cogl-fbo.c: Copy the code from gl/cogl-fbo but
	use the API calls directly instead of loading an extension because
	it is part of the core in GLES 2.

	* clutter/cogl/gles/cogl.c (_cogl_features_init): Report
	COGL_FEATURE_OFFSCREEN.

	* clutter/cogl/gles/cogl-fbo.h (CoglFbo): Add gl_stencil_handle.

	* clutter/cogl/gles/cogl-context.h (CoglContext): Add
	viewport_store

	* tests/test-fbo.c (make_shader): Conditionally use the GLES 2
	names of the shader variables
2008-10-29 14:52:48 +00:00
Neil Roberts
82d43ffe64 Bug 1189 - Backface culling
* clutter/cogl/gl/cogl-texture.c (cogl_texture_polygon)
	(_cogl_texture_quad_sw, _cogl_texture_quad_hw):
	* clutter/cogl/gles/cogl-texture.c (cogl_texture_polygon)
	(_cogl_texture_quad_sw, _cogl_texture_quad_hw): Enable backface
	culling in GL if it is requested.

	* clutter/cogl/gles/cogl-texture.c (_cogl_texture_quad_sw)
	(_cogl_texture_quad_hw):
	* clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw)
	(_cogl_texture_quad_hw): Reorder the
	vertices so that they are counter-clockwise.

	* clutter/cogl/gles/cogl-context.h (CoglContext): 
	* clutter/cogl/gl/cogl-context.h (CoglContext): Added a flag to
	store whether backface culling is currently enabled.

	* clutter/cogl/gles/cogl.c (cogl_enable_backface_culling): 
	* clutter/cogl/gl/cogl.c (cogl_enable_backface_culling): New
	function

	* doc/reference/cogl/cogl-sections.txt: Add
	cogl_enable_backface_culling
2008-10-27 14:36:52 +00:00
Neil Roberts
e43b7ddd3d Bug 1196 - Texture border drawing problems
* clutter/cogl/gl/cogl-texture.c (_cogl_texture_upload_subregion_to_gl)
	(_cogl_texture_upload_to_gl):

	* clutter/cogl/gles/cogl-texture.c (_cogl_texture_upload_to_gl)
	(_cogl_texture_upload_subregion_to_gl):
	
	When uploading data to a sliced texture, fill the waste pixels
	with copies of the edge of the real texture data. Otherwise the
	value of the waste pixels are undefined so it will show artifacts
	when the texture is scaled with GL_LINEAR and the pixels are
	blended in.
2008-10-27 12:39:22 +00:00
Neil Roberts
96c1a8543d Bug 1043 - COGL calls glTexSubImage2D() with out-of-bounds
values (SIGSEGV)

	* clutter/cogl/gl/cogl-texture.c
	(_cogl_texture_upload_subregion_to_gl): When iterating over the
	slices, discard ones that don't intersect immediatly otherwise it
	will call glTexSubImage2D with a negative width/height and then
	move the source position incorrectly. Thanks to Gwenole
	Beauchesne.
2008-10-20 15:54:17 +00:00
Neil Roberts
50a248764c Bug 1048 - SIGFPE in cogl_texture_set_region() with nvidia
* clutter/cogl/gl/cogl-texture.c (cogl_texture_set_region):
	* clutter/cogl/gles/cogl-texture.c (cogl_texture_set_region):
	Don't attempt to upload any data if the width or height of the
	subregion is zero. Thanks to Gwenole Beauchesne.
2008-09-18 13:16:15 +00:00
Neil Roberts
76faa8c7a6 Bug 1044 - cogl_get_viewport error
* clutter/cogl/gles/cogl.c (cogl_get_viewport): Use glGetIntegerv
	instead of glGetFixedv to read the viewport because the latter
	converts incorrectly on some hardware.
2008-09-18 11:24:27 +00:00
Emmanuele Bassi
0515ee22c2 2008-08-27 Emmanuele Bassi <ebassi@openedhand.com>
Bug 1082 - Texture bitmap is destroyed in wrong way

	* clutter/cogl/common/cogl-bitmap-pixbuf.c:
	(_cogl_bitmap_from_file): Make a copy of the pixbuf data in
	the internal image loader so that we can keep working under
	the assumption that we are using the GLib memory allocation
	and deallocation functions.
2008-08-27 12:56:54 +00:00
Neil Roberts
db4c5e2829 Bug 945 - Clipping+fbo cloning bugs
* clutter/cogl/gl/cogl.c: 
	* clutter/cogl/gles/cogl.c: 
	* clutter/cogl/cogl.h.in: Add cogl_clip_stack_save,
	cogl_clip_stack_restore, cogl_viewport and cogl_frustum.

	* clutter/cogl/gl/cogl-fbo.h: 
	* clutter/cogl/gl/cogl-fbo.c: Try to attach a stencil buffer when
	creating an FBO.

	* clutter/cogl/common/cogl-clip-stack.c: Add functions to save and
	restore the whole state of the stack.

	* clutter/clutter-texture.c (clutter_texture_paint): When
	rendering the FBO source, setup a temporary asymmetric perspective
	projection matrix to render it as it would appear on screen.

	* clutter/clutter-private.h: 
	* clutter/clutter-actor.c
	(_clutter_actor_apply_modelview_transform_recursive): No longer
	static and exported in clutter-private.h
2008-08-01 12:23:57 +00:00
Neil Roberts
9fbdee463d * clutter/cogl/common/cogl-primitives.c (cogl_path_rel_curve_to):
Fixed a typo in the second parameter which meant the curve was
	drawn incorrectly.
2008-07-14 19:22:17 +00:00
Matthew Allum
34329a1ffb 008-07-10 Matthew Allum <mallum@openedhand.com>
* clutter/cogl/gles/cogl-fbo.c:
        * clutter/cogl/gles/cogl-texture.c:
        Fix warnings with eglnative build
2008-07-10 16:19:09 +00:00
Øyvind Kolås
60341ad959 * clutter/cogl/common/cogl-bitmap-pixbuf.c:
(_cogl_bitmap_from_file): removed debug g_printf that announces each
successful image load done by the internal image backend.
2008-07-03 09:49:06 +00:00
Neil Roberts
604990a53b Bug 985 - MSC math.h / M_PI issue
* clutter/cogl/gl/cogl.c (set_clip_plane): 
	* clutter/clutter-alpha.c (sinc_func): Use G_PI instead of M_PI
	because M_PI isn't defined in MSVC without a special
	#define. Thanks to Haakon Sporsheim
2008-06-30 16:15:53 +00:00
Emmanuele Bassi
edca282ad0 2008-06-30 Emmanuele Bassi <ebassi@openedhand.com>
Bug 980 - cogl-bitmap-fallback.c compiler error/warning due to
	          cast issue (Haakon Sporsheim)

	* clutter/cogl/common/cogl-bitmap-fallback.c:
	(_cogl_unpremult_alpha_last),
	(_cogl_unpremult_alpha_first): Cast to avoid a compiler warning
	with MSC.
2008-06-30 14:20:46 +00:00
Matthew Allum
03d7fdacd6 2008-06-27 Matthew Allum <mallum@openedhand.com>
* clutter/cogl/gl/cogl.c:
        Temp workaround for 10.4 ATI card OSX folks, see #929
        (Tommi Komulainen)

        Bug 998 - clutter always captures X input events

* clutter/eglx/clutter-stage-egl.c:
        * clutter/glx/clutter-stage-glx.c:
When we disable X event retrival, dont still select for window
events.
2008-06-27 23:02:30 +00:00
Neil Roberts
d4da3a3e2a * clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-gles2-wrapper.c: All of the settings and
	uniforms are now proxied into COGL variables instead of setting
	the GL uniforms directly. Just before glDrawArrays is executed a
	shader is generated using the given settings to avoid using 'if'
	statements. The shaders are cached.

	* clutter/cogl/gles/cogl-fixed-vertex-shader.glsl: 
	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: The shaders
	are now split into parts using comments instead of 'if' statements
	so that the simplest shader can be generated on the fly.

	* clutter/cogl/gles/stringify.sh: Now splits up the shader sources
	into separate C strings where deliminated by special comments.

	* clutter/cogl/gles/cogl-program.h: 
	* clutter/cogl/gles/cogl-program.c: A custom shader can no longer
	be directly linked with the fixed-functionality replacement
	because the replacement changes depending on the settings. Instead
	the bound shader is linked with the appropriate replacement shader
	just before glDrawArrays is executed. The custom uniform variables
	must also be proxied through COGL variables because their location
	can change when relinked.
2008-06-24 16:21:40 +00:00
Emmanuele Bassi
300d1ef025 Fixes for distcheck 2008-06-23 16:43:49 +00:00
Neil Roberts
dff84094ff Bug 918 - Group doesn't clip if it's children are clipped
* clutter/cogl/common/cogl-clip-stack.h: 
	* clutter/cogl/common/cogl-clip-stack.c: Added functions to
	maintain a stack of clipping rectangles.

	* clutter/cogl/gles/cogl.c: 
	* clutter/cogl/gl/cogl.c: The cogl_clip_set and unset functions
	have moved into cogl-clip-stack.c which calls back to cogl.c to
	set the actual rectangles. Multiple clip rectangles are combined
	by merging the stencil buffers.

	* clutter/cogl/gles/cogl-primitives.c (_cogl_path_fill_nodes): 
	* clutter/cogl/gl/cogl-primitives.c (_cogl_path_fill_nodes): Merge
	the stencil buffer with the contents of the clipping stack after
	drawing the path.

	* clutter/cogl/gles/cogl-context.h (CoglContext): 
	* clutter/cogl/gl/cogl-context.h (CoglContext): Store the number
	of available stencil bits.

	* clutter/cogl/common/Makefile.am
	(libclutter_cogl_common_la_SOURCES): Added cogl-clip-stack.c
2008-06-23 14:57:36 +00:00
Emmanuele Bassi
d9b657bdfc 2008-06-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug 982 - __COGL_GET_CONTEXT MS compiler issue (Haakon Sporsheim)

	* clutter/cogl/common/cogl-handle.h:
	* clutter/cogl/common/cogl-primitives.c: Remove C99-isms.

	* clutter/cogl/gl/cogl-fbo.c:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gl/cogl.c: Ditto as above.

	* clutter/cogl/gles/cogl-fbo.c:
	* clutter/cogl/gles/cogl-primitives.c:
	* clutter/cogl/gles/cogl-texture.c: Ditto as above.
2008-06-23 11:01:30 +00:00
Matthew Allum
6fe23fefe9 Revert miscommit of unfinished cogl changes in r2920 2008-06-14 22:07:23 +00:00
Matthew Allum
04bf04db4d 2008-06-14 Matthew Allum <mallum@openedhand.com>
* README:
        Make needed GL version 1.4, note GLES2 support, add some notes
        for COGL.
2008-06-13 23:03:45 +00:00
Emmanuele Bassi
a4c4e3464d 2008-06-12 Emmanuele Bassi <ebassi@openedhand.com>
* doc/reference/cogl/Makefile.am: Ignore cogl/gl and cogl/gles
	when building the documentation.

	* clutter/cogl/cogl.h.in: Add sections in the header file.
2008-06-12 17:21:16 +00:00
Chris Lord
db518c8736 * clutter/cogl/common/cogl-primitives.c: (_cogl_path_arc):
Draw as expected when end angle is lower than start angle (i.e. do not
        swap the angles). This aligns with cairo behaviour.
2008-06-10 10:05:12 +00:00
Tommi Komulainen
78e1f63fcd cogl: add support for quartz imagebackend
Bug #930 - add support for quartz imagebackend

	* clutter/cogl/common/cogl-bitmap-pixbuf.c
	(_cogl_bitmap_from_file): When USE_QUARTZ is defined implement
	using Core Graphics.
	* configure.ac: support --with-imagebackend=quartz and print
	which imagebackend is selected. Make quartz default on OSX
2008-06-09 21:15:12 +00:00
Øyvind Kolås
a28e51d752 * clutter/cogl/common/cogl-primitives.c: (cogl_path_rel_curve_to):
fixed naming of implementation of cogl_path_rel_curve_to (it was
called just cogl_rel_curve_to).
2008-06-09 16:14:06 +00:00
Neil Roberts
1bfeddaaee * clutter/eglnative/clutter-stage-egl.c
(clutter_stage_egl_realize): Use ES 2 renderable type when
	building for GLES 2.

	* clutter/eglnative/clutter-event-egl.c (get_backend_time): Added
	a NULL for the microseconds parameter of g_timer_elapsed.

	* clutter/eglnative/clutter-stage-egl.h: 
	* clutter/eglnative/clutter-egl.h: 
	* clutter/eglnative/clutter-backend-egl.h: Include
	clutter-egl-headers.h instead of including the GL headers directly
	so it can include gl2.h when building for GLES 2.

	* clutter/eglnative/clutter-egl-headers.h: 
	* clutter/eglnative/Makefile.am (libclutter_eglnative_la_SOURCES):
	Added clutter-egl-headers.h

	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: GLES 2
	doesn't provide a default precision for floats in the fragment
	shader and it will reject the shader if there isn't one.
2008-06-06 14:21:22 +00:00
Matthew Allum
9d8bfaf997 2008-06-06 Matthew Allum <mallum@openedhand.com>
Bug #948 - Remove texture rectangle support

        * clutter/clutter-feature.c:
        * clutter/clutter-feature.h:
        * clutter/clutter-texture.c:
        * clutter/cogl/gl/cogl.c:
* clutter/glx/clutter-glx-texture-pixmap.c:
        Remove support for GL_TEXTURE_RECTANGLE_ARB (now using just regular
        2D textures, with optional npots extension). Simplifys code, + makes
        mipmap & shader support much more sane.
2008-06-06 13:44:22 +00:00
Øyvind Kolås
7804ce7d1a * clutter/cogl/common/cogl-bitmap-pixbuf.c:
(_cogl_bitmap_from_file): allocate height×rowstride and not duplicate
gdkpixbuf's strange optimization saving some bytes at the end of the
pixbuf.
2008-06-06 12:53:35 +00:00
Tommi Komulainen
3d034ff6aa cogl: define GL_READ/DRAW_FRAMEBUFFER_EXT if not available
Bug 913 - cogl fails to build on OSX

	* clutter/cogl/gl/cogl-fbo.c: define GL_READ_FRAMEBUFFER_EXT and
	GL_DRAW_FRAMEBUFFER_EXT if not defined in the build system. The
	#ifdef can fail if they're not #defines but variables or enums.
	As the values are supposed to be industry standard even then
	it shouldn't have ill effects.
2008-06-05 21:40:59 +00:00
Neil Roberts
8bdb98736d Applied 'final patch' from bug #874
* clutter/cogl/gles/cogl.c:
	* clutter/cogl/gl/cogl.c: The clip planes are now set using the
	inverse projection matrix as the modelview matrix so that they can
	be specified in screen coordinates.

	* clutter/cogl/gles/cogl-context.h (CoglContext):
	* clutter/cogl/gl/cogl-context.h (CoglContext): Added a member to
	cache the inverse projection matrix

	* clutter/clutter-fixed.h: Added a constant for converting from
	radians to degrees.

	* clutter/clutter-fixed.c (clutter_atani, clutter_atan2i): Added
	fixed-point versions of atan and atan2.

	* tests/test-clip.c: Added a test for clipping with various
	rotations and depths.

	* tests/Makefile.am (noinst_PROGRAMS): Added test-clip
2008-06-02 12:34:10 +00:00
Neil Roberts
42ed195f01 * clutter/cogl/gles/cogl-gles2-wrapper.h: The uniform numbers are
now stored in a separate struct so they can be stored for
	application program objects as well.

	* clutter/cogl/gles/cogl.c: Moved stub shader functions into
	separate files.
	(_cogl_features_init): Report support for the shaders feature on
	GLES 2

	* clutter/cogl/gles/cogl-shader.h:
	* clutter/cogl/gles/cogl-shader.c:
	* clutter/cogl/gles/cogl-program.h:
	* clutter/cogl/gles/cogl-program.c: Separate files to handle
	shaders on programs on GLES. If version 1.1 is being used then the
	stub functions which all fail are still used.

	* clutter/cogl/gles/cogl-gles2-wrapper.c
	(cogl_gles2_wrapper_init, cogl_gles2_wrapper_bind_attributes),
	(cogl_gles2_wrapper_get_uniforms): Move the uniforms and attribute
	bindings into a separate function so they can be used to bind on
	application shaders as well.
	(cogl_gles2_wrapper_update_matrix): Now takes a parameter and is
	no longer static so that it can be used to update all of the
	matrices when a new shader is bound.

	* clutter/cogl/gles/cogl-defines.h.in: Use GL_COMPILE_STATUS for
	CGL_OBJECT_COMPILE_STATUS if the latter isn't available (for
	example on GLES 2).

	* clutter/cogl/gles/cogl-context.h (CoglContext): Added handle
	arrays for programs and shaders.

	* clutter/cogl/gles/cogl-context.c (cogl_create_context)
	(cogl_destroy_context): Initialize and destroy program and shader
	handle array.

	* clutter/cogl/gles/Makefile.am (libclutter_cogl_la_SOURCES): Add
	cogl-{shader,program}.{c,h}
2008-06-02 10:58:57 +00:00
Neil Roberts
de49189c9f * clutter/cogl/gl/cogl-context.c (cogl_destroy_context): Fix
cut-and-paste error where the wrong arrays were being freed.
2008-06-02 09:35:43 +00:00
Neil Roberts
71133b3d0e * clutter/cogl/gles/cogl-gles2-wrapper.h (CoglGles2Wrapper): Added
uniforms for alpha testing.

	* clutter/cogl/gles/cogl-gles2-wrapper.c
	(cogl_gles2_wrapper_init): Get the uniforms for alpha testing
	settings.
	(cogl_wrap_glEnable, cogl_wrap_glDisable): Enable/disable alpha
	testing.
	(cogl_wrap_glAlphaFunc): Filled in the wrapper.

	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: Added alpha
	testing.

	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-gles2-wrapper.c
	(cogl_wrap_glGetIntegerv): Added a wrapper for glGetIntegerv so
	that it can report zero clip planes.

	* clutter/cogl/gles/cogl.c:
	* clutter/cogl/gles/cogl-texture.c: Use the wrapped version of
	glGetIntegerv

	* clutter/cogl/gles/cogl-primitives.c (_cogl_path_fill_nodes): Use
	_cogl_features_available to check for the stencil buffer instead
	of an #ifdef. The stencil buffer is available in the default
	profile for the GLES 2 simulator.
2008-05-29 13:29:04 +00:00
Neil Roberts
8d7bf93909 * clutter/cogl/gles/cogl-gles2-wrapper.c
(cogl_gles2_wrapper_init): Get uniforms for fog parameters and
    	initialise them.
    	(cogl_wrap_glDrawArrays): Store the modelview matrix in a uniform
    	as well so that it can be used for fogging calculations.
    	(cogl_wrap_glEnable, cogl_wrap_glDisable): Enable/disable fogging.
    	(cogl_wrap_glFogx, cogl_wrap_glFogxv): Fill in wrapper to set
    	fogging parameters.

    	* clutter/cogl/gles/cogl-fixed-vertex-shader.glsl: Calculate the
    	fog amount if fogging is enabled.

    	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl: Mix with fog
    	color.

    	* clutter/cogl/gles/cogl-gles2-wrapper.h (CoglGles2Wrapper): Add
    	uniforms for fogging.
2008-05-28 17:14:17 +00:00
Neil Roberts
717d9768ed * clutter/cogl/gles/Makefile.am: Use old-style Makefile rules for
the stringify script so that automake won't complain.
2008-05-28 13:17:03 +00:00