Best way to create a window?

240 views
Skip to first unread message

Joel Croteau

unread,
Feb 10, 2014, 6:43:39 PM2/10/14
to emscripte...@googlegroups.com
What is the simplest/best supported API to use to create a window for OpenGL in Emscripten? I'm adapting an application that uses GLES2 for rendering. It's using X11/GLX right now, but that is overcomplicated and not well supported. I can switch to SDL, but I would rather not use SDL if that's the only thing I'm using it for. I'm looking at using either GLFW or EGL, which would be the better choice? Also, is the wiki page on EGL still up to date as far as what is/is not supported?

Jukka Jylänki

unread,
Feb 11, 2014, 6:22:30 AM2/11/14
to emscripte...@googlegroups.com
The page on EGL should be up to date. I use EGL for my engine, which has the benefit that the same code can be shared with Android. GLFW on the other hand can initialize on desktops as well. For Emscripten purposes, both should work just fine. Perhaps see the tests/ directory on the example code to initialize using those, and decide from there which you prefer better?

   Jukka


2014-02-11 1:43 GMT+02:00 Joel Croteau <jcro...@gmail.com>:
What is the simplest/best supported API to use to create a window for OpenGL in Emscripten? I'm adapting an application that uses GLES2 for rendering. It's using X11/GLX right now, but that is overcomplicated and not well supported. I can switch to SDL, but I would rather not use SDL if that's the only thing I'm using it for. I'm looking at using either GLFW or EGL, which would be the better choice? Also, is the wiki page on EGL still up to date as far as what is/is not supported?

--
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 emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Joel Croteau

unread,
Feb 12, 2014, 12:04:48 AM2/12/14
to emscripte...@googlegroups.com
I switched my code to EGL and it seems to work fairly well. One thing I did not realize is that you don't actually need to use any platform API to create a window in emscripten, as that occurs automatically. All creating a window does is resize the canvas, which can be done via emscripten_set_canvas_size, and otherwise you don't need any windowing API like you normally would with EGL. One thing I noticed on the EGL wiki page is that it says that queries to EGL_WIDTH and EGL_HEIGHT are not supported, though this appears in the linked issue to have been fixed. Is this supported or not in the current implementation?

Jukka Jylänki

unread,
Feb 12, 2014, 3:08:57 AM2/12/14
to emscripte...@googlegroups.com
The wiki page referred to this issue https://github.com/kripken/emscripten/issues/645 , which has been closed, so it is supported. I removed the link from the wiki.


Reply all
Reply to author
Forward
0 new messages