The whole topic of fullscreen in emscripten surprisingly complex, mainly 
because the HTML5 fullscreen API is an over-engineered mess (IMHO).

The emscripten wrapper APIs try to wrap this mess into a sane C API, 
exposing different fullscreen strategies (things like: should the canvas 
stretch, or increase its resolution etc, should the 'real' HTML5 Fullscreen 
mode be used, or a 'soft fullscreen', where the canvas is maximized within 
the browser window's client area etc...)... it's all described 
here: 
https://kripken.github.io/emscripten-site/docs/api_reference/html5.h.html#fullscreen

The main problem with 'real' fullscreen mode is that it cannot be toggled 
programmatically from the C side, since the the fullscreen activation must 
happen from a Javascript input event handler which requires some back and 
forth between the C and JS side (JS input handler code calls C to request 
fullscreen change, and behind the scene, JS calls a C user callback again 
when the fullscreen state has changed).

Also last I know Safari on iOS doesn't support this 'true' fullscreen mode.

Some example code (of the C side) is 
here: 
https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/private/emsc/emscDisplayMgr.cc

I also wrote a blog post about an 'alternative soft fullscreen' mode which 
allows to layer HTML+CSS UI elements on top of the WebGL canvas (the 
standard soft-fullscreen mode will hide all other elements on the page):

http://floooh.github.io/2017/02/22/emsc-html.html

Hope this helps :)
-Floh.


Am Dienstag, 5. September 2017 18:11:16 UTC+8 schrieb Flix:
>
> Hi.
>
> Most of the time I use emscripten just to compile C++ OpenGL programs 
> (using glut, glfw or SDL2), so that they run inside browsers, without much 
> care about the Javascript code in the html shell (well, with a few 
> exceptions).
>
> In any case, I'm noticing that when I click on the *fullscreen* button 
> (inside the html window in the browser), the resize event I set on my 
> binding (glut, glfw or SDL2) does not seem to get called.
>
> So my simple questions are:
>
>    - Is there some common strategy to call the resize event when the user 
>    wants to toggle fullscreen mode inside the browser ? (I think this is less 
>    trivial than it seems, because, for example, the ESC button that is 
>    required by Firefox to exit fullscreen mode is not passed to the C++ 
> button 
>    event, as far as I know).
>    - More generally, is it possible to detect when the user resizes the 
>    browser window, and/or to know the size of the initial browser window, so 
>    that we can set the initial size based on it?
>
> Thanks in advance for your suggestions!
>
>
>

-- 
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.

Reply via email to