I’m new to OpenGL so this might be a stupid question. It seems like I'm missing something obvious. I can’t see how the new OpenGL classes are supposed to be useful.
There are classes for each version and profile of OpenGL. These classes have explicit methods for all the OpenGL calls supported by each version. Here's a partial list:
- QOpenGLFunctions_1_0
- QOpenGLFunctions_1_1
- QOpenGLFunctions_1_2
- QOpenGLFunctions_1_3
- QOpenGLFunctions_1_4
I assume it would be something like the following:
- query the video card and ask which version(s) of OpenGL it supports.
- instantiate a copy of the class for the highest version supported using QOpenGLContext::versionFunctions()
So how do I write code using this class? I can't predict which object I will get at run time without knowing explicitly what hardware it will run on. The base class contains no methods since they're different for every derived class. I could write a giant switch but that seems a step backward from using QOpenGLFunctions or just getting the function addresses manually.