OpenGL Example - Cube Doesn't run
-
When I try to run the example program, OpenGL/cube, I get the following 2 errors,
C:\QtSDK\Examples\4.7\opengl\cube-build-desktop..\cube\mainwidget.cpp:135: error: 'GL_TEXTURE0' was not declared in this scope
C:\QtSDK\Examples\4.7\opengl\cube-build-desktop..\cube\mainwidget.cpp:135: error: 'glActiveTexture' was not declared in this scope
What can I do to solve this?
-
This is caused by a bug in the Cube example which has already been fixed in our repository for an upcoming version. Applying the following patch should solve it for you:
@
#ifndef GEOMETRYENGINE_H
#define GEOMETRYENGINE_H+#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>-class GeometryEngine
+class GeometryEngine : protected QGLFunctions
{
public:
GeometryEngine();
@ -
Previous errors hasn't solved. It also says,
C:\QtSDK\Examples\4.7\opengl\cube-build-desktop..\cube\geometryengine.h:4: error: QtOpenGL/QGLFunctions: No such file or directory
Code:
@#ifndef GEOMETRYENGINE_H
#define GEOMETRYENGINE_H#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>class GeometryEngine : protected QGLFunctions
{
public:
GeometryEngine();
virtual ~GeometryEngine();void init(); void drawCubeGeometry(QGLShaderProgram *program);
private:
void initCubeGeometry();GLuint *vboIds;
};
#endif // GEOMETRYENGINE_H@
-
The qglfunctions.cpp is only available in Qt 4.8, so this example will not build against Qt 4.7, you need a Qt 4.8 snapshot to make it build. I have created a "bug report":http://bugreports.qt.nokia.com/browse/QTBUG-19970 for this in our Bug Tracker.
-
We don't have an exact date for this yet, but you can find some information on this in the public roadmap provided "here":http://developer.qt.nokia.com/wiki/Category:Developing_Qt::Qt_Planning::Qt_Public_Roadmap.
-
Hi,
Download the modified cube project in the zip here
https://bugreports.qt-project.org/browse/QTBUG-24555It worked for me.