TAGS :Viewed: 15 - Published at: a few seconds ago

[ Porting my C++ app to run in a browser ]

Is there an easy way to port a C++ OpenGL app to a browser? It's already ported to PC, Mac and iOS. If there is some relatively easy way, would that be portable between computer browsers? I would have to use different binaries for different platforms, of course. I remember hearing something about some sandboxed environment for Chrome some time ago, but that would exclude the other browsers. How did they (id?) do with Quake in the browser?

Answer 1


If you're already targeting ES 2.0 for iOS your shaders should work as-is with WebGL. JavaScript ahoy!

id Software uses a giant plugin for Quake Live.

Answer 2


Try Google's Native Client or NaCl, if you want a lazy port.

But if you want to do a real port - refer to those two examples:

  • blog series about porting existing C++ game to html5 (sponsored by Opera)
  • short article about porting existing Objective-C game to html5 (sponsored by Microsoft).
  • sad example of porting popular copyrighted game from C to JavaScript (sponsored by Mozilla, with extra help of Zenimax)

If you was asking about QuakeLive - that is a custom plugin, made by Id Software. Similar functionality can be achieved with Flash or Unity plugins.

Answer 3


You can use Mandreel if you want the least amount of work. Another option is Emscripten but that only converts your C++, it doesn't provide all the APIs like Mandreel does.

Answer 4


Is there an easy way to port a C++ OpenGL app to a browser? It's already ported to PC, Mac and iOS. If there is some relatively easy way, would that be portable between computer browsers?

You could try to recompile it into JavaScript, that's what browsers execute. If you don't expect the user to install some browser plugin, you can't give them native code. Of course when in a JavaScript environment many of the things you're accustomed from native executables don't work. For examples you no longer can access a file system. You must use either DOM storage, cookies, download/upload resources from a server.