From 6bab8267ebaa324ff0cbd32303ad04ae4bc998b9 Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 2 Nov 2017 17:58:56 +0200 Subject: desktop-main.cpp: round the fractional part of the GL version When verMinor is extracted with the glGetString() method, use roundf() to round the GL MINOR version to an integer. 2.1 is split in 2 and 1. Without this patch rounding issues are present as for 32bit IEEE the default rounding makes (0.1f * 10.f) into 0.999999f. Given the MINOR is a single digit for GL, calling roundf() on 0.999999 gives the expected result 1 for the MINOR. Reported-by: Murillo Fernandes Bernardes Signed-off-by: Lubomir I. Ivanov --- subsurface-desktop-main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'subsurface-desktop-main.cpp') diff --git a/subsurface-desktop-main.cpp b/subsurface-desktop-main.cpp index a37fd3cb5..ff92236a9 100644 --- a/subsurface-desktop-main.cpp +++ b/subsurface-desktop-main.cpp @@ -190,7 +190,7 @@ void validateGL() } if (sscanf(verChar, "%f", &verFloat) == 1) { verMajor = (GLint)verFloat; - verMinor = (GLint)((verFloat - verMajor) * 10.f); + verMinor = (GLint)roundf((verFloat - verMajor) * 10.f); } } // attempt to detect version using the newer API -- cgit v1.2.3-70-g09d2