
Minor and major OpenGL version incorrect.
Posted Monday, 28 June, 2010 - 16:42 by migueltk| Project: | The Open Toolkit library |
| Version: | 1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | fixed |
Jump to:
Description
Hi, ...
Checked in the source code for tutorial, "VBOStatic" on the OpenTK 1.0 branch.
For the following code and for versionOpenGL = "3.3.9901":
string versionOpenGL = GL.GetString(StringName.Version);
int major = (int)versionOpenGL [0];
int minor = (int)versionOpenGL [2];the result is ...
major = 51
minor = 51
I understand that the code should be changed to:
string versionOpenGL = GL.GetString(StringName.Version); int major = int.Parse(versionOpenGL [0].ToString()); int minor = int.Parse(versionOpenGL [2].ToString());
now the result is ...
major=3
minor=3
Regards, ...


Comments
#1
Thanks, will fix.
#2
Also as already noted the version checks are plain wrong, (major <= 1 && minor < 5) for an error out as in this example will fail for a (hypothetical) version 0.9, the check as well as others in the examples should read if (major < 1) || (major == 1 && minor < 5) to check if at least ver 1.5 is available. This is especially relevant for the 3.x and 4.x version checks (the major < 1 doesn't look too interesting in this example...).
#3
Actually, what would be better still is:
#4
@dbacher: thanks, I wasn't aware of System.Version!
Finally fixed this in trunk r3084. This was long overdue.