Fullscreen - correct resolution

If i write the beginning of my app like this…

from panda3d.core import loadPrcFileData
loadPrcFileData('', 'fullscreen 1')
import direct.directbase.DirectStart

…then how do i set the correct resolution

If i do this…

props=WindowProperties(base.win.getProperties())
w=base.pipe.getDisplayWidth()
h=base.pipe.getDisplayHeight()
props.setSize(w,h)
props.setFullscreen(True)
base.win.requestProperties(props)

…i will see the panda windowed for few secs and then it goes fullscreen.

Thank you in advance

I do it like this at the beginning:

w, h = 1024, 768
loadPrcFileData('', 'win-size %i %i' % (w, h))

I suppose that would probably not work if you were to want to change the resolution after the program is running though.

If the goal is to query the existing desktop size first, you can pre-set “window-type none”, then import DirectStart as usual, then set base.windowType = ‘onscreen’ and call base.openDefaultWindow() when you’re ready to open the window.

David

teedee:

from panda3d.core import loadPrcFileData 
w, h = 1024, 768#how do i get the current screen resolution?
loadPrcFileData('', 'win-size %i %i' % (w, h))

import direct.directbase.DirectStart

run()

David:

from panda3d.core import loadPrcFileData 
loadPrcFileData('', "window-type none") 

import direct.directbase.DirectStart

base.windowType = 'onscreen'


base.openDefaultWindow()#this opens on normal windowed panda window, how do i open as full screen?
run()

Thank you in advance

To open a fullscreen window, create a WindowProperties structure with the appropriate fullscreen configuration, and pass it as base.openDefaultWindow(props = myProps).

David

from panda3d.core import loadPrcFileData 
loadPrcFileData('', "window-type none") 

import direct.directbase.DirectStart 

base.windowType = 'onscreen' 

props=WindowProperties.getDefault()

#props.setSize(w,h)???

props.setFullscreen(True)
base.openDefaultWindow(props)

run() 

But i still dont know how to get the current screen resolution, i cant access the base.pipe as it does not exist yet.

Oh, sorry. After you have imported DirectStart, call base.makeDefaultPipe() to create base.pipe. Then you can query it for the desktop size.

David