Window Size and Window Resolution

Ive been reading through different threads and panda3d manual sections about the graphics pipe etc trying to find a way to change the reolution of my application’s window. I can change the size just fine, but everything being rendered in that window scales up with the size of the window. is there a way to keep everything the same size regardless of the window size?

to change the resolution add these lines at the first of your code
you won’t feel the change of the resolution until you make your game full screen, otherwise it will change only the window size keeping constant aspect ratio

from panda3d.core import loadPrcFileData
#Change resolution 
loadPrcFileData("", "win-size 1024 768")
#make full screen
loadPrcFileData("", "fullscreen t")

aah thats definitely a start :smiley: much thanks :slight_smile: now is there a way to do it out of fullscreen?

try to change the resolution of any game in the window mode not full screen , you will seen no deference except for the window size
if you want to change the size of the whole scene maybe you can change the camera field of view
just try this code to see what FOV do


when you run your game anew window will popup , change the slider to change FOV value
if this is what you need add this code to change the FOV value by code


to see more about fov … ld_of_View

good luck :smiley:

much appreciated :slight_smile: trying now :slight_smile:is there a reason for not seeing a difference when its not fullscreened?

it works with ecverything except the directObjects :slight_smile:

edit: since this pertains to this topic as well -

def setRes(self):
        self.resEntry = DirectEntry(text="", scale=.05, command=self.makeRes, initialText="", numLines=1, focus=1)
        self.resEntry.setPos(0, 0, 0.2)

    def makeRes(self, arg):
        loadPrcFileData("", "win-size " + str(arg))


nothing seems to happen when that code is run. do i need to reopen the window for it to take affect? if so is there a better way to approach this?

yes the reason is that in window mode the game window is much like the wallpaper in the actual size mode, suppose your screen resolution is 1440x900 and the image size is 400x400, the image will appear small in the center of screen, but if you set the wallpaper to be stretch(Full screen mode for the game) the image will stretch to reach the full screen resolution, so if the image has a square shape on it, the square will appear as rectangle(due to change in aspect ration) and the image will look blurry.

when you set your game resolution to 800x600 in a window mode it’s like you have an image with this resolution, when you make it full screen it will stretch to fill the screen and this will change the aspect ratio (square appear like rectangle) and will change the quality.
if you set your window resolution to the resolution you are using for your desktop you will notice no change in the full screen mode (no change in aspect ration or quality)

you have to change the resolution before the game starts, other wise it won’t change anything

yea so ill have to make a task that actively resizes the directobject based off the screen size or something. Do you know any way to change the resolutrion while in game? and thanks for explanation :slight_smile:

i hope these posts would help :smiley: … 1bf08833bd … 4fcec936be

Your awesome: D

so i tried

def setRes(self):
        self.resEntry = DirectEntry(text="", scale=.05, command=self.makeRes, initialText="", numLines=1, focus=1)
        self.resEntry.setPos(0, 0, 0.2)

    def makeRes(self, arg):
        loadPrcFileData("", "win-size " + str(arg)
        taskMgr.doMethodLater(1, self.exit, "exit") = newApp()

class newApp():
    def __init__(self): = startGame()

hoping that it would make a new instance of my startgame class then exits the old one, but i realized that the new instance wouldnt need to load the config.prc anyways lol. Surely theres some way to change the screen resolution in game?

ideas anyone? maybe make a new cfg file that it loads?,y) )

Something like this should work to change the size of a window after opening that window.

Are you sure that changing the resolution of your game is what you want? In your original question you were rather talking about scaling the objects within your game, i.e. fixed size vs. relative size.

If changing the resolution is what you want there are multiple ways to do that, but I’m pretty certain that dynamically changing the resolution does not work on all platforms (Windows, Linux, Mac OS X) equally well. A lot of work has gone into this issue in the past (link), but I’d still recommend writing new configurations to a config file and telling your users to restart the game (as done here). As a default, either start your game in windowed mode at a rather low resolution that modern screens all support or request all possible resolutions from your user’s screen and set the maximum one fullscreen.

I could provide code snippets.

wow thank you, yes i would much prefer that when the screen resolution is changed the objects (visually to the player) stay the same size. ill check out those links, and if your willing to put some code snippets i would quite happy and thankful :slight_smile: