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?
is the Qt+=opengl in your .pro file to tell the compiler to use the opengl examples. Also what is your current operating system?
added this line in the cubo.pro file,
QT += opengl
but, no change. Still, its showing 2 errors.
I am using windows 7.
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:
+class GeometryEngine : protected QGLFunctions
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
class GeometryEngine : protected QGLFunctions
void init(); void drawCubeGeometry(QGLShaderProgram *program);
#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.
Any idea when Qt 4.8 is gonna be available?
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.
I really needed to run this example to investigate some procedures. Is there any way to run this example? :(
Sure, get a Qt 4.8 from GIT, and compile it yourself. That should work.
Download the modified cube project in the zip here
It worked for me.
I'll check it out sometime later.