So ... Steven Craft asked how I've setup Emscripten on my machine ... Here are some quick notes:
I'm using Emscripten in Visual Studio 2010 on Windows 7 64 Bit, so everything applies to this... and well all I've done is following the tutorial, with one exception, the toolchains to download are very important.
Follow the tutorial link above for installing Python and Node.js, but don't use the toolchains provided if (and i think you will) you plan to use visual studio. The 64 bit versions don't interact nicely with visual studio because of some weird folder issues. They also need to be compatible with each other. I had to try some different versions until I found matching ones. Grab them here: GCC Toolchain Clang Toolchain
Then just follow the tutorial again, clone emscripten, install vs-tool and such. It's pretty much straight forward again. Having done this, you'll get a new Solution Platform for you C/C++ project. Just add a new Solution Platform within the Configuration Manager. Don't copy settings over from any other platform, start with fresh (thats <Empty> in the list) settings. I dont think the settings will get copied over anyway, but it's better to start with empty ones', becase they're not compatible anyway.
It's important to use the suggested environment variables for the toolchain paths. I've tried to setup my toolchain directories directly in visual studio but that didn't work.
_____
OpenGL and Emscripten links:
https://github.com/kripken/emscripten/wiki/EGL-Support-in-Emscripten
https://github.com/kripken/emscripten/wiki/OpenGL-support
My GLES2 renderer just works out of the box with when i create the context as described above.
_____
For the game loop, you need to change your
while (true) { Update(); }
to
the current emscripten_set_main_loop does not allow you to pass some pointer, which would be handy to pass on some this pointer to your application instance, but a global variable helps - not nice but works.
emscripten_set_main_loop is defined in emscripten.h. This file can be found in <emscripten-base-dir>\system\include\emscripten\
take a look there, there are some other nice functions inside like getting/setting the size of the canvas.
__
hope that helps, if there are some more questions i'm happy to help (if i know the answers )
I'm using Emscripten in Visual Studio 2010 on Windows 7 64 Bit, so everything applies to this... and well all I've done is following the tutorial, with one exception, the toolchains to download are very important.
Follow the tutorial link above for installing Python and Node.js, but don't use the toolchains provided if (and i think you will) you plan to use visual studio. The 64 bit versions don't interact nicely with visual studio because of some weird folder issues. They also need to be compatible with each other. I had to try some different versions until I found matching ones. Grab them here: GCC Toolchain Clang Toolchain
Then just follow the tutorial again, clone emscripten, install vs-tool and such. It's pretty much straight forward again. Having done this, you'll get a new Solution Platform for you C/C++ project. Just add a new Solution Platform within the Configuration Manager. Don't copy settings over from any other platform, start with fresh (thats <Empty> in the list) settings. I dont think the settings will get copied over anyway, but it's better to start with empty ones', becase they're not compatible anyway.
It's important to use the suggested environment variables for the toolchain paths. I've tried to setup my toolchain directories directly in visual studio but that didn't work.
_____
OpenGL and Emscripten links:
https://github.com/kripken/emscripten/wiki/EGL-Support-in-Emscripten
https://github.com/kripken/emscripten/wiki/OpenGL-support
My GLES2 renderer just works out of the box with when i create the context as described above.
_____
For the game loop, you need to change your
while (true) { Update(); }
to
Code:
emscripten_set_main_loop(&Update,30,1);
emscripten_set_main_loop is defined in emscripten.h. This file can be found in <emscripten-base-dir>\system\include\emscripten\
take a look there, there are some other nice functions inside like getting/setting the size of the canvas.
__
hope that helps, if there are some more questions i'm happy to help (if i know the answers )