Exploring Modern OpenGL In Qt

I did OpenGL eons ago when fixed-function pipeline was still pretty much the industry standard and most computers were still not capable of running flashy shaders at the time. However, things have changed a lot for the past few years – GPUs are getting more powerful and almost every home computer and even mobile phones are capable of running shader-heavy games. Both DirectX and OpenGL are even abandoning the fixed-function pipeline (although it still exists in the realm of compatibility profile) so that got me thinking – should I start learning that as well?

I’ve been using shaders in game engines but never in raw OpenGL. It’s quite a different experience dealing with VBO and VAO compare to the good old glBegin, glVertex3f, etc. I decided to use OpenGL with Qt because in my opinion it’s very convenient when comes to managing window events and inputs. Qt is, in-fact, more than just a window manager, it also provides a ton of helper classes which make my life easier, so why not.

I spent few days in re-learning the modern OpenGL and created a simple demo that loads an OBJ model and displays it on the screen:

The “Hello World” text appearing at the upper left corner of the window was drawn using Qt’s QPainter class which looks like this:

QPainter painter(this);
painter.drawText(10, 20, "Hello World!");
painter.end();

Just 3 lines of code! As you see, with Qt, I don’t have to re-invent my own font loader and renderer which is a pain in the arse. Qt is really powerful and can be easily integrated with OpenGL. I think I should consider making this into a game engine just for fun.

Leave a Reply

Your email address will not be published. Required fields are marked *