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. compile error occurs with opengl functions in webassembly env.

compile error occurs with opengl functions in webassembly env.

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 864 Views
  • 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 Offline
    C Offline
    chorongu
    wrote on last edited by chorongu
    #1

    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
    0
    • C Offline
      C Offline
      chorongu
      wrote on last edited by
      #6

      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
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to the forums

        Did you install the dev lib ?

        sudo apt-get install libgl-dev

        C 1 Reply Last reply
        2
        • mrjjM mrjj

          Hi and welcome to the forums

          Did you install the dev lib ?

          sudo apt-get install libgl-dev

          C Offline
          C Offline
          chorongu
          wrote on last edited by chorongu
          #3

          @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
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by SGaist
            #4

            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
            1
            • SGaistS SGaist

              Hi and welcome to devnet,

              @mrjj meant the OpenGL development package.

              C Offline
              C Offline
              chorongu
              wrote on last edited by
              #5

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

              1 Reply Last reply
              0
              • C Offline
                C Offline
                chorongu
                wrote on last edited by
                #6

                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
                0

                • Login

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