Search code examples
javascriptc++openframeworks

How to render openFrameworks app to host on browser


I'm new to both openFrameworks and this compiler called Emscripten. After struggling for a few days, I was able to compile my openFrameworks/C++ code into js but Emscripten gives me an html file with a lot of junk included (For example, there is a header and footer - http://openframeworks.cc/setup/emscripten/)

I'm trying to host the video/animation itself like it is on this page (http://www.syedrezaali.com/#/great-scott/) but I have no idea how to go about it. Can anyone help me out?

Thank you


Solution

  • If you follow OF's guidelines Emscripten generates not only the html file but also some other files (I think it's 4 files in total). You need to copy all of those into your site, then link to the html file.

    Notice that while developing you can use

    emrun --browser chrome bin/yourSample.html

    To open the file, but you cannot just open the .html file (not sure why). See this guidelines as well, which are linked in the OF tutorial.

    Update

    I haven't tested this, but it looks like OF loads a site template. See this makefile for emscripten, you may specify your own via PROJECT_EMSCRIPTEN_TEMPLATE or you could just change the template OF uses.