Using multiple OpenGL versions

Earlier in this chapter, we discussed a family of QOpenGLFunctions classes that provide access to OpenGL functions included in a specific OpenGL profile. If your whole application can use one profile, you can just select the appropriate Qt class and use it. However, sometimes you don't want the application to shut down completely if the requested profile is not supported on the current system. Instead, you can relax your requirements and use an older OpenGL version and provide simplified but still working rendering for systems that don't support the new profile. In Qt, you can implement such an approach using QOpenGLContext::versionFunctions():

class MyWindow : public QOpenGLWindow { protected: QOpenGLFunctions_4_5_Core ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.