Fix declarations after statement
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
diff --git a/test/testgles2_sdf.c b/test/testgles2_sdf.c
index 880915e..3143626 100644
--- a/test/testgles2_sdf.c
+++ b/test/testgles2_sdf.c
@@ -265,6 +265,7 @@ typedef struct shader_data
static void
Render(unsigned int width, unsigned int height, shader_data* data)
{
+ float *verts = g_verts;
ctx.glViewport(0, 0, 640, 480);
GL_CHECK(ctx.glClear(GL_COLOR_BUFFER_BIT));
@@ -272,8 +273,6 @@ Render(unsigned int width, unsigned int height, shader_data* data)
GL_CHECK(ctx.glUniformMatrix4fv(g_uniform_locations[GLES2_UNIFORM_PROJECTION], 1, GL_FALSE, (const float *)matrix_mvp));
GL_CHECK(ctx.glUniform4f(g_uniform_locations[GLES2_UNIFORM_COLOR], 1.0f, 1.0f, 1.0f, 1.0f));
- float *verts = g_verts;
-
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_ANGLE, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (verts + 16)));
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_TEXCOORD, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) (verts + 8)));
GL_CHECK(ctx.glVertexAttribPointer(GLES2_ATTRIBUTE_POSITION, 2, GL_FLOAT, GL_FALSE, 0, (const GLvoid *) verts));
@@ -406,7 +405,7 @@ void loop()
if (0)
{
- float *f = matrix_mvp;
+ float *f = (float *) matrix_mvp;
SDL_Log("-----------------------------------");
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
SDL_Log("[ %f, %f, %f, %f ]", *f++, *f++, *f++, *f++);
@@ -417,13 +416,17 @@ void loop()
renderCopy_angle(g_angle);
- int w, h;
- SDL_GL_GetDrawableSize(state->windows[0], &w, &h);
- SDL_Rect rs, rd;
- rs.x = 0; rs.y = 0; rs.w = g_surf_sdf->w; rs.h = g_surf_sdf->h;
- rd.w = g_surf_sdf->w * g_val; rd.h = g_surf_sdf->h * g_val;
- rd.x = (w - rd.w) / 2; rd.y = (h - rd.h) / 2;
- renderCopy_position(&rs, &rd);
+ {
+ int w, h;
+ SDL_Rect rs, rd;
+
+ SDL_GL_GetDrawableSize(state->windows[0], &w, &h);
+
+ rs.x = 0; rs.y = 0; rs.w = g_surf_sdf->w; rs.h = g_surf_sdf->h;
+ rd.w = g_surf_sdf->w * g_val; rd.h = g_surf_sdf->h * g_val;
+ rd.x = (w - rd.w) / 2; rd.y = (h - rd.h) / 2;
+ renderCopy_position(&rs, &rd);
+ }
if (!done) {
@@ -544,6 +547,7 @@ main(int argc, char *argv[])
SDL_memset(matrix_mvp, 0, sizeof (matrix_mvp));
{
+ SDL_Surface *tmp;
char *f;
g_use_SDF = 1;
g_use_SDF_debug = 0;
@@ -558,7 +562,7 @@ main(int argc, char *argv[])
/* Load SDF BMP image */
#if 1
- SDL_Surface *tmp = SDL_LoadBMP(f);
+ tmp = SDL_LoadBMP(f);
if (tmp == NULL) {
SDL_Log("missing image file: %s", f);
exit(-1);