respect fbprops in WxPandaWindow

This commit is contained in:
David Rose 2012-01-13 14:37:17 +00:00
parent 50e53a4d4e
commit a2a8aacb7e
2 changed files with 19 additions and 6 deletions

View File

@ -571,7 +571,7 @@ class ShowBase(DirectObject.DirectObject):
self.notify.info("Could not make graphics pipe %s." % (
pipeType.getName()))
def openWindow(self, props = None, pipe = None, gsg = None,
def openWindow(self, props = None, fbprops = None, pipe = None, gsg = None,
type = None, name = None, size = None, aspectRatio = None,
makeCamera = True, keepCamera = False,
scene = None, stereo = None,
@ -604,7 +604,7 @@ class ShowBase(DirectObject.DirectObject):
# down to the underlying _doOpenWindow() with all of the above
# parameters.
func = lambda : self._doOpenWindow(
props = props, pipe = pipe, gsg = gsg,
props = props, fbprops = fbprops, pipe = pipe, gsg = gsg,
type = type, name = name, size = size, aspectRatio = aspectRatio,
makeCamera = makeCamera, keepCamera = keepCamera,
scene = scene, stereo = stereo,
@ -664,7 +664,7 @@ class ShowBase(DirectObject.DirectObject):
return win
def _doOpenWindow(self, props = None, pipe = None, gsg = None,
def _doOpenWindow(self, props = None, fbprops = None, pipe = None, gsg = None,
type = None, name = None, size = None, aspectRatio = None,
makeCamera = True, keepCamera = False,
scene = None, stereo = None,
@ -699,6 +699,9 @@ class ShowBase(DirectObject.DirectObject):
if props == None:
props = WindowProperties.getDefault()
if fbprops == None:
fbprops = FrameBufferProperties.getDefault()
if size != None:
# If we were given an explicit size, use it; otherwise,
# the size from the properties is used.
@ -711,8 +714,6 @@ class ShowBase(DirectObject.DirectObject):
win = None
fbprops = FrameBufferProperties.getDefault()
flags = GraphicsPipe.BFFbPropsOptional
if type == 'onscreen':
flags = flags | GraphicsPipe.BFRequireWindow

View File

@ -115,13 +115,23 @@ else:
gsg = kw['gsg']
del kw['gsg']
fbprops = kw.get('fbprops', None)
if fbprops == None:
fbprops = FrameBufferProperties.getDefault()
attribList = kw.get('attribList', None)
if attribList is None:
attribList = [
wxgl.WX_GL_RGBA, True,
wxgl.WX_GL_LEVEL, 0,
wxgl.WX_GL_DOUBLEBUFFER, True,
]
if not fbprops.isSingleBuffered():
attribList.append(wxgl.WX_GL_DOUBLEBUFFER)
attribList.append(True)
if fbprops.getDepthBits() > 0:
attribList.append(wxgl.WX_GL_DEPTH_SIZE)
attribList.append(fbprops.getDepthBits())
kw['attribList'] = attribList
base.startWx()
@ -284,6 +294,8 @@ else:
wp.setSize(*self.GetClientSize())
self.win.requestProperties(wp)
event.Skip()
# Choose the best implementation of WxPandaWindow for the platform.
WxPandaWindow = None
if platform.system() == 'Darwin' or platform.system() == 'Linux':