3
votes

I'm using Qt 5.1 and I can't find these functions and I try to look at here

http://qt-project.org/doc/qt-5.1/qtgui/qopenglfunctions.html

they don't appear in the list, or they don't exist in the Qt?

2
Do you know how to use it. I try to include this header and make an instance of it but it doesn't work.Awirut
"but it doesn't work" How can we possibly help you with that description of the problem?cmannett85

2 Answers

2
votes

You may be interested in reading this tutorial.

It explains how to set up OpenGL with Qt 5.1, and most notably in part 2, how to use Vertex Array Objects. You have to create them using the "object-oriented" wrapper class QOpenGLVertexArrayObject instead of calling the raw C-style OpenGL functions.

0
votes

TL;DR Don't inherit from QOpenGLFunctions, inherit version 3 or later. If you're following along with https://learnopengl.com/, then use QOpenGLFunctions_3_3_Core.

Explanation : https://doc.qt.io/qt-5/qtgui-module.html "The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API." glGenVertexArrays & glBindVertexArrays are only introduced in version 3. That's why inheriting from QOpenGLFunctions doesn't give you them.