compile error occurs with opengl functions in webassembly env.



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

  • Lifetime Qt Champion

    Hi and welcome to the forums

    Did you install the dev lib ?

    sudo apt-get install libgl-dev



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


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    @mrjj meant the OpenGL development package.



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



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.