Created
March 26, 2019 18:49
-
-
Save sortofsleepy/c6f2ecc0b3f64f9a604339d0c149b9aa to your computer and use it in GitHub Desktop.
Sample of how to call JS from Emscripten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <emscripten/bind.h> | |
| using namespace emscripten; | |
| // note - assuming you're including your own javascript | |
| auto window = val::global("window"); | |
| // come up with a function to create a video element. | |
| emscripten::val videoElement = window.call<void>("MyVideoElementCreationFunction"); | |
| videoElement.set("src","url to video"); | |
| // make a texture | |
| GLuint tex = glCreateTexture(); | |
| // texture should be populated in JS under the GL.textures array, set an ID on the element | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment