summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-02 17:58:56 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-02 17:30:49 +0100
commit6bab8267ebaa324ff0cbd32303ad04ae4bc998b9 (patch)
tree92922ff0eeb91dca3cec411ffe496aea9a891927
parent28299b0ebcb47c43a2efcaac9dcb1c2a59d41323 (diff)
downloadsubsurface-6bab8267ebaa324ff0cbd32303ad04ae4bc998b9.tar.gz
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 <notifications@github.com> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
-rw-r--r--subsurface-desktop-main.cpp2
1 files changed, 1 insertions, 1 deletions
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