emscripten + opengl on MacOs

53 views
Skip to first unread message

Александр Гурьянов

unread,
Jun 6, 2019, 3:55:59 AM6/6/19
to emscripte...@googlegroups.com
Hi guys. I am not familar with MacOs, so maybe my question is really
simple. I have a lot of projects based on OpenGL variations (GL1, ES,
ES2). Emscripten have brilliant support for it. My main OS is linux
that also provide fantastic capabilities to building OpenGL projects.
Because of that development experience is excellent when you use
linux.

Btw, some plarforms like wechat provide they tools only for Windows
and MacOs. And I am trying to migrate on MacOs, but I see that Apple
didn't support Opengl.

My question is how you guys do porting of plain OpengGL games with
emscripten under Mac? I believe that emscripten it self will compile
OpenGL project out of the box (because implemenation embeded in
emscripten). But it's only one part, I also need to have native (Mac)
version to debug projects and fix errors. Is it still possible? Or I
need to rewrite game with Vulcan API? Does emscripten support Vulcan /
Molten?

Thanks!

Shachar Langbeheim

unread,
Jun 6, 2019, 4:50:06 AM6/6/19
to emscripte...@googlegroups.com
Yes, it is possible to build macOS applications using OpenGL. You do need to check which version of OpenGL you use, since not all versions are supported - I advise you to use 4.1 or 2.
That being said, OpenGL is officially deprecated, so nothing promises you that an official release of your game will still be supported. As long as you only need to build locally for debug purposes, you should be fine, but don't assume your users could use this.

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAKOm%3DVGD%2Bk_Phzs2TG%2B0sMpaAv8TjFL7jc245zr%2BbuN3Z3ZYMQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Floh

unread,
Jun 6, 2019, 5:46:27 AM6/6/19
to emscripten-discuss
OpenGL on Mac still works, but after the deprecation various things were broken which had to be worked around in GLFW, SDL2 etc (black screen after startup, vsync broken, ...), some of the problems were fixed in minor OS updates, it's back to a state now where it can be used (at least as a native debug-target for emscripten applications).

GL on Mac has a few peculiarities though: it's only supported up to 4.1, and (AFAIK) for post-2.x GL versions, only CoreProfile is supported, so existing code often still needs to be "ported" to work on Mac.

Shameless plug: If you're not locked into the GL API, check out the Sokol project, it's a set of C headers for writing tiny-cross-platform apps:


Since fairly recently there's also a shader-cross-compiling solution (write the shaders in GLSL 450, and translate to GLSL/MSL/HLSL via SPIR-V, complete with build-process- and IDE-integration):


And here are some samples (those also compile natively to Win32, macOS, Linux, iOS and Android):



Cheers,
-Floh.

J Decker

unread,
Jun 6, 2019, 1:32:40 PM6/6/19
to emscripten-discuss
I recently was testing building my library, which for emscripten, webgl was the only viable solution... I had to update to 2.0, otherwise vertexbufferpointer wasn't working.
https:///www.d3x0r.org:444/javascript/wasmgui (first time takes a couple seconds to start, source at https://github.com/d3x0r/sack ). 
I don't have many contacts that have Mac... but the few I do have had no problems with 
It is directly emscripten event hook functions and webgl,  no SDL or any other inbetween.
Reply all
Reply to author
Forward
0 new messages