libnx windowing

Post Reply
Rajveer
Posts: 11
Joined: Sat Jan 24, 2009 11:37 pm

libnx windowing

Post by Rajveer » Wed Sep 11, 2019 7:25 pm

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

Code: Select all

viOpenDefaultDisplay()
and

Code: Select all

viCreateLayer()
to retrieve a display handle and to create a layer, and then attempting to call

Code: Select all

nwindowCreateFromLayer()
multiple times, however it looks like it only succeeds the first time I call it. Is this expected?

User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 94
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

Re: libnx windowing

Post by fincs » Thu Sep 12, 2019 12:04 pm

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.
Donate to devkitPro - help us stay alive!

Rajveer
Posts: 11
Joined: Sat Jan 24, 2009 11:37 pm

Re: libnx windowing

Post by Rajveer » Thu Sep 12, 2019 11:37 pm

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?

User avatar
fincs
( ͡° ͜ʖ ͡°)
Posts: 94
Joined: Mon Jul 12, 2010 9:45 pm
Location: Seville, Spain
Contact:

Re: libnx windowing

Post by fincs » Fri Sep 13, 2019 2:26 am

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.
Donate to devkitPro - help us stay alive!

Rajveer
Posts: 11
Joined: Sat Jan 24, 2009 11:37 pm

Re: libnx windowing

Post by Rajveer » Fri Sep 13, 2019 11:13 am

Awesome, thanks for all your help :)

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests