mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
OpenGl_Context now skips loading functions related to mapping buffer, which are required by OpenGL ES 3.0 specs but not provided by WebGL 2.0. Message_PrinterSystemLog does not use a broken emscripten_log() anymore, which corrupted UNICODE strings. WasmOcctView::initWindow() - callbacks now set using EMSCRIPTEN_EVENT_TARGET_WINDOW instead of 0 used by older Emscripten API. Mouse callbacks now track canvas element and use EmscriptenMouseEvent::targetX/targetY instead of ::canvasX/canvasY as the latter was broken. Added emscripten_set_main_loop() setup to shut up eglSwapInterval() error message. Fixed missing \0 at the end of string converted by toUtf8Array().
This commit is contained in:
@@ -19,6 +19,13 @@
|
||||
//! Global viewer instance.
|
||||
static WasmOcctView aViewer;
|
||||
|
||||
//! Dummy main loop callback for a single shot.
|
||||
extern "C" void onMainLoop()
|
||||
{
|
||||
// do nothing here - viewer updates are handled on demand
|
||||
emscripten_cancel_main_loop();
|
||||
}
|
||||
|
||||
//! File data read event.
|
||||
extern "C" void onFileDataRead (void* theOpaque, void* theBuffer, int theDataLen)
|
||||
{
|
||||
@@ -60,6 +67,10 @@ int main()
|
||||
Handle(Message_PrinterSystemLog) aJSConsolePrinter = new Message_PrinterSystemLog ("webgl-sample", Message_Trace);
|
||||
Message::DefaultMessenger()->AddPrinter (aJSConsolePrinter); // open JavaScript console within the Browser to see this output
|
||||
Message::DefaultMessenger()->Send (TCollection_AsciiString("NbLogicalProcessors: ") + OSD_Parallel::NbLogicalProcessors(), Message_Trace);
|
||||
|
||||
// setup a dummy single-shot main loop callback just to shut up a useless Emscripten error message on calling eglSwapInterval()
|
||||
emscripten_set_main_loop (onMainLoop, -1, 0);
|
||||
|
||||
aViewer.run();
|
||||
Message::DefaultMessenger()->Send (OSD_MemInfo::PrintInfo(), Message_Trace);
|
||||
|
||||
|
Reference in New Issue
Block a user