* 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.
This commit is contained in:
Neil Roberts 2008-06-06 14:21:22 +00:00
parent 9d8bfaf997
commit 1bfeddaaee
9 changed files with 88 additions and 18 deletions

View File

@ -1,3 +1,26 @@
2008-06-06 Neil Roberts <neil@o-hand.com>
* 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 Matthew Allum <mallum@openedhand.com>
Bug #948 - Remove texture rectangle support

View File

@ -1,3 +1,7 @@
/* There is no default precision for floats in fragment shaders in
GLES 2 so we need to define one */
precision mediump float;
/* Inputs from the vertex shader */
varying vec4 frag_color;
varying vec2 tex_coord;

View File

@ -17,4 +17,5 @@ libclutter_eglnative_la_SOURCES = \
clutter-backend-egl.c \
clutter-event-egl.c \
clutter-stage-egl.h \
clutter-stage-egl.c
clutter-stage-egl.c \
clutter-egl-headers.h

View File

@ -22,8 +22,7 @@
#ifndef __CLUTTER_BACKEND_EGL_H__
#define __CLUTTER_BACKEND_EGL_H__
#include <GLES/gl.h>
#include <GLES/egl.h>
#include "clutter-egl-headers.h"
#include <glib-object.h>
#include <clutter/clutter-backend.h>

View File

@ -0,0 +1,33 @@
/* Clutter.
* An OpenGL based 'interactive canvas' library.
* Authored By Matthew Allum <mallum@openedhand.com>
* Copyright (C) 2006-2007 OpenedHand
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __CLUTTER_EGL_HEADERS_H__
#define __CLUTTER_EGL_HEADERS_H__
#ifdef HAVE_COGL_GLES2
#include <GLES2/gl2.h>
#include <EGL/egl.h>
#else /* HAVE_COGL_GLES2 */
#include <GLES/gl.h>
#include <GLES/egl.h>
#endif /* HAVE_COGL_GLES2 */
#endif /* __CLUTTER_EGL_HEADERS_H__ */

View File

@ -28,8 +28,7 @@
#include <glib.h>
#include <GLES/gl.h>
#include <GLES/egl.h>
#include "clutter-egl-headers.h"
#include <clutter/clutter-stage.h>

View File

@ -88,7 +88,7 @@ get_backend_time (void)
backend_egl = CLUTTER_BACKEND_EGL (clutter_get_default_backend ());
return g_timer_elapsed (backend_egl->event_timer) * 1000;
return g_timer_elapsed (backend_egl->event_timer, NULL) * 1000;
}
void

View File

@ -72,14 +72,18 @@ clutter_stage_egl_realize (ClutterActor *actor)
if (G_LIKELY (!is_offscreen))
{
EGLint cfg_attribs[] = { EGL_BUFFER_SIZE, EGL_DONT_CARE,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 16,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, 2,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGLint cfg_attribs[] = { EGL_BUFFER_SIZE, EGL_DONT_CARE,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 16,
EGL_ALPHA_SIZE, EGL_DONT_CARE,
EGL_STENCIL_SIZE, 2,
#ifdef HAVE_COGL_GLES2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else /* HAVE_COGL_GLES2 */
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
#endif /* HAVE_COGL_GLES2 */
EGL_NONE };
status = eglGetConfigs (backend_egl->edpy,
@ -150,12 +154,20 @@ clutter_stage_egl_realize (ClutterActor *actor)
if (G_UNLIKELY (backend_egl->egl_context == NULL))
{
static const EGLint attribs[3]
= { EGL_CONTEXT_CLIENT_VERSION,
#ifdef HAVE_COGL_GLES2
2,
#else /* HAVE_COGL_GLES2 */
1,
#endif
EGL_NONE };
CLUTTER_NOTE (GL, "Creating EGL Context");
backend_egl->egl_context = eglCreateContext (backend_egl->edpy,
configs[0],
configs[0],
EGL_NO_CONTEXT,
NULL);
attribs);
if (backend_egl->egl_context == EGL_NO_CONTEXT)
{

View File

@ -4,8 +4,7 @@
#include <glib-object.h>
#include <clutter/clutter-stage.h>
#include <GLES/gl.h>
#include <GLES/egl.h>
#include "clutter-egl-headers.h"
#include "clutter-backend-egl.h"
#define CLUTTER_TYPE_STAGE_EGL (clutter_stage_egl_get_type ())