Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using WebGL through emscripten on an html5 canvas

I have an HTML page with a canvas I've already created and I want to draw on it using WebGL though emscripten. I want the compiled C++ code to make GL calls which will go to that canvas I created in the HTML.
All examples I've seen use SDL or OpenKODE to create the canvas. I haven't found any that take the canvas from outside.
What's the proper way to do this?

like image 204
shoosh Avatar asked Jan 28 '26 17:01

shoosh


1 Answers

You can set the canvas element of the module object,

var Module = {
  canvas: myCanvasDomElement
};
like image 70
Michal Charemza Avatar answered Jan 31 '26 06:01

Michal Charemza