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. Am Sonntag, 6. Dezember 2015 04:25:33 UTC+1 schrieb Mark Sibly: > > Hi, > > Is there any trick to resizing the emscripten canvas from 'outside' the > emscripten app, ie: from some JS in the main html file? > > I have this working fine in a plain JS app, but not in an emscripten app - > the canvas seems to 'reset' to it's initial size, and repositions itself in > the lower left corner. > > Do I need to somehow notify emscripten that the canvas has changed size, > perhaps via a Module.blah call? > > I'm basically trying to add a 'splitter' between the canvas and the > console, but ultimately I'd also like to have the canvas 'full window', so > it resizes when the browser window does. > > Bye! > Mark > > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
