Commit Graph

8 Commits

Author SHA1 Message Date
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
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
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
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
1502d0690c * clutter/cogl/gles/cogl-gles2-wrapper.c (cogl_wrap_glGetFixedv):
Filled in the wrapper for glGetFixedv
2008-05-28 11:29:58 +00:00
Neil Roberts
29f7cbdfb7 * clutter/cogl/gles/cogl-texture.c: Use the wrapper for
glTexParameteri. Call glGenerateMipmap after every change to the
	texture image data.

	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-gles2-wrapper.c: Added a wrapper for
	glTexParameteri so that it can ignore requests to set
	GL_GENERATE_MIPMAP. Added a wrapper for glGenerateMipmap that does
	nothing on GLES 1
2008-05-28 10:47:21 +00:00
Neil Roberts
70dbc03734 GLES 2 backend
* clutter/eglx/clutter-stage-egl.h:
	* clutter/eglx/clutter-egl-headers.h:
	* clutter/eglx/clutter-backend-egl.h:
	* clutter/eglx/Makefile.am: Include the GLES and EGL headers via
	clutter-egl-headers.h so that the right version can be used
	depending on whether the GLES 2 wrapper is being used.

	* configure.ac: Added an automake conditional for whether the GLES
	2 wrapper should be used.

	* clutter/eglx/clutter-stage-egl.c (clutter_stage_egl_realize):
	Remove the call to glGetIntegerv to get the max texture size. It
	was being called before the GL context was bound so it didn't work
	anyway and it was causing trouble for the GLES 2 simulator.

	* clutter/cogl/gles/stringify.sh: Shell script to convert the
	shaders into a C string.

	* clutter/cogl/gles/cogl-gles2-wrapper.h:
	* clutter/cogl/gles/cogl-gles2-wrapper.c: Wrappers for most of the
	missing GL functions in GLES 2.

	* clutter/cogl/gles/cogl-fixed-fragment-shader.glsl:
	* clutter/cogl/gles/cogl-fixed-vertex-shader.glsl: New shaders for
	GLES 2

	* clutter/cogl/gles/cogl-defines.h.in: Use the @CLUTTER_GL_HEADER@
	macro instead of always using the GLES 1 header.

	* clutter/cogl/gles/cogl-context.h (CoglContext): Include a field
	for the state of the GLES 2 wrapper.

	* clutter/cogl/gles/cogl-texture.c:
	* clutter/cogl/gles/cogl-primitives.c:
	* clutter/cogl/gles/cogl.c: Use wrapped versions of the GL
	functions where neccessary.

	* clutter/cogl/gles/Makefile.am: Add sources for the GLES 2
	wrapper and an extra build step to put the GLSL files into a C
	string whenever the files change.
2008-05-27 17:42:50 +00:00