tweaks needed for new GLCanvas API
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -78,6 +78,8 @@ class MyCanvasBase(glcanvas.GLCanvas):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
glcanvas.GLCanvas.__init__(self, parent, -1)
|
glcanvas.GLCanvas.__init__(self, parent, -1)
|
||||||
self.init = False
|
self.init = False
|
||||||
|
self.context = glcanvas.GLContext(self)
|
||||||
|
|
||||||
# initial mouse position
|
# initial mouse position
|
||||||
self.lastx = self.x = 30
|
self.lastx = self.x = 30
|
||||||
self.lasty = self.y = 30
|
self.lasty = self.y = 30
|
||||||
@@ -95,16 +97,19 @@ class MyCanvasBase(glcanvas.GLCanvas):
|
|||||||
|
|
||||||
|
|
||||||
def OnSize(self, event):
|
def OnSize(self, event):
|
||||||
size = self.size = self.GetClientSize()
|
wx.CallAfter(self.DoSetViewport)
|
||||||
if self.GetContext():
|
|
||||||
self.SetCurrent()
|
|
||||||
glViewport(0, 0, size.width, size.height)
|
|
||||||
event.Skip()
|
event.Skip()
|
||||||
|
|
||||||
|
def DoSetViewport(self):
|
||||||
|
size = self.size = self.GetClientSize()
|
||||||
|
self.SetCurrent(self.context)
|
||||||
|
glViewport(0, 0, size.width, size.height)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def OnPaint(self, event):
|
def OnPaint(self, event):
|
||||||
dc = wx.PaintDC(self)
|
dc = wx.PaintDC(self)
|
||||||
self.SetCurrent()
|
self.SetCurrent(self.context)
|
||||||
if not self.init:
|
if not self.init:
|
||||||
self.InitGL()
|
self.InitGL()
|
||||||
self.init = True
|
self.init = True
|
||||||
|
Reference in New Issue
Block a user