How to work with OpenGL and QT?

I am working on a small project and I need to work with OpenGL + QT

I am new to both. Therefore, I need a good tutorial that illustrates how to work with them with each other not individually.

Is it better to work with OpenGL on QT Creator or use the QT Visual Studio Plug-in?

+6
source share
3 answers

You will use QGLWidget lot! Here you are:

http://doc.qt.io/qt-5/examples-widgets-opengl.html

Of all these, perhaps this is the best of them: Hello GL example . If you prefer to use Qt Quick instead of Qt Widgets, check out these posts:

If you need a 3D API of a higher level than OpenGL, since o Qt 5.7 Qt 3D has become stable .

Regarding the IDE, I suggest using Qt Creator. It works from a window on Windows, and syntax highlighting and autocomplete are comparable to Visual Studio.

+9
source

You have several different options for using OpenGL in Qt. In recent years, he has changed a lot. For an introduction that should cover all the basic information, you need to start looking at this post . The old Qt OpenGL classes and its functions were called QGLxx, but now they are called QOpenGLxx and have been transferred to the QtGUI module for starters.

Many of the simple OpenGL examples with Qt (including the QOpenGLWindow example that ships with Qt) use the old OpenGL style, which should no longer be used. Here is a tutorial that updated the QOpenGLWindow example for modern OpenGL (3+). This is the simplest, most modern example that I came across.

I am the second Qt Creator, especially for training. It has much better integration with Qt help files than Visual Studio. If you plan on switching between IDEs, I would also recommend building with CMake. CMake is very similar to the built-in qmake Qt Creator, but it can work just as well with Visual Studio or other IDEs. I used some examples for training in Visual Studio and Qt Creator using CMake. Here is a simple CMake example with Qt. For my purposes, I still use the Visual Studio compiler when working in Qt Creator.

+1
source

There are several examples of using Open GL with QT in the SDK. You can open these examples in QT Creator if you want. To answer the second question, I find QT Creator much faster and more enjoyable to use than Visual Studio, but YMMV.

0
source

Source: https://habr.com/ru/post/886816/


All Articles