WebAssembly-WebGL-2 icon indicating copy to clipboard operation
WebAssembly-WebGL-2 copied to clipboard

How does it know how to translate glfw calls to canvas?

Open trusktr opened this issue 6 years ago • 4 comments

There's not a lot of code in here. How does the emscripten compile process know how to translate glfw window-creating calls to some sort of canvas output? In other words, how does emscripten know to translate cross-platform window-making calls into some sort of rectangles within the application? Seems like pure magic. Or does Emscripten have to explicitly support glfw before glfw cpuld be used, so that it can map calls to some DOM calls?

And the GL calls? Does it only work with gles, and emscripten knows how to translate to WebGL calls?

trusktr avatar Nov 16 '17 00:11 trusktr

It might help to know: what can I do, and what can't I do?

trusktr avatar Nov 16 '17 00:11 trusktr

I've been wondering something similar myself; if you search for *glfw* in the Emscripten installation, you find quite a bunch of related files, such as library_glfw.js. AFAICT most of the "magic" happens in there.

floe avatar Dec 20 '17 13:12 floe

Does that mean that we have to use glfw if we want to compile GL-capable programs to the web using Emscripten?

For example, what if there's some C++ game engine written using something other than glfw? Will it involve having to refactor it to use glfw?

trusktr avatar Feb 03 '18 00:02 trusktr

AFAICT yes, only GLFW for now. Support for other GL frameworks would require writing a new emscripten wrapper first.

floe avatar Feb 05 '18 21:02 floe