how to get OS resolution?

How to get the resolution of the OS to set fullscreen properly?

screen_h=base.pipe.getDisplayHeight()
screen_w=base.pipe.getDisplayWidth()

Weird situation, I can call loadPrcFileData(’’, β€˜win-size 1366 768’) only before creating a ShowBase instance, but I need to know the screen resolution by base.pipe before doing that to set the fullscreen resolution properly. What to do?

Set window-type to β€˜none’ to avoid automatically opening a window, and manually call base.makeDefaultPipe() to open the graphics pipe, after which you can query the resolution. Then you can just open the window using base.openDefaultWindow(size=(123, 456)).

1 Like

Thanks alot.