compile error occurs with opengl functions in webassembly env.
-
wrote on 4 Apr 2019, 03:13 last edited by chorongu 4 Apr 2019, 05:06
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();
-
wrote on 5 Apr 2019, 08:38 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.
-
Hi and welcome to the forums
Did you install the dev lib ?
sudo apt-get install libgl-dev
-
Lifetime Qt Championwrote on 4 Apr 2019, 05:34 last edited by SGaist 4 Apr 2019, 05:35
Hi and welcome to devnet,
@mrjj meant the OpenGL development package.
-
wrote on 5 Apr 2019, 08:38 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/6