I think what happens is that the canvas and attached WebGL framebuffer is properly resized, but the GL context's viewport state (or rather your engine) isn't aware of the resize (that's why it is rendering to the lower-left-corner, since GL's origin is bottom left).
Canvas resize (apart from going fullscreen) is currently also not handled in my engine, but I played around with it a bit and got it to work this way:
- once per frame, get the current canvas size calling emscripten_get_canvas_size()
- if the canvas size has changed since last frame, do whatever needs to be done in your engine (at the simplest, change the calls to glViewport to use the new size)
With this I could simply do a 'canvas.width = x' in the browser Javascript console, and the rendering looked correkt (without the fix, I also got the 'lower-left-corner rendering').
It might also be possible to get a callback invoked from emscripten whenever the canvas size changes. There is a resize callback 'emscripten_set_resize_callback' in emscripten/html5.h which might do the right thing, although this might be called for the whole DOM, not the canvas, I'm not sure (see:
https://w3c.github.io/uievents/#event-type-resize).
Cheers,
-Floh.