Uncategorized · 06/02/2021 2

More Raspberry Pi experiments…

My little c++ opengl tutorial project now has imgui support. I have created a github repository for it here if you’d like to try it:


It still doesn’t do a whole lot, I just wrote a slightly more sophisticated shader and used imgui to let the user twiddle with the uniforms in real time.

There is also a fancy ‘demo’ widget that comes with ImGui shown in the screenshot above, on the right. ImGui has a huge variety of widgets available and the demo widget lets you have a play with them all. I was *almost* tempted to write a little compiler for its text editor, until I realized it would have to be an ‘immediate mode’ compiler (as it’s an immdiate mode GUI!), ie: you’d have to ‘feed’ the compiler a line at a time which probably involve some form of continuation mechanism inside the compiler, something c++ doesn’t support.

I also included my ‘_clang-format’ file in the repos. This provides a set of formatting rules that can be used to automatically format your c++ source code whenever you save it. For instance, it can change tabs to space, move braces around and limit line lengths etc, so that your source code can have a consistent style. This feature needs to be enabled in QtCreator via the Beautifier options in the tools-options menu. It’s a bit fiddly to get going sometimes but well worth it IMO.

Next up, I think I might try coming up with a more interesting shader, maybe attempt a starfield or blackhole or something? I think I’ve been watching too many SEA videos!