[vlc-commits] opengl: use M_PI as a single precision float

Steve Lhomme git at videolan.org
Tue Nov 8 11:38:30 CET 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Mon Nov  7 10:32:57 2016 +0100| [5f09a2625bc9c269a8c8231555e734439bc49cb8] | committer: Thomas Guillem

opengl: use M_PI as a single precision float

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f09a2625bc9c269a8c8231555e734439bc49cb8
---

 modules/video_output/opengl.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 3369281..1c52a71 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -692,8 +692,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
     if (vgl->fmt.projection_mode == PROJECTION_MODE_EQUIRECTANGULAR
         || vgl->fmt.projection_mode == PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD)
     {
-        vgl->f_teta = vgl->fmt.f_pose_roll_degrees / 180. * M_PI;
-        vgl->f_phi  = vgl->fmt.f_pose_yaw_degrees  / 180. * M_PI;
+        vgl->f_teta = vgl->fmt.f_pose_roll_degrees / 180. * (float) M_PI;
+        vgl->f_phi  = vgl->fmt.f_pose_yaw_degrees  / 180. * (float) M_PI;
     }
 
     /* */
@@ -1079,7 +1079,7 @@ static void getProjectionMatrix(float sar, GLfloat matrix[static 16]) {
     float f = 3;
     float n = 0.1;
 
-    float fovy = M_PI / 3;
+    float fovy = (float) M_PI / 3;
     float d = 1 / tan(fovy / 2);
 
     const GLfloat m[] = {
@@ -1234,12 +1234,12 @@ static int BuildSphere(unsigned nbPlanes,
     }
 
     for (unsigned lat = 0; lat <= nbLatBands; lat++) {
-        float theta = lat * M_PI / nbLatBands;
+        float theta = lat * (float) M_PI / nbLatBands;
         float sinTheta = sin(theta);
         float cosTheta = cos(theta);
 
         for (unsigned lon = 0; lon <= nbLonBands; lon++) {
-            float phi = lon * 2 * M_PI / nbLonBands;
+            float phi = lon * 2 * (float) M_PI / nbLonBands;
             float sinPhi = sin(phi);
             float cosPhi = cos(phi);
 



More information about the vlc-commits mailing list