Fixed compile warnings
authorSam Lantinga
Sat, 07 Jun 2014 18:20:25 -0700
changeset 8841b7f41b4a7929
parent 8840 9b6ddcbdea65
child 8842 f587255157cf
Fixed compile warnings
test/testgles2.c
     1.1 --- a/test/testgles2.c	Sat Jun 07 18:20:01 2014 -0700
     1.2 +++ b/test/testgles2.c	Sat Jun 07 18:20:25 2014 -0700
     1.3 @@ -99,19 +99,19 @@
     1.4   * order. 
     1.5   */
     1.6  static void
     1.7 -rotate_matrix(double angle, double x, double y, double z, float *r)
     1.8 +rotate_matrix(float angle, float x, float y, float z, float *r)
     1.9  {
    1.10 -    double radians, c, s, c1, u[3], length;
    1.11 +    float radians, c, s, c1, u[3], length;
    1.12      int i, j;
    1.13  
    1.14 -    radians = (angle * M_PI) / 180.0;
    1.15 +    radians = (float)(angle * M_PI) / 180.0f;
    1.16  
    1.17 -    c = cos(radians);
    1.18 -    s = sin(radians);
    1.19 +    c = SDL_cosf(radians);
    1.20 +    s = SDL_sinf(radians);
    1.21  
    1.22 -    c1 = 1.0 - cos(radians);
    1.23 +    c1 = 1.0f - SDL_cosf(radians);
    1.24  
    1.25 -    length = sqrt(x * x + y * y + z * z);
    1.26 +    length = (float)SDL_sqrt(x * x + y * y + z * z);
    1.27  
    1.28      u[0] = x / length;
    1.29      u[1] = y / length;
    1.30 @@ -130,7 +130,7 @@
    1.31  
    1.32      for (i = 0; i < 3; i++) {
    1.33          for (j = 0; j < 3; j++) {
    1.34 -            r[i * 4 + j] += c1 * u[i] * u[j] + (i == j ? c : 0.0);
    1.35 +            r[i * 4 + j] += c1 * u[i] * u[j] + (i == j ? c : 0.0f);
    1.36          }
    1.37      }
    1.38  }
    1.39 @@ -139,12 +139,12 @@
    1.40   * Simulates gluPerspectiveMatrix 
    1.41   */
    1.42  static void 
    1.43 -perspective_matrix(double fovy, double aspect, double znear, double zfar, float *r)
    1.44 +perspective_matrix(float fovy, float aspect, float znear, float zfar, float *r)
    1.45  {
    1.46      int i;
    1.47 -    double f;
    1.48 +    float f;
    1.49  
    1.50 -    f = 1.0/tan(fovy * 0.5);
    1.51 +    f = 1.0f/SDL_tanf(fovy * 0.5f);
    1.52  
    1.53      for (i = 0; i < 16; i++) {
    1.54          r[i] = 0.0;
    1.55 @@ -153,9 +153,9 @@
    1.56      r[0] = f / aspect;
    1.57      r[5] = f;
    1.58      r[10] = (znear + zfar) / (znear - zfar);
    1.59 -    r[11] = -1.0;
    1.60 -    r[14] = (2.0 * znear * zfar) / (znear - zfar);
    1.61 -    r[15] = 0.0;
    1.62 +    r[11] = -1.0f;
    1.63 +    r[14] = (2.0f * znear * zfar) / (znear - zfar);
    1.64 +    r[15] = 0.0f;
    1.65  }
    1.66  
    1.67  /* 
    1.68 @@ -376,19 +376,19 @@
    1.69      * Do some rotation with Euler angles. It is not a fixed axis as
    1.70      * quaterions would be, but the effect is cool. 
    1.71      */
    1.72 -    rotate_matrix(data->angle_x, 1.0, 0.0, 0.0, matrix_modelview);
    1.73 -    rotate_matrix(data->angle_y, 0.0, 1.0, 0.0, matrix_rotate);
    1.74 +    rotate_matrix((float)data->angle_x, 1.0f, 0.0f, 0.0f, matrix_modelview);
    1.75 +    rotate_matrix((float)data->angle_y, 0.0f, 1.0f, 0.0f, matrix_rotate);
    1.76  
    1.77      multiply_matrix(matrix_rotate, matrix_modelview, matrix_modelview);
    1.78  
    1.79 -    rotate_matrix(data->angle_z, 0.0, 1.0, 0.0, matrix_rotate);
    1.80 +    rotate_matrix((float)data->angle_z, 0.0f, 1.0f, 0.0f, matrix_rotate);
    1.81  
    1.82      multiply_matrix(matrix_rotate, matrix_modelview, matrix_modelview);
    1.83  
    1.84      /* Pull the camera back from the cube */
    1.85      matrix_modelview[14] -= 2.5;
    1.86  
    1.87 -    perspective_matrix(45.0, (double)width/(double)height, 0.01, 100.0, matrix_perspective);
    1.88 +    perspective_matrix(45.0f, (float)width/height, 0.01f, 100.0f, matrix_perspective);
    1.89      multiply_matrix(matrix_perspective, matrix_modelview, matrix_mvp);
    1.90  
    1.91      GL_CHECK(ctx.glUniformMatrix4fv(data->attr_mvp, 1, GL_FALSE, matrix_mvp));