Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved compile error occurs with opengl functions in webassembly env.

    General and Desktop
    3
    6
    456
    Loading More Posts
    • 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.
    • C
      chorongu last edited by chorongu

      When I compile following OpenGL source, it worked well
      on MS Windows 10 desktop.
      But compile error occured in webassembly compilation environment
      like below in Ubuntu. I can't figure out what's wrong.

      It's Qt 5.13.0 which compiled the source with wasm.
      The OS is Ubuntu 18.04.2.


      widget.cpp:68:5: error: use of undeclared identifier 'glColor3f'
      glColor3f(1.0f, 0.0f, 0.0f);
      ^
      widget.cpp:70:5: error: use of undeclared identifier 'glBegin'
      glBegin(GL_LINE_STRIP);
      ^
      widget.cpp:71:5: error: use of undeclared identifier 'glVertex3f'
      glVertex3f(-0.5f, 0.5f, 0);
      ^
      widget.cpp:72:5: error: use of undeclared identifier 'glVertex3f'
      glVertex3f(0.5f, 0.5f, 0);
      ^
      widget.cpp:73:5: error: use of undeclared identifier 'glVertex3f'
      glVertex3f(0.5f, -0.5f, 0);
      ^
      widget.cpp:74:5: error: use of undeclared identifier 'glVertex3f'
      glVertex3f(-0.5f, -0.5f, 0);
      ^
      widget.cpp:75:5: error: use of undeclared identifier 'glEnd'
      glEnd();
      ^
      widget.cpp:77:5: error: use of undeclared identifier 'glEnd'
      glEnd();


      glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
      glClear(GL_COLOR_BUFFER_BIT);
      
      glColor3f(1.0f, 0.0f, 0.0f);
      
      glBegin(GL_LINE_STRIP);
      glVertex3f(-0.5f, 0.5f, 0);
      glVertex3f(0.5f, 0.5f, 0);
      glVertex3f(0.5f, -0.5f, 0);
      glVertex3f(-0.5f, -0.5f, 0);
      glEnd();
      
      glEnd();
      glFlush();
      
      1 Reply Last reply Reply Quote 0
      • C
        chorongu last edited by

        WebAssembly uses WebGL while both OpenGL and WebGL are not same.
        Different function systems are there.

        glDrawArrays can draw lines instead of calling glVertex3f continuously
        in boundary of glBegin and glEnd.

        I am answering my own question.

        1 Reply Last reply Reply Quote 0
        • mrjj
          mrjj Lifetime Qt Champion last edited by

          Hi and welcome to the forums

          Did you install the dev lib ?

          sudo apt-get install libgl-dev

          C 1 Reply Last reply Reply Quote 2
          • C
            chorongu @mrjj last edited by chorongu

            @mrjj
            Of course, build-essential also installed.
            I guess that there is bugs with Qt 5.13.0 because it's beta version.

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by SGaist

              Hi and welcome to devnet,

              @mrjj meant the OpenGL development package.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              C 1 Reply Last reply Reply Quote 1
              • C
                chorongu @SGaist last edited by

                @SGaist
                I've installed libgl-dev as well as build-essential.

                1 Reply Last reply Reply Quote 0
                • C
                  chorongu last edited by

                  WebAssembly uses WebGL while both OpenGL and WebGL are not same.
                  Different function systems are there.

                  glDrawArrays can draw lines instead of calling glVertex3f continuously
                  in boundary of glBegin and glEnd.

                  I am answering my own question.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post