Warning: #warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined [-Wcpp]
Asked Answered
S

1

6

I am configuring a program that works with glut to work with Qt. I am using Qt 5.1.1. and it seems that some of openGL functionality has been lost from Qt4 to Qt5. In my program I create a QOpenGLContext and I am trying to render to a QWindow with the use of a vbo. The vbo part works fine.

Some of the other parts of the program depends on glew. I get the following warning when I run the program

#warning qopenglfunctions.h is not compatible with GLEW, GLEW defines will be undefined  [-Wcpp]
#warning To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h [-Wcpp]

The output to the screen is black.

When I comment out the line

glBindBuffer(GL_PIXEL_UNPACK_BUFFER, vboId);

which sends the pbo to the texture, a random image renders to the screen. I assume that this random image is stored in the memory which I am trying to access.

Obviously, you cannot use glew and qopenglfunctions together.

If you want to suggest that I use a QGLWidget and not a QopenGLContext with a QWindow, please explain to me how to use QGLWidget with cmake in Qt 5.1.1. I have read numerous answers suggesting that, but none of them works in Qt 5.1.1.

Sectorial answered 10/12, 2013 at 9:54 Comment(1)
github.com/YuvalNirkin/face_swap/issues/24 here someone says to ignore itEwing
E
0

To use GLEW with Qt, do not include <qopengl.h> or <QOpenGLFunctions> after glew.h [-Wcpp]

As the warning suggests, you should omit the QOpenGLFunctions include directives in favour of the GLEW includes. QT includes the QOpenGLFunctions header somewhere in an internal file.

Edina answered 22/9, 2014 at 12:41 Comment(2)
Hi @Edina What was the workaround you mentioned and did it work ?Locoism
Hi @BarryRogerson, I don't think I managed to find a working workaround, at least I can't remember that I did. It's been 6 years and my memory is awful :SEdina

© 2022 - 2024 — McMap. All rights reserved.