I am trying create webGL canvas and context in Javascript:
var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');
var buffer = gl.createBuffer();
and then use it in my cpp:
// EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context("#canvas", &attrs);...
glGenBuffers(1, &vb);
but without emscripten_webgl_create_context I always get
Uncaught (in promise) TypeError: Cannot read property 'createBuffer' of undefined
at __glGenObject (output.js:1)
if I use emscripten_webgl_create_context all works well.
what am I doing wrong? Help much appreciated!