36 lines
1.3 KiB
Markdown
36 lines
1.3 KiB
Markdown
|
Emscripten webcam pixel data test
|
||
|
=================================
|
||
|
|
||
|
This is a demo program for passing image data from an HTML5 canvas object in JavaScript to an OpenGL context in a C++ program. It can be useful, for example, for developing cross-platform applications that use the same codebase to export both desktop and web versions, or for using C++ libraries and code to edit and display images on a web page.
|
||
|
|
||
|
It uses the [SPACEBOX][] engine to set up an SDL + GL environment and create a model conveniently, but it can be ported to just Emscripten.
|
||
|
|
||
|
Setup
|
||
|
-----
|
||
|
|
||
|
### Emscripten
|
||
|
|
||
|
Install the latest Emscripten version to a directory and specify the directory in the Makefile
|
||
|
|
||
|
### SPACE BOX
|
||
|
|
||
|
The [SPACEBOX][] game and interactive application framework is required for setting up SDL + OpenGL. It is being used for convenience in setting up the rendering, but this technique can be used without it. Get it from https://git.nugget.fun/nugget/spacebox and specify the path to it in the Makefile.
|
||
|
|
||
|
Compiling
|
||
|
---------
|
||
|
|
||
|
Run at the root of the directory after setting up Emscripten and SPACEBOX
|
||
|
|
||
|
make emscripten
|
||
|
|
||
|
Running
|
||
|
-------
|
||
|
|
||
|
Run at the root of the directory to create an HTTP server
|
||
|
|
||
|
python -m http.server
|
||
|
|
||
|
Browse to http://localhost:8000 to view the demo
|
||
|
|
||
|
[SPACEBOX]: https://git.nugget.fun/nugget/spacebox
|