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

Author Topic: Does SFML work on the web?  (Read 11674 times)

0 Members and 1 Guest are viewing this topic.

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Does SFML work on the web?
« 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?

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Does SFML work on the web?
« Reply #1 on: August 19, 2015, 04:05:11 pm »
Not really.
You could try Emscripten I guess...

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: Does SFML work on the web?
« Reply #2 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).
Follow me on Twitter, why don'tcha? @select_this

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Does SFML work on the web?
« Reply #3 on: August 19, 2015, 04:06:54 pm »
Okay, I'll try something else then.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Does SFML work on the web?
« Reply #4 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, but it's not officially support for now.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Does SFML work on the web?
« Reply #5 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, 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Does SFML work on the web?
« Reply #6 on: August 19, 2015, 04:27:36 pm »
No.

IIRC Emscripten requires OpenGL ES 2 and SFML doesn't support that yet.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hydra

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Does SFML work on the web?
« Reply #7 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.

AlexAUT

  • Sr. Member
  • ****
  • Posts: 396
    • View Profile
Re: Does SFML work on the web?
« Reply #8 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
« Last Edit: August 19, 2015, 06:10:02 pm by AlexAUT »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Does SFML work on the web?
« Reply #9 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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Milerius

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Does SFML work on the web?
« Reply #10 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

 

anything