January 2016
Beginner
512 pages
12h 35m
English
Let's take our rendering code to a higher level. Putting OpenGL code directly into the window class requires subclassing the window class and makes the window class more and more complex. Let's follow good programming practice and separate rendering code from window code.
Create a new class and call it AbstractGLScene. It is going to be the base class for definitions of OpenGL scenes. You can derive the class (with protected scope) from QOpenGLFunctions to make accessing different GL functions easier. Make the scene class accept a pointer to QOpenGLWindow, either in the constructor or through a dedicated setter method. Make sure the pointer is stored in the class for easier access as we are going to rely ...