setting full screen during runtime

Am I able to make the app go fullscreen while running, such as on a menu selection? My current attempt, which has no effect, is like this:

props = base.win.getProperties()
props.setFullscreen(True)
base.win.requestProperties(props)

Comparing the printed output of str(props) before and after the setFullscreen() shows that it does toggle the fullscreen option in the WindowProperties object. Similarly printing the output of getRejectedProperties() shows that nothing was rejected, even though the change had no effect. Am I only able to affect fullscreen before the window is created? Alternately, is there a way to create a new fullscreen window, transfer my scenegraph, and destroy the old window?

The requestProperties() interface to set fullscreen mode is present, but not yet supported in the current version of Panda. (It really should have rejected that property; the fact that it didn’t sounds like a minor bug.)

Until we have that interface fully implemented, you have to create a new window. This is fairly easy to do. You could do something like:

props = base.win.getProperties()
props.setFullscreen(True) 
base.openMainWindow(props = props)

David

Coming back to this topic again…
I’ve tried all sorts of things that just aren’t working for me. When I create a new window using the method you suggest, with base.openMainWindow(), it certainly creates that window in fullscreen (or another windowed one, for debugging), and I can tell that my application is running and doing things with the mouse events it receives. However, I can’t see anything. The entire window context is black, and I’ve tried reparenting nodes, verifying that the render2d node seems to be the same, calling show() on various things, and recreating some of my UI objects. But I can’t get anything to show up in the window. Do you know why this might be? Have the render and render2d nodes just gone off into space, never to be seen again? My primary timing task continues to run, and I know that’s tied to framerate, but I don’t know if it would acutally be the window framerate or an internal Panda framerate, so I can’t verify that the window is really trying to draw.

Hmm, you’re right. My apologies; this appears to be a minor bug in Panda3D 1.1.0. But there’s a simple workaround: simply pass in the GSG (the graphics context) from the previous window, like this:


base.openMainWindow(props = props, gsg = base.win.getGsg())

This is probably a good idea to do anyway, since it preserves all of the existing graphics context; without it, Panda would have to re-load all of the textures and so forth.

David

I tried this:

props = base.win.getProperties()
props.setFullscreen(True)
base.win.requestProperties(props = props, gsg = base.win.getGsg())

In 1.1.0 as well as a couple of other things but I can’t get it to go full-screen. What I want Panda to do is change the screen resolution to one I request and go to fullscreen mode. I can get it to destroy the current window, create a new window at the desired resolution, and execute within the new window, but it simply doesn’t go to full screen.

I entered ‘fullscreen #t’ in the Config.prc also (also tried ‘fullscreen t’) but that did nothing either.

Not a particularly big deal but I would like to see it full-screen.

Are you running on Linux? X-windows doesn’t actually support a fullscreen mode in the same sense that Windows does. The best you can do is open an “undecorated” window the same size as your desktop, and placed at (0, 0):

win-size 1280 1024
win-offset 0 0
undecorated 1

David

I was able to solve this problem (for Windows, at least) with Josh’s help. I’ve posted some code over here:
https://discourse.panda3d.org/viewtopic.php?t=647

Hmmm… yes I’m on Linux. Is there any way to get Panda to change the screen resolution when it launches, and change the res back when it closes?

No, sorry. X doesn’t support this. Changing the screen resolution on Linux requires restarting the X server, which an application doesn’t have permission to do.

David