on my widescreen display (15.4),when running in fullscreenmode (win-size is 1024x768), the whole window is stretched to fit to the widescreen.
so, my images and all other stuff are stretched, too.
i would like to set the window in the middle of the screen, left and right side of the window should be black.
can you please give me a hint, how to set the window to its right properties on every monitor?
Interesting. Panda calculates the aspect ratio when the window is created. It uses that to configure the camera lens and the scaling factor of aspect2d.
Then, there’s a method ShowBase.__windowEvent which contains code to update the window’s aspect ratio. But I know from personal experience that when you resize the window, the aspect ratio doesn’t get updated. It looks like somebody wrote code that was meant to update the aspect ratio, but it looks like maybe it’s not working.
No, that’s not really the issue. The aspect ratio calculation is based on the assumption that the pixels are square. But when you open a 1024x768 fullscreen window on a widescreen display, the pixels are no longer square (you are stretching a 4x3 array of pixels across a 16x10 display). So Panda may be computing the aspect ratio correctly, but the very pixels have been stretched.
You have to know whether the display is widescreen or not. If it is widescreen, then request a suitable widescreen size instead (e.g. 1280x768).
I seem to vaguely recall that we did something so that panda can open at fullscreen, without changing the desktop resolution. Am I recalling correctly?
Josh Yelon, at least it does on Linux. I don’t know about windows…
ok, thanks for your reactions.
with loadPrcFileData("", “win-size 1280 800”) all images and stuff have the correct ratio on my notebook (which is 1280x800, too).
so i just need to know the users desktop-resolution to get the same “look” on every display.
from other posts, i found out that there is no way to get the users resolution via panda (on windows).
so the only way i can go is to ask the user for his/her resolution before starting panda…?
Here’s a way to find out the screen resolution on windows:
from win32api import GetSystemMetrics
You will need to install win32all though.
thanks! but doesnt work in my code.
if i remove the line “win-size 800 600” in my config.prc, i get “width: 640, height: 480” with your code. it seems that panda defaults the winsize to 640x480, when win-size is not set in the config.
Did you use my code before importing directstart?
after setting the resolution to the users res, i ran into another problem.
i have my images egged with -p 384, 384.
so they are made for a res of 1024x768.
when i start panda in fullscreen and a res of 1280x800, an image with size 1024x768 gets scaled to (something x 800).
so my question now is:
can i somehow preserve the imagesize (force it to be 1024x768), no matter what resolution the program is running at?
Just parent your texture to a node that is counterscaled by the ratio 768/800.
thank you very very much!