PDA

View Full Version : Starting OpenGL with Qt



franky
24th September 2017, 09:05
I need to start learning OpenGL now and the book I read (C++-GUI-Programming-with-Qt-4-2nd Edition) covers it in chapter 20 while I'm now reading chapter 5!

1- What are the benefits of learning OpenGL "with" Qt?
2- What should I read to be familiar with Qt OpenGl? Preferably a step-by-step book/tut.
Docs haven't helped me so far except for seeing a function of a given class. So if there is a good tut apart from docs, I will be very happy to have that.

3- What's your opinion about this tut (https://learnopengl.com/)? Would you agree if I continue reading the book and starting it at the same time.

Overall, what would your suggestions be for a C++/Qt programmer that likes to start OpenGL?

Thanks.

d_stranz
24th September 2017, 21:16
1- What are the benefits of learning OpenGL "with" Qt?

If you aren't doing any 3D graphics, then there isn't much point to learning OpenGL. If you are, then you'll probably need to learn it unless you can use one of the 3D scene graph modeling libraries like Coin3D, Ogre3D, or now Qt3D.


2- What should I read to be familiar with Qt OpenGl? Preferably a step-by-step book/tut.

The Qt tutorials are a place to start, but they are so simple and basic that they are mostly meaningless as a way to really learn OpenGL. I have found the tutorials on the NeHe website (http://nehe.gamedev.net/) to be useful. Remember that Qt's visible support for OpenGL is mostly just to provide some container classes to allow OpenGL wondows to be hosted in a Qt application. Qt Quick / QML is supposed to be implemented largely in OpenGL under the hood.


3- What's your opinion about this tut?

Seems pretty good. Focus on learning the "Core" OpenGL with shaders, etc. and forget the immediate mode methods.


Overall, what would your suggestions be for a C++/Qt programmer that likes to start OpenGL?

First, find a book based on Qt 5. Qt 4's OpenGL support is basically obsolete in that it focuses primarily on the immediate mode style. Qt 5 introduced new high level classes for OpenGL support, and you should be using Qt5 with them in any new code you write.

For pure OpenGL learning, the "OpenGL Programming Guide" (aka the "red book"), "OpenGL Development Cookbook", "OpenGL Shading Language", and "OpenGL 4.0 Shading Language Cookbook" books are worth having. Don't get any book that doesn't cover at least OpenGL 3.3 or later.

franky
25th September 2017, 07:46
Thank you for the answer.

Does Qt cover all what OpenGl has? If it covers all, so using a Qt book explaining OpenGl sounds better because it will be more relevant for my work too.

On the other word, do you think it's better I read a book on pure OpenGl or one that uses Qt for teaching OpenGl?

d_stranz
25th September 2017, 15:48
Does Qt cover all what OpenGl has?

The QOpenGL... classes cover a large part of OpenGL, but really they are just a very thin wrapper around the core OpenGL functions. See QAbstractOpenGLFunctions. You still need to learn OpenGL itself to be able to use them. If you read a book on OpenGL and learn it that way, understanding and using the Qt wrapper will be easy because there is nearly a 1 - 1 match between the names of methods in OpenGL and the Qt wrapper.

One other book I forgot to mention is the "OpenGL Super Bible", a good companion to the "red book". Be sure to get the latest versions of any book you buy. OpenGL has changed a lot in the last 10 years and you don't want to be teaching yourself from an obsolete book.

franky
27th September 2017, 07:25
Thank you very much for your guidance.

I also found other books useful for learning.
http://openglbook.com/the-book.html
https://learnopengl.com/

As the decision point, which of those four books would you recommend me if I only have time for one of them now, please?

d_stranz
27th September 2017, 16:25
The "learnopengl" book looks like a good place to start before you buy anything.

I think you pretty much have to buy the red book at some point (OpenGL Programming Guide). I have a very old copy of the OpenGL Superbible (2007), but I ordered the latest edition this week. When I receive it I will let you know if it is worth having.

Otherwise, there are a lot of excellent online resources, as you are discovering.

franky
27th September 2017, 17:25
Thanks so much.
I could find the red book 9th edition and I'm reading it now. It seems great it starts from OpenGL 4.5 and it's my choice for learning OpenGL.