Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Making SFML work with web assembly?  (Read 10452 times)

0 Members and 1 Guest are viewing this topic.

jokoon

  • Newbie
  • *
  • Posts: 35
    • View Profile
Making SFML work with web assembly?
« on: November 14, 2017, 02:54:01 pm »
Have anybody tried to build SFML to the WASM format? I've seen that wasm allows opengl calls.

It would be really cool to have SFML run in a browser :)

stuart88

  • Newbie
  • *
  • Posts: 11
    • View Profile
    • Email
Re: Making SFML work with web assembly?
« Reply #1 on: July 06, 2018, 03:33:34 pm »
Bumping this thread as I'd also like to know if there's much info on turning SFML projects in wasm files.

Cheers!

jokoon

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Making SFML work with web assembly?
« Reply #2 on: July 06, 2018, 06:49:54 pm »
I think WASM doesn't really allow OpenGL calls directly, at least not through the C API, but through WebGL calls.

I don't really know how you make JS calls from WASM and vice versa, but obviously that would be painful to adapt SFML to WASM since you would add js code to make WASM work.

I don't think WASM will allow direct C OpenGL calls in the future (but I really wish it could happen), seen how complex it is to map C functions to system/driver calls. Peeking at what glad/glew does is enough to understand that things are not simple, seen the multiple opengl versions, core or compatibility, chip bugs, etc.

So in short, my former question was naive and uninformed, but there might be details I'm not aware about.

Maxqia

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Making SFML work with web assembly?
« Reply #3 on: August 16, 2018, 07:42:04 am »
Was looking for this to turn my simple SFML game into a web app and found this.
WebAssembally seems to be designed for Emscripten, a compiler that compiles C++ into Javascript.
From the look of it, it supports OpenGL ES 2.0 and 3.0 with their C API/Libraries.
Someone would probably need to port SFML to the HTML5 C API that Emscripten provides to get it to work on the Web.

Port of SDL2 to Emscripten : https://github.com/emscripten-ports/SDL2
Emscripten API : https://kripken.github.io/emscripten-site/docs/api_reference/html5.h.html
https://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html

exoloner

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • JaK (Freebook)
    • Email
Re: Making SFML work with web assembly?
« Reply #4 on: February 05, 2019, 08:21:36 pm »
Well this is a really nice great idea, for this reasons:

  • C++ is a more friendly language to work with, as javascript is a selfish pain in the ass for the sake of its own philosophy and semantics.
  • Will solve the hard task of building the 5 binaries (iOS,OSx,Win,Android,Linux) and always demanding a constant upgrade due to google policies or SDK deprecations.

But the bad points on browsers are : less optimization and worse performance then more CPU requeriments needed, full-screen issues, browser peculiarities.