Don't use any GL types or defines in Clutter

Some of the Clutter code was using GL types for the primitive types
such as GLint and GLubyte and then passing these to Cogl. This doesn't
make much sense because the Cogl functions directly take native C
types. This patch just replaces them with either a native C type or a
glib type.

Some of the cogl conformance tests are trying to directly call GL for
example to test creating a foreign texture. These tests have been
changed to manually define the GL enum values instead of relying on a
GL header to define them.

This is necessary because Cogl may soon stop including a GL header
from its public headers.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Neil Roberts 2012-03-23 17:12:26 +00:00
parent 04f2be34b2
commit c9a81f035e
13 changed files with 167 additions and 110 deletions

View File

@ -132,7 +132,7 @@ typedef struct _ShaderUniform
gchar *name;
GType type;
GValue value;
GLint location;
int location;
} ShaderUniform;
struct _ClutterShaderEffectPrivate
@ -229,7 +229,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (&uniform->value))
{
const GLfloat *floats;
const float *floats;
floats = clutter_value_get_shader_float (&uniform->value, &size);
cogl_program_set_uniform_float (priv->program, uniform->location,
@ -238,7 +238,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
}
else if (CLUTTER_VALUE_HOLDS_SHADER_INT (&uniform->value))
{
const GLint *ints;
const int *ints;
ints = clutter_value_get_shader_int (&uniform->value, &size);
cogl_program_set_uniform_int (priv->program, uniform->location,
@ -247,7 +247,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
}
else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (&uniform->value))
{
const GLfloat *matrix;
const float *matrix;
matrix = clutter_value_get_shader_matrix (&uniform->value, &size);
cogl_program_set_uniform_matrix (priv->program, uniform->location,
@ -257,7 +257,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
}
else if (G_VALUE_HOLDS_FLOAT (&uniform->value))
{
const GLfloat float_val = g_value_get_float (&uniform->value);
const float float_val = g_value_get_float (&uniform->value);
cogl_program_set_uniform_float (priv->program, uniform->location,
1, 1,
@ -265,8 +265,8 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
}
else if (G_VALUE_HOLDS_DOUBLE (&uniform->value))
{
const GLfloat float_val =
(GLfloat) g_value_get_double (&uniform->value);
const float float_val =
(float) g_value_get_double (&uniform->value);
cogl_program_set_uniform_float (priv->program, uniform->location,
1, 1,
@ -274,7 +274,7 @@ clutter_shader_effect_update_uniforms (ClutterShaderEffect *effect)
}
else if (G_VALUE_HOLDS_INT (&uniform->value))
{
const GLint int_val = g_value_get_int (&uniform->value);
const int int_val = g_value_get_int (&uniform->value);
cogl_program_set_uniform_int (priv->program, uniform->location,
1, 1,

View File

@ -82,19 +82,19 @@ static GTypeFundamentalInfo shader_matrix_finfo = { 0, };
struct _ClutterShaderFloat
{
gint size;
GLfloat value[4];
float value[4];
};
struct _ClutterShaderInt
{
gint size;
GLint value[4];
int value[4];
};
struct _ClutterShaderMatrix
{
gint size;
GLfloat value[16];
float value[16];
};
static gpointer
@ -436,7 +436,7 @@ clutter_value_set_shader_int (GValue *value,
shader_int->size = size;
for (i = 0; i < size; i++)
shader_int->value[i] = (GLint) ints[i];
shader_int->value[i] = ints[i];
}
/**

View File

@ -1368,7 +1368,7 @@ read_pixels_to_file (char *filename_stem,
int width,
int height)
{
GLubyte *data;
guint8 *data;
cairo_surface_t *surface;
static int read_count = 0;
char *filename = g_strdup_printf ("%s-%05d.png",

View File

@ -766,7 +766,7 @@ clutter_shader_set_uniform (ClutterShader *shader,
const GValue *value)
{
ClutterShaderPrivate *priv;
GLint location = 0;
int location = 0;
gsize size;
g_return_if_fail (CLUTTER_IS_SHADER (shader));
@ -785,7 +785,7 @@ clutter_shader_set_uniform (ClutterShader *shader,
if (CLUTTER_VALUE_HOLDS_SHADER_FLOAT (value))
{
const GLfloat *floats;
const float *floats;
floats = clutter_value_get_shader_float (value, &size);
cogl_program_set_uniform_float (priv->program,
@ -801,7 +801,7 @@ clutter_shader_set_uniform (ClutterShader *shader,
}
else if (CLUTTER_VALUE_HOLDS_SHADER_MATRIX (value))
{
const GLfloat *matrix;
const float *matrix;
matrix = clutter_value_get_shader_matrix (value, &size);
cogl_program_set_uniform_matrix (priv->program,
@ -809,7 +809,7 @@ clutter_shader_set_uniform (ClutterShader *shader,
}
else if (G_VALUE_HOLDS_FLOAT (value))
{
GLfloat float_val = g_value_get_float (value);
float float_val = g_value_get_float (value);
cogl_program_set_uniform_float (priv->program,
location, 1, 1, &float_val);

View File

@ -30,6 +30,20 @@ static TestConformGLFunctions gl_functions;
#define MASK_BLUE(COLOR) ((COLOR & 0xff00) >> 8)
#define MASK_ALPHA(COLOR) (COLOR & 0xff)
#ifndef GL_VERSION
#define GL_VERSION 0x1F02
#endif
#ifndef GL_MAX_TEXTURE_IMAGE_UNITS
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
#endif
#ifndef GL_MAX_VERTEX_ATTRIBS
#define GL_MAX_VERTEX_ATTRIBS 0x8869
#endif
#ifndef GL_MAX_TEXTURE_UNITS
#define GL_MAX_TEXTURE_UNITS 0x84E2
#endif
typedef struct _TestState
{
ClutterGeometry stage_geom;
@ -39,9 +53,9 @@ typedef struct _TestState
static void
check_pixel (TestState *state, int x, int y, guint32 color)
{
GLint y_off;
GLint x_off;
GLubyte pixel[4];
int y_off;
int x_off;
guint8 pixel[4];
guint8 r = MASK_RED (color);
guint8 g = MASK_GREEN (color);
guint8 b = MASK_BLUE (color);
@ -163,7 +177,7 @@ test_using_all_layers (TestState *state, int x, int y)
guint8 red_pixel[] = { 0xff, 0x00, 0x00, 0xff };
CoglHandle white_texture;
CoglHandle red_texture;
GLint n_layers;
int n_layers;
int i;
/* Create a material that uses the maximum number of layers. All but
@ -185,7 +199,7 @@ test_using_all_layers (TestState *state, int x, int y)
#ifdef COGL_HAS_GLES2
if (using_gles2_driver ())
{
GLint n_image_units, n_attribs;
int n_image_units, n_attribs;
/* GLES 2 doesn't have GL_MAX_TEXTURE_UNITS and it uses
GL_MAX_TEXTURE_IMAGE_UNITS instead */
gl_functions.glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n_image_units);

View File

@ -27,7 +27,7 @@ typedef struct _TestState
static void
check_pixel (GLubyte *pixel, guint32 color)
check_pixel (guint8 *pixel, guint32 color)
{
guint8 r = MASK_RED (color);
guint8 g = MASK_GREEN (color);

View File

@ -12,20 +12,49 @@ typedef struct _TestState
ClutterActor *stage;
} TestState;
#ifndef GL_EXTENSIONS
#define GL_EXTENSIONS 0x1F03
#endif
#ifndef GL_TEXTURE_RECTANGLE_ARB
#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
#endif
#ifndef GL_UNPACK_ROW_LENGTH
#define GL_UNPACK_ROW_LENGTH 0x0CF2
#endif
#ifndef GL_UNPACK_ALIGNMENT
#define GL_UNPACK_ALIGNMENT 0x0CF5
#endif
#ifndef GL_UNPACK_SKIP_ROWS
#define GL_UNPACK_SKIP_ROWS 0x0CF3
#endif
#ifndef GL_UNPACK_SKIP_PIXELS
#define GL_UNPACK_SKIP_PIXELS 0x0CF4
#endif
#ifndef GL_RGBA
#define GL_RGBA 0x1908
#endif
#ifndef GL_UNSIGNED_BYTE
#define GL_UNSIGNED_BYTE 0x1401
#endif
#ifndef GL_NO_ERROR
#define GL_NO_ERROR 0x0
#endif
#ifndef GL_TEXTURE_BINDING_RECTANGLE_ARB
#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
#endif
static CoglHandle
create_source_rect (void)
{
#ifdef GL_TEXTURE_RECTANGLE_ARB
int x, y;
GLint prev_unpack_row_length;
GLint prev_unpack_alignment;
GLint prev_unpack_skip_rows;
GLint prev_unpack_skip_pixles;
GLint prev_rectangle_binding;
int prev_unpack_row_length;
int prev_unpack_alignment;
int prev_unpack_skip_rows;
int prev_unpack_skip_pixles;
int prev_rectangle_binding;
guint8 *data = g_malloc (256 * 256 * 4), *p = data;
CoglHandle tex;
GLuint gl_tex;
guint gl_tex;
for (y = 0; y < 256; y++)
for (x = 0; x < 256; x++)
@ -78,12 +107,6 @@ create_source_rect (void)
COGL_PIXEL_FORMAT_RGBA_8888);
return tex;
#else /* GL_TEXTURE_RECTANGLE_ARB */
return COGL_INVALID_HANDLE;
#endif /* GL_TEXTURE_RECTANGLE_ARB */
}
static CoglHandle
@ -116,7 +139,7 @@ create_source_2d (void)
static void
draw_frame (TestState *state)
{
GLuint gl_tex;
guint gl_tex;
CoglHandle tex_rect = create_source_rect ();
CoglHandle material_rect = cogl_material_new ();
CoglHandle tex_2d = create_source_2d ();

View File

@ -26,8 +26,8 @@ typedef struct _TestState
static void
validate_result (TestState *state)
{
GLubyte pixel[4];
GLint y_off = 90;
guint8 pixel[4];
int y_off = 90;
if (g_test_verbose ())
g_print ("y_off = %d\n", y_off);
@ -102,7 +102,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_enable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -113,7 +113,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_disable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -124,7 +124,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_enable (state->buffer, "gl_Color::blue");
cogl_set_source_color4ub (0xff, 0x00, 0x00, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -134,7 +134,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_set_source (state->material);
cogl_material_set_color4ub (state->material, 0xff, 0xff, 0xff, 0xff);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -197,19 +197,19 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
cogl_material_set_layer (state.material, 0, state.texture);
{
GLfloat triangle_verts[3][2] =
float triangle_verts[3][2] =
{
{0.0, 0.0},
{100.0, 100.0},
{0.0, 100.0}
};
GLbyte triangle_colors[3][4] =
guint8 triangle_colors[3][4] =
{
{0x00, 0x00, 0xff, 0xff}, /* blue */
{0x00, 0x00, 0xff, 0x00}, /* transparent blue */
{0x00, 0x00, 0xff, 0x00} /* transparent blue */
};
GLfloat triangle_tex_coords[3][2] =
float triangle_tex_coords[3][2] =
{
{0.0, 0.0},
{1.0, 1.0},
@ -219,21 +219,21 @@ test_cogl_vertex_buffer_contiguous (TestConformSimpleFixture *fixture,
cogl_vertex_buffer_add (state.buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_verts);
cogl_vertex_buffer_add (state.buffer,
"gl_Color::blue",
4, /* n components */
GL_UNSIGNED_BYTE,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
triangle_colors);
cogl_vertex_buffer_add (state.buffer,
"gl_MultiTexCoord0",
2, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_tex_coords);

View File

@ -20,21 +20,16 @@ typedef struct _TestState
typedef struct _InterlevedVertex
{
GLfloat x;
GLfloat y;
GLubyte r;
GLubyte g;
GLubyte b;
GLubyte a;
float x, y;
guint8 r, g, b, a;
} InterlevedVertex;
static void
validate_result (TestState *state)
{
GLubyte pixel[4];
GLint y_off = 90;
guint8 pixel[4];
int y_off = 90;
/* NB: We ignore the alpha, since we don't know if our render target is
* RGB or RGBA */
@ -67,7 +62,7 @@ on_paint (ClutterActor *actor, TestState *state)
{
/* Draw a faded blue triangle */
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -134,14 +129,14 @@ test_cogl_vertex_buffer_interleved (TestConformSimpleFixture *fixture,
cogl_vertex_buffer_add (state.buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
12, /* stride */
&verts[0].x);
cogl_vertex_buffer_add (state.buffer,
"gl_Color",
4, /* n components */
GL_UNSIGNED_BYTE,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
12, /* stride */
&verts[0].r);

View File

@ -20,8 +20,8 @@ typedef struct _TestState
static void
validate_result (TestState *state)
{
GLubyte pixel[4];
GLint y_off = 90;
guint8 pixel[4];
int y_off = 90;
/* NB: We ignore the alpha, since we don't know if our render target is
* RGB or RGBA */
@ -61,13 +61,13 @@ validate_result (TestState *state)
static void
on_paint (ClutterActor *actor, TestState *state)
{
GLfloat triangle_verts[3][2] =
float triangle_verts[3][2] =
{
{100.0, 0.0},
{200.0, 100.0},
{100.0, 100.0}
};
GLbyte triangle_colors[3][4] =
guint8 triangle_colors[3][4] =
{
{0x00, 0xff, 0x00, 0xff}, /* blue */
{0x00, 0xff, 0x00, 0x00}, /* transparent blue */
@ -83,7 +83,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_add (state->buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_verts);
@ -91,7 +91,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_submit (state->buffer);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -102,7 +102,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_vertex_buffer_add (state->buffer,
"gl_Color",
4, /* n components */
GL_UNSIGNED_BYTE,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
triangle_colors);
@ -110,7 +110,7 @@ on_paint (ClutterActor *actor, TestState *state)
cogl_translate (100, 0, 0);
cogl_vertex_buffer_draw (state->buffer,
GL_TRIANGLE_STRIP, /* mode */
COGL_VERTICES_MODE_TRIANGLE_STRIP, /* mode */
0, /* first */
3); /* count */
@ -154,13 +154,13 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
g_signal_connect (group, "paint", G_CALLBACK (on_paint), &state);
{
GLfloat triangle_verts[3][2] =
float triangle_verts[3][2] =
{
{0.0, 0.0},
{100.0, 100.0},
{0.0, 100.0}
};
GLbyte triangle_colors[3][4] =
guint8 triangle_colors[3][4] =
{
{0x00, 0x00, 0xff, 0xff}, /* blue */
{0x00, 0x00, 0xff, 0x00}, /* transparent blue */
@ -170,14 +170,14 @@ test_cogl_vertex_buffer_mutability (TestConformSimpleFixture *fixture,
cogl_vertex_buffer_add (state.buffer,
"gl_Vertex",
2, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
triangle_verts);
cogl_vertex_buffer_add (state.buffer,
"gl_Color",
4, /* n components */
GL_UNSIGNED_BYTE,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
triangle_colors);

View File

@ -27,19 +27,19 @@ typedef struct _TestConformTodo
typedef struct _TestConformGLFunctions
{
const GLubyte * (* glGetString) (GLenum name);
void (* glGetIntegerv) (GLenum pname, GLint *params);
void (* glPixelStorei) (GLenum pname, GLint param);
void (* glBindTexture) (GLenum target, GLuint texture);
void (* glGenTextures) (GLsizei n, GLuint *textures);
GLenum (* glGetError) (void);
void (* glDeleteTextures) (GLsizei n, const GLuint *textures);
void (* glTexImage2D) (GLenum target, GLint level,
GLint internalFormat,
GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels);
void (* glTexParameteri) (GLenum target, GLenum pname, GLint param);
const guint8 * (* glGetString) (guint name);
void (* glGetIntegerv) (guint pname, int *params);
void (* glPixelStorei) (guint pname, int param);
void (* glBindTexture) (guint target, guint texture);
void (* glGenTextures) (int n, guint *textures);
guint (* glGetError) (void);
void (* glDeleteTextures) (int n, const guint *textures);
void (* glTexImage2D) (guint target, int level,
int internalFormat,
int width, int height,
int border, guint format, guint type,
const void *pixels);
void (* glTexParameteri) (guint target, guint pname, int param);
} TestConformGLFunctions;
void test_conform_get_gl_functions (TestConformGLFunctions *functions);

View File

@ -4,6 +4,31 @@
#include <clutter/clutter.h>
#include <cogl/cogl.h>
#ifndef GL_UNPACK_ALIGNMENT
#define GL_UNPACK_ALIGNMENT 0x0CF5
#endif
#ifndef GL_TEXTURE_BINDING_2D
#define GL_TEXTURE_BINDING_2D 0x8069
#endif
#ifndef GL_TEXTURE_2D
#define GL_TEXTURE_2D 0x0DE1
#endif
#ifndef GL_RGB
#define GL_RGB 0x1907
#endif
#ifndef GL_UNSIGNED_BYTE
#define GL_UNSIGNED_BYTE 0x1401
#endif
#ifndef GL_TEXTURE_MAG_FILTER
#define GL_TEXTURE_MAG_FILTER 0x2800
#endif
#ifndef GL_LINEAR
#define GL_LINEAR 0x1208
#endif
#ifndef GL_TEXTURE_MIN_FILTER
#define GL_TEXTURE_MIN_FILTER 0x2801
#endif
/* Coglbox declaration
*--------------------------------------------------*/
@ -68,27 +93,27 @@ G_DEFINE_TYPE (TestCoglbox, test_coglbox, CLUTTER_TYPE_ACTOR);
struct _TestCoglboxPrivate
{
GLuint gl_handle;
guint gl_handle;
CoglHandle cogl_handle;
void
(* glGetIntegerv) (GLenum pname, GLint *params);
(* glGetIntegerv) (guint pname, int *params);
void
(* glPixelStorei) (GLenum pname, GLint param);
(* glPixelStorei) (guint pname, int param);
void
(* glTexParameteri) (GLenum target, GLenum pname, GLint param);
(* glTexParameteri) (guint target, guint pname, int param);
void
(* glTexImage2D) (GLenum target, GLint level,
GLint internalFormat,
GLsizei width, GLsizei height,
GLint border, GLenum format, GLenum type,
const GLvoid *pixels);
(* glTexImage2D) (guint target, int level,
int internalFormat,
int width, int height,
int border, guint format, guint type,
const void *pixels);
void
(* glGenTextures) (GLsizei n, GLuint *textures);
(* glGenTextures) (int n, guint *textures);
void
(* glDeleteTextures) (GLsizei n, const GLuint *textures);
(* glDeleteTextures) (int n, const guint *textures);
void
(* glBindTexture) (GLenum target, GLuint texture);
(* glBindTexture) (guint target, guint texture);
};
/* Coglbox implementation
@ -140,8 +165,8 @@ test_coglbox_init (TestCoglbox *self)
{
TestCoglboxPrivate *priv;
guchar data[12];
GLint prev_unpack_alignment;
GLint prev_2d_texture_binding;
int prev_unpack_alignment;
int prev_2d_texture_binding;
self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self);

View File

@ -45,8 +45,8 @@ typedef struct _TestState
ClutterActor *dummy;
CoglHandle buffer;
float *quad_mesh_verts;
GLubyte *quad_mesh_colors;
GLushort *static_indices;
guint8 *quad_mesh_colors;
guint16 *static_indices;
guint n_static_indices;
CoglHandle indices;
ClutterTimeline *timeline;
@ -86,7 +86,7 @@ frame_cb (ClutterTimeline *timeline,
float ripple_sin = sinf (ripple_angle);
float h, s, l;
GLubyte *color;
guint8 *color;
vert[2] = (wave_sin * WAVE_DEPTH) + (ripple_sin * RIPPLE_DEPTH);
@ -110,14 +110,14 @@ frame_cb (ClutterTimeline *timeline,
cogl_vertex_buffer_add (state->buffer,
"gl_Vertex",
3, /* n components */
GL_FLOAT,
COGL_ATTRIBUTE_TYPE_FLOAT,
FALSE, /* normalized */
0, /* stride */
state->quad_mesh_verts);
cogl_vertex_buffer_add (state->buffer,
"gl_Color",
4, /* n components */
GL_UNSIGNED_BYTE,
COGL_ATTRIBUTE_TYPE_UNSIGNED_BYTE,
FALSE, /* normalized */
0, /* stride */
state->quad_mesh_colors);
@ -157,7 +157,7 @@ init_static_index_arrays (TestState *state)
{
guint n_indices;
int x, y;
GLushort *i;
guint16 *i;
guint dir;
/* - Each row takes (2 + 2 * MESH_WIDTH indices)
@ -167,7 +167,7 @@ init_static_index_arrays (TestState *state)
* - It takes one extra index for linking between rows (MESH_HEIGHT - 1)
* - A 2 x 3 mesh == 20 indices... */
n_indices = (2 + 2 * MESH_WIDTH) * MESH_HEIGHT + (MESH_HEIGHT - 1);
state->static_indices = g_malloc (sizeof (GLushort) * n_indices);
state->static_indices = g_malloc (sizeof (guint16) * n_indices);
state->n_static_indices = n_indices;
#define MESH_INDEX(X, Y) (Y) * (MESH_WIDTH + 1) + (X)
@ -258,7 +258,7 @@ init_quad_mesh (TestState *state)
{
int x, y;
float *vert;
GLubyte *color;
guint8 *color;
/* Note: we maintain the minimum number of vertices possible. This minimizes
* the work required when we come to morph the geometry.
@ -271,7 +271,7 @@ init_quad_mesh (TestState *state)
g_malloc0 (sizeof (float) * 3 * (MESH_WIDTH + 1) * (MESH_HEIGHT + 1));
state->quad_mesh_colors =
g_malloc0 (sizeof (GLubyte) * 4 * (MESH_WIDTH + 1) * (MESH_HEIGHT + 1));
g_malloc0 (sizeof (guint8) * 4 * (MESH_WIDTH + 1) * (MESH_HEIGHT + 1));
vert = state->quad_mesh_verts;
color = state->quad_mesh_colors;