I think I have found a bug. Take a look at this code:
from pandac.PandaModules import *
loadPrcFileData('', 'fullscreen 1')
loadPrcFileData('', 'win-size 1680 1050')
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from direct.gui.DirectGui import *
import sys
class World(DirectObject):
def __init__(self):
self.accept("r", self.setResolution)
self.initMenu()
def initMenu(self):
self.NewButton = DirectButton(frameColor = (0, 0, 0, 0), parent = base.aspect2d, text = ("Testing"), scale = 0.08, command = sys.exit)
self.NewButton.setPos(base.a2dLeft + 0.3, 0, base.a2dTop - 0.3)
def setResolution(self):
wp = WindowProperties()
wp.setSize(800, 600)
wp.setFullscreen(True)
base.win.requestProperties(wp)
self.NewButton.destroy()
self.initMenu()
World = World()
run()
It shows a button in top-left corner and tries to keep it in the same place even if you change resolution with a “R” key. It works fine in Windows XP SP3, I have tried various resolutions and Nvidia’s settings (Stretched, Aspect Ratio Scaled, Centered). But I have some problems with it in Kubuntu Linux 64-bit with latest stable Nvidia’s drivers. If I set starting resolution to 1024x768 and then change it (while in game) to 800x600, everything is okay, just like in Windows. However, if I set my starting resolution to 1680x1050 and then change it to (while in game) 800x600, my button won’t appear in the right place, it is barely visible, almost out of sight.
I think it has something to do with aspect ratio, since with 4:3 resolutions it works fine, but I haven’t tried all of them, yet. Is it a bug in Linux Nvidia’s drivers, Panda3D or my code?
Any Linux-Widescreen-Nvidia users here? If yes, when test my example and tell me if you have same problem, please. Panda3D pros, what do you think?
P.S. Maybe it has nothing to do with Nvidia, I cannot test it with other graphic cards, so I don’t know.
Some images:
1680x1050:
800x600: