I know I'm late, but here's a more elegant solution (you don't need GLEW =))
in addition to the fact that you have QT += opengl in your * .pro file and that your version of Qt has OpenGL and that you have #include <QGLFunctions> (you do not need all the ones you specified below, only this line) in your header file, you need one more.
So, you have a class that calls all these functions:
class MeGlWindow : public QGLWidget {
You need to inherit the protected QGLFunctions class:
class MeGlWindow : public QGLWidget, protected QGLFunctions
ALSO, as soon as GLEW requires glewInit() called once before you call OpenGL functions, QGLFunctions requires you to call initializeGLFunctions() . So, for example, in QGLWidget , initializeGL() is called once before it starts to draw something:
void MeGlWindow::initializeGL() { initializeGLFunctions();
You should now be able to call glGenBuffers , glBindBuffer , glVertexAttribPointer or any openGL function without GLEW.
UPDATE : Some OpenGL functions, such as glVertexAttribDivisor and glDrawElementsInstanced , do not work with QGLFunctions . This is because QGLFunctions provides only functions specific to the OpenGL / ES 2.0 API that may not have these functions.
To get around this, you can use QOpenGLFunctions_4_3_Core (or the like), available only with Qt 5.1. Replace QGLFunctions with QOpenGLFunctions_4_3_Core and initializeGLFunctions() with initializeOpenGLFunctions() .