0031070: Configuration - fix building issues when using Emscripten toolchain IR-2019-10-25
authorkgv <kgv@opencascade.com>
Tue, 15 Oct 2019 23:42:33 +0000 (02:42 +0300)
committerapn <apn@opencascade.com>
Sat, 26 Oct 2019 21:43:07 +0000 (00:43 +0300)
commit565baee64be039cf745ed1d46c96dbe05228f3fb
tree34981503e7068dd798f6a4d7ad92d7b3d3f5b078
parent36e28f96f677ab5799df839e3431229cabd6070b
0031070: Configuration - fix building issues when using Emscripten toolchain

Handled __EMSCRIPTEN__ macros to:
- Workaround atomics (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is undefined, but GCC atomics are provided).
- Suppress non-standard header <sys/signal.h> warning.
- Return OSD_LinuxREDHAT.
- Avoid inclusion of XLib headers.
- Skip fontconfig library.
- Enable EGL+GLES path (translated by Emscripten into WebGL).
- Skip eglCreatePbufferSurface() not implemented by Emscripten EGL.

Fixed Graphic3d_Vec4.hxx usage within Quantity_ColorRGBA.hxx.

OpenGl_ShaderManager::defaultGlslVersion() now prefers GLSL 300 es when WebGL 2.0 is available,
as there no any OpenGL ES greater than 3.0 emulation so far.

Shaders_Declarations.glsl - added workaround for GLSL compilation on WebGL 1.0
by defining Light properties accessors as macros instead of functions
('[]' : Index expression must be constant).

OpenGl_FrameBuffer::Init() - added workaround for initialization of GL_DEPTH24_STENCIL8
depth-stencil attachment on WebGL 1.0 + GL_WEBGL_depth_texture extension.

OpenGl_Context::Vec4FromQuantityColor() now considers myIsSRgbActive flag
to handle use case, when Immediate Layer is drawn directly into window buffer,
which is not sRGB-ready.

Added new sample - OCCT WebGL viewer.
37 files changed:
dox/FILES_HTML.txt
dox/overview/images/sample_webgl.png [new file with mode: 0644]
dox/overview/overview.md
samples/webgl/.gitignore [new file with mode: 0644]
samples/webgl/CMakeLists.txt [new file with mode: 0644]
samples/webgl/ReadMe.md [new file with mode: 0644]
samples/webgl/WasmOcctView.cpp [new file with mode: 0644]
samples/webgl/WasmOcctView.h [new file with mode: 0644]
samples/webgl/WasmVKeys.h [new file with mode: 0644]
samples/webgl/main.cpp [new file with mode: 0644]
samples/webgl/occt-webgl-sample.html [new file with mode: 0644]
src/Aspect/Aspect_DisplayConnection.cxx
src/Aspect/Aspect_DisplayConnection.hxx
src/Aspect/Aspect_FBConfig.hxx
src/Aspect/Aspect_XWD.hxx
src/Font/Font_FontMgr.cxx
src/InterfaceGraphic/InterfaceGraphic.hxx
src/OSD/OSD_Chronometer.cxx
src/OSD/OSD_MemInfo.cxx
src/OSD/OSD_Path.cxx
src/OSD/OSD_signal.cxx
src/OpenGl/OpenGl_Context.cxx
src/OpenGl/OpenGl_Context.hxx
src/OpenGl/OpenGl_FrameBuffer.cxx
src/OpenGl/OpenGl_GlFunctions.hxx
src/OpenGl/OpenGl_GraphicDriver.cxx
src/OpenGl/OpenGl_GraphicDriver.hxx
src/OpenGl/OpenGl_ShaderManager.cxx
src/OpenGl/OpenGl_Window.cxx
src/Quantity/Quantity_ColorRGBA.cxx
src/Shaders/Declarations.glsl
src/Shaders/DeclarationsImpl.glsl
src/Shaders/Shaders_DeclarationsImpl_glsl.pxx
src/Shaders/Shaders_Declarations_glsl.pxx
src/Standard/Standard_Atomic.hxx
src/Xw/Xw_Window.cxx
src/Xw/Xw_Window.hxx