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>
This commit is contained in:
Lubomir I. Ivanov 2017-11-02 17:58:56 +02:00
parent 28299b0ebc
commit 6bab8267eb

View file

@ -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