The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Emscripten port...
Ryan C. Gordon
Guest

The Emscripten support is now in revision control!

https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C
or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API,
compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration,
render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL
1.2 API (written by hand in Javascript), but this new work makes it so
you can just compile SDL2's actual code with Emscripten, along with the
new backends for video, audio, etc, and link the resulting library to
your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's
pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki,
Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all
their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Emscripten port...
Pallav Nawani


Joined: 19 May 2011
Posts: 122
Location: Dehradun, India
This looks awesome.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter:  http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768



On Wed, Dec 24, 2014 at 2:39 PM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Emscripten port...
Joseba García Etxebarria
Guest

This seems like magic!

Thank you very much for sharing, Ryan, and to all those who also work hard to get it to work!.


Joseba


On Wed, Dec 24, 2014 at 10:29 AM, Pallav Nawani wrote:
Quote:
This looks awesome.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter:  http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768



On Wed, Dec 24, 2014 at 2:39 PM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Emscripten port...
M. Gerhardy
Guest

hi.



a small showcase of my game compiled with emscripten+sdl2


the code is available on github at https://github.com/mgerhardy/caveexpress


to compile it on your own, just type ./configure --enable-release --target-os=html5 && make (after setting up the emscripten sdk of course)


The url to see it in actiom is:http://88.198.107.20/caveexpress.html


there are some issues left:

* the mouse cursor handling (use tab to navigate in the ui)

* esc handling doesn't go back in the ui, but closes the fullscreen mode

* no tweaks for download progress bar and so on... just wait a little bit to get the 30mb downloaded)


Feedback is welcome.


The game is also available in the android app store and on desura. have fun,


Regards

Martin

http://www.caveproductions.org


On Thu, Dec 25, 2014 at 7:05 PM, Joseba García Etxebarria wrote:
Quote:
This seems like magic!

Thank you very much for sharing, Ryan, and to all those who also work hard to get it to work!.


Joseba


On Wed, Dec 24, 2014 at 10:29 AM, Pallav Nawani wrote:
Quote:
This looks awesome.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter:  http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768



On Wed, Dec 24, 2014 at 2:39 PM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org







_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




--
http://ufoai.sf.net
http://sf.net/projects/ufoai
Emscripten port...
M. Gerhardy
Guest

Ups - updated the url: https://cdn.rawgit.com/mgerhardy/caveexpress/master/contrib/bin/html5/caveexpress.html


On Wed, Dec 24, 2014 at 10:09 AM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org



--
http://ufoai.sf.net
http://sf.net/projects/ufoai
Emscripten port...
M. Gerhardy
Guest

Updated the url:

https://rawgit.com/mgerhardy/caveexpress/master/contrib/bin/html5/caveexpress.html



On Fri, Dec 26, 2014 at 2:43 PM, M. Gerhardy wrote:
Quote:
hi.



a small showcase of my game compiled with emscripten+sdl2


the code is available on github at https://github.com/mgerhardy/caveexpress


to compile it on your own, just type ./configure --enable-release --target-os=html5 && make (after setting up the emscripten sdk of course)


The url to see it in actiom is:http://88.198.107.20/caveexpress.html


there are some issues left:

* the mouse cursor handling (use tab to navigate in the ui)

* esc handling doesn't go back in the ui, but closes the fullscreen mode

* no tweaks for download progress bar and so on... just wait a little bit to get the 30mb downloaded)


Feedback is welcome.


The game is also available in the android app store and on desura. have fun,


Regards

Martin

http://www.caveproductions.org


On Thu, Dec 25, 2014 at 7:05 PM, Joseba García Etxebarria wrote:
Quote:
This seems like magic!

Thank you very much for sharing, Ryan, and to all those who also work hard to get it to work!.


Joseba


On Wed, Dec 24, 2014 at 10:29 AM, Pallav Nawani wrote:
Quote:
This looks awesome.

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter:  http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768



On Wed, Dec 24, 2014 at 2:39 PM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org







_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org






--
http://ufoai.sf.net
http://sf.net/projects/ufoai





--
http://ufoai.sf.net
http://sf.net/projects/ufoai
Emscripten port...
M. Gerhardy
Guest

And another game is working - code is also at https://github.com/mgerhardy - the urls of the games are available on http://www.caveproductions.org (the HTML5 link in the about section)


direct links (be patient while it's loading)

caveexpress: https://cdn.rawgit.com/mgerhardy/caveexpress/master/contrib/bin/html5/caveexpress.html

cavepacker: https://cdn.rawgit.com/mgerhardy/caveexpress/master/contrib/bin/html5/cavepacker.html


On Fri, Dec 26, 2014 at 3:10 PM, M. Gerhardy wrote:
Quote:
Ups - updated the url: https://cdn.rawgit.com/mgerhardy/caveexpress/master/contrib/bin/html5/caveexpress.html


On Wed, Dec 24, 2014 at 10:09 AM, Ryan C. Gordon wrote:
Quote:

The Emscripten support is now in revision control!

    https://hg.libsdl.org/SDL/rev/8900afb78a19

This means you can now compile your SDL2-based application, written in C or C++ with Emscripten, and it will run as a web app.

For example, here's a C++ test app I wrote that uses SDL's render API, compiled with Emscripten:


https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html

(The render calls end up as WebGL, so you get hardware acceleration, render targets, etc. You can use OpenGL ES 2.0 directly if you like, too.)

You can read more about Emscripten at http://emscripten.org

Emscripten already ships with a "close enough" implementation of the SDL 1.2 API (written by hand in Javascript), but this new work makes it so you can just compile SDL2's actual code with Emscripten, along with the new backends for video, audio, etc, and link the resulting library to your Emscripten app.

There are one or two gotchas to porting your app code, but overall, it's pretty amazing how well this works.

Thanks to Charlie Birks, Sathyanarayanan Gunasekaran, Jukka Jylänki, Alon Zakai, Edward Rudd, Bruce Mitchener, and Martin Gerhardy for all their hard work on this!

--ryan.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
http://ufoai.sf.net
http://sf.net/projects/ufoai




--
http://ufoai.sf.net
http://sf.net/projects/ufoai
samleo


Joined: 04 Mar 2014
Posts: 37
Location: Brazil
Cool news
Emscripten port...
Jonathan Greig
Guest

Ryan,Your test app works fine on my Android phone using Chrome and will run fine on my linux laptop using Firefox but will not work at all using Chrome on my laptop. It ends up with this output when it fails under Chrome:


Quote:
* Engine: Log file started Tue Dec 30 15:53:23 2014
* Engine: Build string: test_renderer, revision hg-411:37f26bc0e0cc, built Dec 10 2014 15:21:26, by Clang 3.3.0
E Ini: Failed to open config file engine.ini
I Engine: Command line:
I Engine: argv[0]: ./this.program
I Renderer: Setting video mode to 800x600/windowed
I Renderer: SDL available renderers: opengles2 software
Could not create canvas: Web page was not allowed to create a WebGL context.,Sad,{"antialias":true,"alpha":false,"depth":true,"stencil":true,"majorVersion":1,"minorVersion":0}
E Renderer: SDL error: SDL_CreateRenderer (Couldn't find matching render driver)
E Renderer: Couldn't create renderer!
I Renderer: Shutting down...
I Renderer: Setting video mode to 800x600/fullscreen
I Renderer: SDL available renderers: opengles2 software
Could not create canvas: Web page was not allowed to create a WebGL context.,Sad,{"antialias":true,"alpha":false,"depth":true,"stencil":true,"majorVersion":1,"minorVersion":0}
E Renderer: SDL error: SDL_CreateRenderer (Couldn't find matching render driver)
E Renderer: Couldn't create renderer!
I Renderer: Shutting down...
* Engine: Log file ended Tue Dec 30 15:53:23 2014



My laptop has Nvidia Optimus technology in it so since the message mentioned it couldn't create a renderer I thought that it might have something to do with it using the Intel GPU or the Nvidia one. So I tried running `primusrun chromium-browser https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html` but it still fails. Is this a problem that you or others have encountered?


I'm interested in Emscripten and have played around using it a bit myself although I'm still not very familiar with many things. I've seen some really neat stuff done with it but all of it seems to be demos rather than something of actual use or production purposes. It is hard to deny that your demo is very cool though Smile


Martin,
All of your links do not work no matter what I try Sad I noticed a bit of activity on your GitHub repo when you initially posted the links and figured you were still changing stuff but they are still not working. It always results in a large gray box (probably the rendering window) with a fullscreen button beneath and then below that is another gray box (which appears to be a text box of some sort).


Cheers
Jonathan








On Sat, Dec 27, 2014 at 4:43 PM, samleo wrote:
Quote:
Cool news



My project
http://sourceforge.net/projects/dangeroustux/


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Emscripten port...
Martin Gerhardy
Guest

i will try to add a loading bar to my examples. currently you have to wait until they are loaded - which may take some time dependent on your connection. the games are working for me in chrome and firefox on linux. it just takes a few minutes until they are loaded. cavepacker is smaller (round 10mb) caveexpress is bigger (35mb) - so the first should be loaded faster. the html5 links on http://www.caveproductions.org should now always be up to date.


thanks for testing it and for the feedback. i will try to improve them.





Am 30.12.2014 um 23:06 schrieb Jonathan Greig:



Quote:
Ryan,Your test app works fine on my Android phone using Chrome and will run fine on my linux laptop using Firefox but will not work at all using Chrome on my laptop. It ends up with this output when it fails under Chrome:


Quote:
* Engine: Log file started Tue Dec 30 15:53:23 2014
* Engine: Build string: test_renderer, revision hg-411:37f26bc0e0cc, built Dec 10 2014 15:21:26, by Clang 3.3.0
E Ini: Failed to open config file engine.ini
I Engine: Command line:
I Engine: argv[0]: ./this.program
I Renderer: Setting video mode to 800x600/windowed
I Renderer: SDL available renderers: opengles2 software
Could not create canvas: Web page was not allowed to create a WebGL context.,Sad,{"antialias":true,"alpha":false,"depth":true,"stencil":true,"majorVersion":1,"minorVersion":0}
E Renderer: SDL error: SDL_CreateRenderer (Couldn't find matching render driver)
E Renderer: Couldn't create renderer!
I Renderer: Shutting down...
I Renderer: Setting video mode to 800x600/fullscreen
I Renderer: SDL available renderers: opengles2 software
Could not create canvas: Web page was not allowed to create a WebGL context.,Sad,{"antialias":true,"alpha":false,"depth":true,"stencil":true,"majorVersion":1,"minorVersion":0}
E Renderer: SDL error: SDL_CreateRenderer (Couldn't find matching render driver)
E Renderer: Couldn't create renderer!
I Renderer: Shutting down...
* Engine: Log file ended Tue Dec 30 15:53:23 2014



My laptop has Nvidia Optimus technology in it so since the message mentioned it couldn't create a renderer I thought that it might have something to do with it using the Intel GPU or the Nvidia one. So I tried running `primusrun chromium-browser https://icculus.org/~icculus/emscripten/test_renderer/test_renderer.html` but it still fails. Is this a problem that you or others have encountered?


I'm interested in Emscripten and have played around using it a bit myself although I'm still not very familiar with many things. I've seen some really neat stuff done with it but all of it seems to be demos rather than something of actual use or production purposes. It is hard to deny that your demo is very cool though Smile


Martin,
All of your links do not work no matter what I try Sad I noticed a bit of activity on your GitHub repo when you initially posted the links and figured you were still changing stuff but they are still not working. It always results in a large gray box (probably the rendering window) with a fullscreen button beneath and then below that is another gray box (which appears to be a text box of some sort).


Cheers
Jonathan








On Sat, Dec 27, 2014 at 4:43 PM, samleo wrote:
Quote:
Cool news



My project
http://sourceforge.net/projects/dangeroustux/


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org