Skip to content

No glutReshapeFunc() callback on browser window resizing #7133

Closed
@erik-larsen

Description

@erik-larsen

In the test hello_world_gles.c,
the callback registered to glutReshapeFunc() is not being called when the browser window is resized, even when using html which stretches the canvas to cover the browser window ('soft fullscreen').

Here's a live example of the problem (try resizing the browser window):
https://erik-larsen.github.io/emscripten-glut-resizable/hello_world_gles.html

And here's a fix:
https://erik-larsen.github.io/emscripten-glut-resizable/hello_world_gles_resizable.html

The fix detects canvas size changes on redraws and explicitly calls glutReshapeWindow(). This doesn't seem ideal though, as the canvas size check has to be done on every frame, plus this seems like something the GLUT implementation should handle under the hood. As well, the SDL2 implementation does send resize window callbacks under similar circumstances.

I put together a repository for this issue and the workaround fix here:
https://github.com/erik-larsen/emscripten-glut-resizable

-Erik

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions