Tetzle says goodbye to OpenGL

Posted on June 22, 2024, under Tetzle

Many long years ago I tried using QGraphicsView to make a simple puzzle game. But I found it to be unbearably slow, possibly because I wasn’t using it correctly. Who knows. So I decided to use OpenGL to accelerate the graphics. After all, OpenGL is all about accelerating graphics! And all was good.

Well, sort of. OpenGL is not the easiest to work with. And it changed a lot over the years, forcing me to mimic my use of the old fixed-function pipeline with the newer programmable pipeline. Tetzle’s code has always been a bit hard to debug because, well, again, OpenGL is not the easiest to work with. It has also caused many issues for users over the years that I have sadly not been able to solve.

Plus, it never really sat well with me that my simple 2D puzzle game used a graphics framework that is better suited to 3D gaming. Sure, you can accelerate 2D graphics with it, but it is overkill. Especially with modern CPUs. This is just blitting 2D graphics, for sanity’s sake!

So! Every few years I would think about porting Tetzle away from OpenGL, sift through the old code I have archived, look at the mess of the QGraphicsView version and think, “Maybe later.” And, of course, later never came.

Until now.

Because Qt 6.7 doesn’t work with the current Tetzle code. Well, it does if you run Tetzle as OpenGL 1.1 or 1.3, which is just absurd. And not supported everywhere, since it’s the old fixed-function pipeline that was dropped years ago. Instead of spending time fixing it, I decided: “Now. Now is the time to finally get Tetzle free from OpenGL’s clutches.”


I still didn’t like the idea of trying to clean up the ancient QGraphicsView code that bore absolutely no resemblance to the current game. And then I had a brainwave: why not just use QPainter? It has an interface close enough to how I was using OpenGL that I can reuse most of the current code, and everything should Just Work™. And… it does! 🎉

It is embarrassing just how easy it was to get Tetzle free from OpenGL. I should have looked at QPainter before, since I do use it for some of my games instead of QGraphicsView. Hindsight is 20/20, and all that. In less than 24 hours from the initial idea, I am pleased to say that future releases of Tetzle will no longer require OpenGL!