Skip to content

Commit

Permalink
Fixed compiler warning and use higher precision in angle calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 30, 2018
1 parent 207428b commit 90a5607
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/render/opengles2/SDL_render_gles2.c
Expand Up @@ -1857,8 +1857,6 @@ GLES2_RenderCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *s
return GL_CheckError("", renderer);
}

#define PI 3.14159265f

static int
GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect,
const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
Expand All @@ -1880,7 +1878,7 @@ GLES2_RenderCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_CENTER);
data->glEnableVertexAttribArray(GLES2_ATTRIBUTE_ANGLE);

radian_angle = PI * (360.0f - angle) / 180.f;
radian_angle = (float)(M_PI * (360.0 - angle) / 180.0);
fAngle[0] = fAngle[2] = fAngle[4] = fAngle[6] = (GLfloat)SDL_sin(radian_angle);
/* render expects cos value - 1 (see GLES2_VertexSrc_Default_) */
fAngle[1] = fAngle[3] = fAngle[5] = fAngle[7] = (GLfloat)SDL_cos(radian_angle) - 1.0f;
Expand Down

0 comments on commit 90a5607

Please sign in to comment.