Commit Graph

89 Commits

Author SHA1 Message Date
Neil Roberts
10d7cf3273 Bug 1172 - Disjoint paths and clip to path
* clutter/cogl/cogl-path.h:
	* clutter/cogl/common/cogl-primitives.c:
	* clutter/cogl/common/cogl-primitives.h:
	* clutter/cogl/gl/cogl-primitives.c:
	* clutter/cogl/gles/cogl-primitives.c: Changed the semantics of
	cogl_path_move_to. Previously this always started a new path but
	now it instead starts a new disjoint sub path. The path isn't
	cleared until you call either cogl_path_stroke, cogl_path_fill or
	cogl_path_new. There are also cogl_path_stroke_preserve and
	cogl_path_fill_preserve functions.

	* clutter/cogl/gl/cogl-context.c:
	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gles/cogl-context.c:
	* clutter/cogl/gles/cogl-context.h: Convert the path nodes array
	to a GArray.

	* clutter/cogl/gl/cogl-texture.c:
	* clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure

	* clutter/cogl/common/cogl-clip-stack.c:
	* clutter/cogl/common/cogl-clip-stack.h: Simplified the clip
	stack code quite a bit to make it more maintainable.  Previously
	whenever you added a new clip it would go through a separate route
	to immediately intersect with the current clip and when you
	removed it again it would immediately rebuild the entire clip. Now
	when you add or remove a clip it doesn't do anything immediately
	but just sets a dirty flag instead.

	* clutter/cogl/gl/cogl.c:
	* clutter/cogl/gles/cogl.c: Taken away the code to intersect
	stencil clips when there is exactly one stencil bit. It won't work
	with path clips and I don't know of any platform that doesn't have
	eight or zero stencil bits. It needs at least three bits to
	intersect a path with an existing clip. cogl_features_init now
	just decides you don't have a stencil buffer at all if you have
	less than three bits.

	* clutter/cogl/cogl.h.in: New functions and documentation.

	* tests/interactive/test-clip.c: Replaced with a different test
	that lets you add and remove clips. The three different mouse
	buttons add clips in different shapes. This makes it easier to
	test multiple levels of clipping.

	* tests/interactive/test-cogl-primitives.c: Use
	cogl_path_stroke_preserve when using the same path again.

	* doc/reference/cogl/cogl-sections.txt: Document the new
	functions.
2008-12-04 13:45:09 +00:00
Neil Roberts
be655b05ad Bug 1305 - NPOT textures unaligned to a pixel sometimes have
border artifacts

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

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

	This is used in _cogl_texture_quad_hw to only enable GL_REPEAT
	mode when the coordinates are not in the range [0,1]. Otherwise it
	can pull in pixels from the other edge when the texture is
	rendered off-pixel.
2008-12-01 16:27:54 +00:00
Neil Roberts
f4465ccb05 * clutter/cogl/gl/cogl-texture.c (cogl_texture_rectangle): Fixed
the test for whether to use hardware tiling. Previously it assumed
	that texture coordinates are in increasing order but this is not
	the case since bug 1057 was fixed. The texture coordinates are now
	sorted later. It also allowed negative coordinates which doesn't
	make sense if the texture has waste.
2008-11-26 16:35:25 +00:00
Neil Roberts
50b6ecc56d * clutter/cogl/gl/cogl-texture.c (cogl_texture_polygon): Fix the
equation for calculating texture coordinates when using sliced
	textures. This became broken in revision 3520.
2008-11-24 12:27:48 +00:00
Neil Roberts
d741f67cfc 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
8b557c6c13 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
6731dfa468 * 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
e733889655 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
2142062ba1 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
Emmanuele Bassi
536347be69 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
a55b588b30 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
ba1cab0a62 * 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
Robert Bragg
1e68a8d59e 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
a41624276c * 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
54cecff923 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
1bcdf7d9eb 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
90dbfcd78f 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
f26827c7d1 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
d1f6dbaa79 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
71a0be6fff 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
153f5ea73f 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
c8b4de2d6d 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
ae1a4a6a30 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
238e9c3a1a 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
ef76d8e5e2 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
add02e70a3 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
Matthew Allum
2666778c26 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
7c69ca2997 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
76b5a93afa 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
c468bdb564 Revert miscommit of unfinished cogl changes in r2920 2008-06-14 22:07:23 +00:00
Matthew Allum
6fe15aefb0 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
Matthew Allum
04845aa9c9 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
Tommi Komulainen
93abcf9595 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
e306b0135c 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
46be48f8f6 * 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
Emmanuele Bassi
e50099a206 2008-05-23 Emmanuele Bassi <ebassi@openedhand.com>
Bug #912 - Invalid use of int* as parameter for glGetIntegerv

	* clutter/cogl/gl/cogl.c (_cogl_features_init): Use GLint
	instead of int. (#912, Tommi Komulainen)
2008-05-23 15:23:40 +00:00
Neil Roberts
eccd9399e5 * clutter/cogl/gl/cogl.c (error_string):
* clutter/cogl/gles/cogl.c (error_string): Rename to
	_cogl_error_string and remove the static scoping so that it can be
	called in cogl-texture etc.

	* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign):
	* clutter/cogl/gles/cogl-texture.c (cogl_texture_new_from_foreign):
	GE(*) can't be used to wrap around calls that use the return
	value.

	* clutter/cogl/gl/cogl-texture.c (_cogl_texture_quad_sw)
	(_cogl_texture_quad_hw, cogl_texture_polygon): Remove GE(*)
	wrapper around calls in the middle of a glBegin/glEnd pair which
	otherwise always generate an error because glGetError can only be
	called outside of the pair.

	* clutter/cogl/gl/cogl-internal.h: Include stdio.h when definig
	COGL_DEBUG and declare a prototype for _cogl_error_string.

	* clutter/cogl/gles/cogl-internal.h: Match GE(*) macro to GL
	version.
2008-05-21 13:20:33 +00:00
Ivan Leben
006573ac61 * clutter/cogl/gles/cogl-texture.c:
(cogl_texture_download_from_gl:) Store old blending factors
	and restore them when done. The lack of ability to retrieve
	the alpha channel now more noticable in test-cogl-tex-getset
	since the edges of the hand are not antialiased.

	* clutter/cogl/gl(es)/cogl-internal.h: Declare
	cogl_blend_func to avoid "implicit implementation" compile
	warning.
2008-05-19 15:21:56 +00:00
Ivan Leben
d049d9ead4 * clutter/cogl/gl(es)/cogl.c: New internal function
cogl_blend_func caches blending setup much like cogl_enable
	does with the enable flags. This separates blending factors
	setup from the enable/disable operation in preparation of
	the texture image retrieval fix for alpha channel on GLES.
	(cogl_enable:) Does not modify blending factors anymore.

	* clutter/cogl/gl(es)/cogl-context.h: CoglContext holds two
	new variables to cache blending src and dst factors.

	* clutter/cogl/gl(es)/cogl-context.c:
	(cogl_create_context:) Initialize blending factors.

	* clutter/cogl/gles/cogl-texture.c:
	(cogl_texture_download_from_gl:) Set blending factors to
	CGL_ONE, CGL_ZERO which fixes the slighlty improper behavior
	where source colour was actually multiplied with its alpha
	value in the result (not noticable on current tests).
2008-05-19 15:02:27 +00:00
Neil Roberts
ae444ad679 Use the Mesa headers instead of depending on GLee for Win32
builds.

	* configure.ac: No longer check for GLee

	* clutter/cogl/gl/cogl-defines.h.in: Don't bother including GLee.h

	* build/mingw/mingw-cross-compile.sh: No longer downloads libGLee
	but downloads the Mesa library instead and installs the headers
	from that. Fixed the libpng version.
2008-05-16 11:09:59 +00:00
Ivan Leben
02ab70efc8 * clutter/cogl/gl/cogl-defines.h.in:
Fix GL function prototypes on OS X by #definining APIENTRY and
	APIENTRYP if missing.
2008-05-13 04:56:06 +00:00
Ivan Leben
3a3712d924 * clutter/cogl/gl/cogl-defines.h.in:
Defined GL extension functions used by Cogl inside the COGL_
	namespace.

	* clutter/cogl/gl/cogl-context.h:
	* clutter/cogl/gl/cogl.c:
	Use COGL_ extension function prototypes instead of relying
	on glext.h to define them. Should fix the mac compilability
	bug, but haven't tested it yet.
2008-05-12 17:20:22 +00:00
Ivan Leben
b9827fb945 * clutter/cogl/cogl.h.in:
* clutter/cogl/gl(es)/cogl-texture.h:
	* clutter/cogl/gl(es)/cogl-texture.c:
	cogl_texture_new_* functions take a gboolean auto_mipmap argument.
	If TRUE automatic mipmap generation is enabled during the process
	of slice texture object creation.
	(cogl_texture_new_from_foreign:) now allows mipmap min filter
	flags.

	* clutter/clutter-texture.c:
	* clutter/glx/clutter-glx-texture-pixmap.c:
	* tests/test-cogl-offscreen.c:
	* tests/test-cogl-tex-tile.c:
	* tests/test-cogl-tex-convert.c:
	* tests/test-cogl-tex-polygon.c:
	* tests/test-cogl-tex-getset.c:
	Pass FALSE for auto_mipmap to cogl_texture_new_*.

	* clutter/pango/pangoclutter-render.c:
	(tc_get:) Pass TRUE to cogl_texture_new_with_size and use mipmap
	min filter for nicer glyphs at small scales. As a result test-text
	has gone all beautiful now.
2008-05-07 16:12:54 +00:00
Øyvind Kolås
073870dbbf * clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gles/cogl-primitives.c: 
* clutter/cogl/common/cogl-primitives.c: moved declaration of
gegl_rectangle and gegl_rectanglex here to satisfy linking
requirements when building the fruity backend.
2008-05-05 12:01:19 +00:00
Øyvind Kolås
f2b44899f9 * clutter/cogl/cogl.h.in: api review touch ups.
* clutter/cogl/common/cogl-primitives.c: api review touch ups.
* clutter/cogl/gl/cogl-primitives.c: (cogl_path_fill),
(cogl_path_stroke): indentation.
* clutter/cogl/gles/cogl-primitives.c:
(_cogl_path_fill_nodes): free allocated resources.
* tests/test-cogl-primitives.c: updated to new API, added rotation to
test to show that cogl renders paths correct under perspective
distortion.
2008-05-05 10:25:11 +00:00
Øyvind Kolås
96f679a18b * clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-primitives.c:
* clutter/cogl/common/cogl-primitives.h:
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gl/cogl-primitives.h:
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl-primitives.h: moved duplicated code to the
common directory.
2008-04-30 15:05:17 +00:00
Neil Roberts
0e0890a2e9 Removed COGLhandle and changed shader and program functions to be
wrapped in reference-counted CoglHandles instead.

	* clutter/cogl/gl/cogl-shader.c: 
	* clutter/cogl/gl/cogl-shader.h: 
	* clutter/cogl/gl/cogl-program.c: 
	* clutter/cogl/gl/cogl-program.h: 
	New files to hold the shader and program functions.

	* clutter/cogl/gl/cogl.c: Removed shader and program functions.

	* clutter/cogl/common/cogl-handle.h: New header to define
	COGL_HANDLE_DEFINE which helps build functions to create
	reference-counted handles. This reduces the amount of duplicated
	code.

	* clutter/cogl/gl/cogl-texture.c: 
	* clutter/cogl/gles/cogl-texture.c: 
	* clutter/cogl/gl/cogl-fbo.c: Converted to use COGL_HANDLE_DEFINE
	from cogl-handle.h to avoid duplicating some of the common code.

	* clutter/cogl/gles/cogl-defines.h.in: 
	* clutter/cogl/gl/cogl-defines.h.in: Removed COGLhandle

	* clutter/cogl/gl/cogl-context.h: Added handle arrays for programs
	and shaders.

	* clutter/cogl/gl/cogl-context.c (cogl_create_context): Added
	initialisers for shader_handles and program_handles.
	(cogl_destroy_context): Added calls to g_array_free for all handle
	arrays.

	* clutter/cogl/gl/Makefile.am (libclutter_cogl_la_SOURCES): Added
	cogl-{program,shader}.{c,h}

	* clutter/cogl/common/Makefile.am
	(libclutter_cogl_common_la_SOURCES): Added cogl-handle.h

	* clutter/cogl/gles/cogl.c:
	* clutter/cogl/cogl.h.in: Programs and shaders are now wrapped in
	CoglHandles instead of COGLhandles. cogl_program_destroy and
	cogl_shader_destroy is now replaced with cogl_program_unref and
	cogl_shader_unref. cogl_program_ref and cogl_shader_ref are also
	added.

	* clutter/clutter-shader.c: Converted to use CoglHandles for the
	programs and shaders instead of COGLhandles.

	* cogl/cogl-sections.txt: Added cogl_shader_ref,
	cogl_shader_unref, cogl_is_shader, cogl_program_ref,
	cogl_program_unref, cogl_is_program and cogl_is_offscreen.
2008-04-29 16:10:37 +00:00
Øyvind Kolås
6a4cdd6e49 * clutter/cogl/cogl.h.in: renaming of API's in cogl to make the
primitives and path API a bit smaller and more resembling cairo.
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl.c:
* clutter/clutter-actor.c:
* clutter/clutter-rectangle.c:
* 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-tile.c: updated according to changes in cogl.
2008-04-29 15:41:34 +00:00
Neil Roberts
046569f090 Fixed 'make dist'
* clutter/cogl/Makefile.am (EXTRA_DIST): Distribute cogl.h.in
	instead of cogl.h
	(DIST_SUBDIRS): Added common folder

	* clutter/cogl/gl/Makefile.am (libclutter_cogl_la_SOURCES): Remove
	cogl-defines.h and use the right location for cogl-defines.gl.h
	(EXTRA_DIST): Distribute cogl-defines.h.in

	* clutter/cogl/gles/Makefile.am (libclutter_cogl_la_SOURCES):
	Remove cogl-defines.h and use the right location for
	cogl-defines.gles.h
	(EXTRA_DIST): Distribute cogl-defines.h.in

	* clutter/Makefile.am (DIST_SUBDIRS): Add fruity
2008-04-28 16:57:44 +00:00
Øyvind Kolås
2b7ff6fed0 * clutter/cogl/cogl.h.in: moved the documentation of the cogl
primitives to the main public header.
* clutter/cogl/gl/cogl-primitives.c: from here ..
* clutter/cogl/gles/cogl-primitives.c: .. _and_ here.
2008-04-28 14:18:29 +00:00