SFML community forums

Help => General => Topic started by: Hydra on August 19, 2015, 03:55:07 pm

Title: Does SFML work on the web?
Post by: Hydra on August 19, 2015, 03:55:07 pm
If for example I created a game in SFML. Is there a way I can then put it on a website like how Unity has it's special plugin for running Unity games?
Title: Re: Does SFML work on the web?
Post by: Jesper Juhl on August 19, 2015, 04:05:11 pm
Not really.
You could try Emscripten (https://github.com/kripken/emscripten) I guess...
Title: Re: Does SFML work on the web?
Post by: select_this on August 19, 2015, 04:05:23 pm
Nope, and SFML's not entirely compatible with emscripten and the like last I checked either (therocode's the guy to ask on that as I believe he investigated it a while back).
Title: Re: Does SFML work on the web?
Post by: Hydra on August 19, 2015, 04:06:54 pm
Okay, I'll try something else then.
Title: Re: Does SFML work on the web?
Post by: eXpl0it3r on August 19, 2015, 04:09:40 pm
binary1248 has once played around with a port of SFML that compiles for Emscripten and he ported my last Ludum Dare game to it. You can play it here (http://my-gate.net/pub/Synth-Guitar.html), but it's not officially support for now.
Title: Re: Does SFML work on the web?
Post by: Hydra on August 19, 2015, 04:25:43 pm
binary1248 has once played around with a port of SFML that compiles for Emscripten and he ported my last Ludum Dare game to it. You can play it here (http://my-gate.net/pub/Synth-Guitar.html), but it's not officially support for now.

Okay, so is Emscripten like Java 3D in the fact that it works but isn't up to date or very compatible?
Title: Re: Does SFML work on the web?
Post by: eXpl0it3r on August 19, 2015, 04:27:36 pm
No.

IIRC Emscripten requires OpenGL ES 2 and SFML doesn't support that yet.
Title: Re: Does SFML work on the web?
Post by: Hydra on August 19, 2015, 04:28:08 pm
No.

IIRC Emscripten requires OpenGL ES 2 and SFML doesn't support that yet.

Ah okay. Thanks.
Title: Re: Does SFML work on the web?
Post by: AlexAUT on August 19, 2015, 06:07:57 pm
Emscripten uses WebGL (Not opengl es  ;)) , but it can emulate a opengl es 2.0 enviroment, but it can also emulate legacy opengl (it's not complete but most of it: http://kripken.github.io/emscripten-site/docs/porting/multimedia_and_graphics/OpenGL-support.html#opengl-support-legacy-and-mobile) I guess binary used this mode?


Edit: emulate = they implemented the missing functions in WebGL with WebGL (so some parts may be inefficent)  :P

AlexAUT
Title: Re: Does SFML work on the web?
Post by: binary1248 on August 19, 2015, 06:26:17 pm
No... I actually ported SFML to use non-legacy GL first then ported that to emscripten. It uses the "WebGL-friendly subset of OpenGL" (i.e. OpenGL ES 2.0 without client-side arrays a.k.a. only VBOs) that yields the highest performance when translated to WebGL.

The emscripten port is not complete yet because there is currently no way to implement shared-memory multi-threading and this is why besides sf::Thread things that rely on threads like sf::Music can't work yet. According to the emscripten guys they are also waiting for JavaScript memory sharing between threads to be standardized so that they can implement pthread API emulation.
Title: Re: Does SFML work on the web?
Post by: Milerius on September 12, 2019, 10:48:46 pm
https://emscripten.org/docs/porting/pthreads.html

Seem's pthread is supported now

Do you have your code uploaded somewhere so I can finalize the port @binary1248