spacebox/demo/browser_webcam_test
ohsqueezy 6371f9c279 remove Sprite class 2023-06-08 20:04:40 -04:00
..
shaders example program for using a c++ program to stream a webcam in browser 2022-09-06 20:52:34 -04:00
Makefile remove Sprite class 2023-06-08 20:04:40 -04:00
Model.cpp example program for using a c++ program to stream a webcam in browser 2022-09-06 20:52:34 -04:00
Model.hpp example program for using a c++ program to stream a webcam in browser 2022-09-06 20:52:34 -04:00
README.md example program for using a c++ program to stream a webcam in browser 2022-09-06 20:52:34 -04:00
browser_webcam_test.cpp box demo android support, android file to string for reading files inside APK 2022-11-08 17:17:20 -05:00
config.json example program for using a c++ program to stream a webcam in browser 2022-09-06 20:52:34 -04:00
index.html box demo android support, android file to string for reading files inside APK 2022-11-08 17:17:20 -05:00

README.md

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