Page 1 of 1
libnx windowing
Posted: Wed Sep 11, 2019 7:25 pm
by Rajveer
I'm porting a project over to the Switch and am currently working on windowing. The project supports multiple windows and also creates a hidden system-owned window for OpenGL calls off-screen. I'm using
and
to retrieve a display handle and to create a layer, and then attempting to call
multiple times, however it looks like it only succeeds the first time I call it. Is this expected?
Re: libnx windowing
Posted: Thu Sep 12, 2019 12:04 pm
by fincs
The system only allows applications to create a single (normal) layer. There isn't really a windowing system on the Switch, layers created by applications are fullscreen. EGL also allows you to create OpenGL contexts without assigning a window surface IIRC (and you can switch between contexts using eglMakeCurrent) so you could try doing that instead of creating a dummy hidden window.
Re: libnx windowing
Posted: Thu Sep 12, 2019 11:37 pm
by Rajveer
Thanks for the prompt reply. Just to clarify is a layer tied to a single native window, and what sort of non-normal layers are there (I see in code that there is a stray layer, but not sure what it is)?
Regarding the windowless contexts, I tried creating a pbuffer but it looks like eglChooseConfig fails as it's not supported on Tegra, do you mean a surfaceless context with EGL_KHR_surfaceless_context?
Re: libnx windowing
Posted: Fri Sep 13, 2019 2:26 am
by fincs
Rajveer wrote: Just to clarify is a layer tied to a single native window, and what sort of non-normal layers are there (I see in code that there is a stray layer, but not sure what it is)?
A native window is just an accesor object that allows users to present content to a layer. Applications only use regular layers. Stray layers are not used by application code (I forgot exactly what the system internally uses them for).
Rajveer wrote:do you mean a surfaceless context with EGL_KHR_surfaceless_context?
Yes. I haven't tested, but I think EGL_KHR_surfaceless_context should work. If it doesn't then please let us know/post code. Preferably
the issue tracker should be used for that.
Re: libnx windowing
Posted: Fri Sep 13, 2019 11:13 am
by Rajveer
Awesome, thanks for all your help