Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenGL Example - Cube Doesn't run
Forum Updated to NodeBB v4.3 + New Features

OpenGL Example - Cube Doesn't run

Scheduled Pinned Locked Moved General and Desktop
12 Posts 5 Posters 10.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iamcreasy
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SimonL
      wrote on last edited by
      #2

      is the Qt+=opengl in your .pro file to tell the compiler to use the opengl examples. Also what is your current operating system?

      1 Reply Last reply
      0
      • I Offline
        I Offline
        iamcreasy
        wrote on last edited by
        #3

        added this line in the cubo.pro file,

        QT += opengl

        but, no change. Still, its showing 2 errors.

        I am using windows 7.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sigrid
          wrote on last edited by
          #4

          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();
          @

          1 Reply Last reply
          0
          • I Offline
            I Offline
            iamcreasy
            wrote on last edited by
            #5

            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@

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sigrid
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • I Offline
                I Offline
                iamcreasy
                wrote on last edited by
                #7

                Any idea when Qt 4.8 is gonna be available?

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sigrid
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    iamcreasy
                    wrote on last edited by
                    #9

                    I really needed to run this example to investigate some procedures. Is there any way to run this example? :(

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      Sure, get a Qt 4.8 from GIT, and compile it yourself. That should work.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mikecarlos
                        wrote on last edited by
                        #11

                        Hi,

                        Download the modified cube project in the zip here
                        https://bugreports.qt-project.org/browse/QTBUG-24555

                        It worked for me.

                        1 Reply Last reply
                        0
                        • I Offline
                          I Offline
                          iamcreasy
                          wrote on last edited by
                          #12

                          Thank you!

                          I'll check it out sometime later.

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved