Runtime fullscreen toggle

tried on my rig and works smoothly
amazing contribute ynjh_jo - even if there are some issues found by treeform its a great helper

The toggle method in those samples mod already cover those issues, for scene with either manual or automatic fullscreen post-processing shader. Each needs different approach.
I haven’t tried it with different bins, though.

Nice code. “Cannot call WindowProperties.setFullscreen() on a const object”

That’s a recent change in Panda3D. Change this line:

      props = base.win.getProperties() 

into this:

      props = WindowProperties(base.win.getProperties()) 

i’d suppose a sticky on this one after it’s “finished” (means: when it works) :slight_smile:

It works already.
If you need to use it with :
[+] display regions, use my DisplayRegionsManager (just get updated)
[+] fullscreen effects or post-processing shaders, either manual or automatic, refer to my zipped samples mod in the link above.

It’s a great script, but I don’t see a particular reason to stickify it…

For the record, I’ve already implemented this a long time ago. I believe in 1.5.3 and later it already works.

And I’ve already used it since my 07/07/2008 post.

Hi ynjh_jo,
Just wanted to ask, since it’s been a while since the code in this thread was updated, did you figure out some “universal” fullscreen toggle method that would work both with and without display regions, post-prepossessing shaders and so on? I mean something complete and ready out-of-the-box, not just “use this if you have display regions, or use that if you have shaders”…

It depends on the OS and or window manager. I don’t know if it’s even possible to switch a window to TRUE fullscreen by a single function call. Some apps may appear fullscreen, but it’s fake fullscreen, it’s just changing window size to match desktop size and simply without border.

Do you want the fake or true one ?

Fake way is enough :slight_smile:
I think this feature is the of the most interest when game is being developed. When it is released, the user must alter configuration and restart the game completely, to make sure that everything works correctly. What is your opinion?

If you only want the fake one, you don’t need to close and reopen the window, thus you’re not exposed to the problems mentioned here.

You only need to request these window properties :

  1. size (grab the code to match to desktop from the code above)
  2. undecorated (true)

Restarting the game just to pick up changed options is too excessive and sucks alot.

So, you think users should change options on the fly? Then the question with “universal fullscreen/resolution/options toggle” is again very important. Did you develop such solution?

I’m happy with mine, unless there is simpler one.

I made a mistake :
In the “basic” glow sample, the CommonFilters instance must be cleaned up before closing the window.
How could it end up the other way ?

UPDATE :
1.6 compatible, but not backward compatible (only the displayregion’s functions).

For people stumbling across this after a search, I just added support for on-the-fly fullscreen switching under Windows to CVS, which means it will be there from 1.7.0 onwards. Just do the requestProperties() with the fullscreen flag set and it will now work as you’d expect. rdb will implement it in Linux pretty soon.

Hey, that’s pretty groovy!

David

Hm, it doesn’t seem that X11 (or my window manager) allows me to toggle fullscreen at runtime. I just checked in the implementation, though. Maybe it works on someone else’s window manager.