mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 01:36:10 -05:00
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
This commit is contained in:
parent
d510a4b0cd
commit
3d2a1e2d81
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
||||
2008-11-13 Robert Bragg <robert@linux.intel.com>
|
||||
|
||||
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 Neil Roberts <neil@linux.intel.com>
|
||||
|
||||
* clutter/clutter-actor.c (clutter_actor_get_paint_visibility):
|
||||
|
@ -140,7 +140,7 @@
|
||||
* GL/GLES compatability defines for VBO thingies:
|
||||
*/
|
||||
|
||||
#if HAVE_COGL_GL
|
||||
#if defined (HAVE_COGL_GL)
|
||||
|
||||
#define glGenBuffers ctx->pf_glGenBuffersARB
|
||||
#define glBindBuffer ctx->pf_glBindBufferARB
|
||||
@ -153,7 +153,7 @@
|
||||
#define GL_ARRAY_BUFFER GL_ARRAY_BUFFER_ARB
|
||||
#endif
|
||||
|
||||
#else
|
||||
#elif defined (HAVE_COGL_GLES)
|
||||
|
||||
/* NB: GLES has had VBOs/GLSL since 1.1, so we don't need any defines in
|
||||
* this case except for glBufferSubData which, just for the fun of it, has a
|
||||
@ -161,27 +161,42 @@
|
||||
*/
|
||||
#define glBufferDataSub glBufferSubData
|
||||
|
||||
#elif defined (HAVE_COGL_GLES2)
|
||||
|
||||
#define glVertexPointer cogl_wrap_glVertexPointer
|
||||
#define glNormalPointer cogl_wrap_glNormalPointer
|
||||
#define glTexCoordPointer cogl_wrap_glTexCoordPointer
|
||||
#define glColorPointer cogl_wrap_glColorPointer
|
||||
#define glDrawArrays cogl_wrap_glDrawArrays
|
||||
|
||||
#define glEnableClientState cogl_wrap_glEnableClientState
|
||||
#define glDisableClientState cogl_wrap_glDisableClientState
|
||||
|
||||
#define glBufferDataSub glBufferSubData
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GL/GLES compatability defines for shader things:
|
||||
*/
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
#if defined (HAVE_COGL_GL)
|
||||
|
||||
#define glVertexAttribPointer ctx->pf_glVertexAttribPointerARB
|
||||
#define glEnableVertexAttribArray ctx->pf_glEnableVertexAttribArrayARB
|
||||
#define glDisableVertexAttribArray ctx->pf_glEnableVertexAttribArrayARB
|
||||
#define MAY_HAVE_PROGRAMABLE_GL
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_COGL_GLES2
|
||||
#elif defined (HAVE_COGL_GLES2)
|
||||
|
||||
/* NB: GLES2 had shaders in core since day one so again we don't need
|
||||
* defines in this case: */
|
||||
#define MAY_HAVE_PROGRAMABLE_GL
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_COGL_GL
|
||||
/* GLES doesn't glDrawRangeElements, so we simply pretend it does
|
||||
/* GLES doesn't have glDrawRangeElements, so we simply pretend it does
|
||||
* but that it makes no use of the start, end constraints: */
|
||||
#define glDrawRangeElements(mode, start, end, count, type, indices) \
|
||||
glDrawElements (mode, count, type, indices)
|
||||
|
@ -68,6 +68,7 @@
|
||||
#define COGL_GLES2_WRAPPER_VERTEX_ATTRIB 0
|
||||
#define COGL_GLES2_WRAPPER_TEX_COORD_ATTRIB 1
|
||||
#define COGL_GLES2_WRAPPER_COLOR_ATTRIB 2
|
||||
#define COGL_GLES2_WRAPPER_NORMAL_ATTRIB 3
|
||||
|
||||
static GLuint
|
||||
cogl_gles2_wrapper_create_shader (GLenum type, const char *source)
|
||||
@ -424,6 +425,8 @@ cogl_gles2_wrapper_bind_attributes (GLuint program)
|
||||
"tex_coord_attrib");
|
||||
glBindAttribLocation (program, COGL_GLES2_WRAPPER_COLOR_ATTRIB,
|
||||
"color_attrib");
|
||||
glBindAttribLocation (program, COGL_GLES2_WRAPPER_NORMAL_ATTRIB,
|
||||
"normal_attrib");
|
||||
}
|
||||
|
||||
void
|
||||
@ -798,6 +801,13 @@ cogl_wrap_glColorPointer (GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer)
|
||||
{
|
||||
glVertexAttribPointer (COGL_GLES2_WRAPPER_COLOR_ATTRIB, size, type,
|
||||
GL_TRUE, stride, pointer);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_wrap_glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
glVertexAttribPointer (COGL_GLES2_WRAPPER_NORMAL_ATTRIB, 1, type,
|
||||
GL_FALSE, stride, pointer);
|
||||
}
|
||||
|
||||
@ -992,6 +1002,9 @@ cogl_wrap_glEnableClientState (GLenum array)
|
||||
case GL_COLOR_ARRAY:
|
||||
glEnableVertexAttribArray (COGL_GLES2_WRAPPER_COLOR_ATTRIB);
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
glEnableVertexAttribArray (COGL_GLES2_WRAPPER_NORMAL_ATTRIB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1009,6 +1022,9 @@ cogl_wrap_glDisableClientState (GLenum array)
|
||||
case GL_COLOR_ARRAY:
|
||||
glDisableVertexAttribArray (COGL_GLES2_WRAPPER_COLOR_ATTRIB);
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
glDisableVertexAttribArray (COGL_GLES2_WRAPPER_NORMAL_ATTRIB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,7 @@ struct _CoglGles2WrapperShader
|
||||
#define GL_VERTEX_ARRAY 0x8074
|
||||
#define GL_TEXTURE_COORD_ARRAY 0x8078
|
||||
#define GL_COLOR_ARRAY 0x8076
|
||||
#define GL_NORMAL_ARRAY 0x8075
|
||||
|
||||
#define GL_LIGHTING 0x0B50
|
||||
#define GL_ALPHA_TEST 0x0BC0
|
||||
@ -223,6 +224,8 @@ void cogl_wrap_glVertexPointer (GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
void cogl_wrap_glColorPointer (GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
void cogl_wrap_glNormalPointer (GLenum type, GLsizei stride,
|
||||
const GLvoid *pointer);
|
||||
|
||||
void cogl_wrap_glTexEnvx (GLenum target, GLenum pname, GLfixed param);
|
||||
|
||||
@ -281,6 +284,7 @@ void _cogl_gles2_clear_cache_for_program (CoglHandle program);
|
||||
#define cogl_wrap_glTexCoordPointer glTexCoordPointer
|
||||
#define cogl_wrap_glVertexPointer glVertexPointer
|
||||
#define cogl_wrap_glColorPointer glColorPointer
|
||||
#define cogl_wrap_glNormalPointer glNormalPointer
|
||||
#define cogl_wrap_glTexEnvx glTexEnvx
|
||||
#define cogl_wrap_glEnableClientState glEnableClientState
|
||||
#define cogl_wrap_glDisableClientState glDisableClientState
|
||||
|
@ -24,7 +24,7 @@ test_conformance_SOURCES = \
|
||||
# For convenience, this provides a way to easily run individual unit tests:
|
||||
.PHONY: wrappers
|
||||
wrappers: test-conformance
|
||||
for i in `./test-conformance -l -m thorough`; \
|
||||
for i in `./test-conformance -l -m thorough|grep '^/'`; \
|
||||
do \
|
||||
ln -sf $(top_srcdir)/tests/conform/wrapper.sh `basename $$i`; \
|
||||
done
|
||||
|
@ -66,7 +66,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
{
|
||||
/* Draw a faded blue triangle */
|
||||
cogl_mesh_enable_attribute (state->mesh, "gl_Color::blue");
|
||||
glColor4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_mesh_draw_arrays (state->mesh,
|
||||
GL_TRIANGLE_STRIP, /* mode */
|
||||
0, /* first */
|
||||
@ -77,7 +77,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* the triangle will remain faded blue */
|
||||
cogl_translate (100, 0, 0);
|
||||
cogl_mesh_disable_attribute (state->mesh, "gl_Color::blue");
|
||||
glColor4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_mesh_draw_arrays (state->mesh,
|
||||
GL_TRIANGLE_STRIP, /* mode */
|
||||
0, /* first */
|
||||
@ -88,7 +88,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* the triangle will remain red */
|
||||
cogl_translate (100, 0, 0);
|
||||
cogl_mesh_enable_attribute (state->mesh, "gl_Color::blue");
|
||||
glColor4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_mesh_draw_arrays (state->mesh,
|
||||
GL_TRIANGLE_STRIP, /* mode */
|
||||
0, /* first */
|
||||
|
@ -72,7 +72,7 @@ on_paint (ClutterActor *actor, TestState *state)
|
||||
* Draw a red triangle
|
||||
*/
|
||||
|
||||
glColor4ub (0xff, 0x00, 0x00, 0xff);
|
||||
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
|
||||
|
||||
cogl_mesh_add_attribute (state->mesh,
|
||||
"gl_Vertex",
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
UNIT_TEST=`basename $0`
|
||||
UNIT_TEST_PATH=`./test-conformance -l -m thorough |grep "$UNIT_TEST\$"`
|
||||
UNIT_TEST_PATH=`./test-conformance -l -m thorough |grep '^/'|grep "$UNIT_TEST\$"`
|
||||
|
||||
echo "Running: gtester -p $UNIT_TEST_PATH ./test-conformance"
|
||||
echo ""
|
||||
|
Loading…
Reference in New Issue
Block a user