Part 2 – Modern OpenGL Using Qt 5.5 Tutorial

Have a look at Part 1  if you are new to OpenGL or Qt. In Part 1 I introduced the two technologies and gave some important tips for getting started correctly. If you want to build this project with CMake and Qt Creator, here is a CMakeLists.txt file with instructions on how to do it.

Let’s get started!
This tutorial will show you how to draw a colored triangle similar to the QOpenGLWindow example that ships with Qt but using modern OpenGL. I don’t want to just explain the code, but instead plan on gathering all the little tips and gotchas I have found in order to really help you understand where to go from here.  I chose to develop for OpenGL version 3.1 because that is the max my laptop has and for anyone with money and interest to buy a 3D program they probably have that supported by their graphics card in their computer. 3.1 was released on March 24, 2009. Most graphics cards purchased after that will support 3.1. I will try and keep things as close to the existing examples as possible so that you can see exactly what changes when going from straight OpenGL to using Qt. This example will be broken down as follows. Continue reading


Part 1 – Modern OpenGL Using Qt 5.5 Tutorial

I am so excited to post this! This is part 1 in a series of tutorials demonstrating how to render 2D/3D objects using the builtin functions of Qt 5.5. Part 1 will just be information to help you get started on the right foot. Part 2 will be drawing a basic triangle using the QOpenGLWindow class. Click here to go to Part 2 for example code.

I have been working on converting any basic OpenGL tutorial using modern OpenGL (3+) and Qt for a while now. Many OpenGL examples you see use the outdated fixed pipeline OpenGL.
Continue reading