OpenGL
We are not experts on OpenGL, so in this part of the chapter we will not teach you to do any fancy stuff with OpenGL and Qt but rather will show you how to enable the use of your OpenGL skills in Qt applications. There are a lot of tutorials and courses on OpenGL out there so if you're not that skilled with OpenGL, you can still benefit from what is described here by employing the knowledge gained here to more easily learn fancy stuff. You can use external materials and a high-level API offered by Qt, which is going to speed up many of the tasks described in the tutorials.
Introduction to OpenGL with Qt
There are basically two ways you can use OpenGL in Qt. The first approach is to use QOpenGLWidget
. This is mostly useful if your application heavily depends on other widgets (for example. the 3D view is only one of the views in your application and is controlled using a bunch of other widgets surrounding the main view). The other way is to use QOpenGLWindow
; this is most useful when...