X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..52f52ebc4e0be6a9899d328b08db9eb14629d219:/wxPython/demo/OGL.py?ds=sidebyside diff --git a/wxPython/demo/OGL.py b/wxPython/demo/OGL.py index eb7cea9c83..3dab78b679 100644 --- a/wxPython/demo/OGL.py +++ b/wxPython/demo/OGL.py @@ -2,11 +2,6 @@ # # o Updated for wx namespace # -# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o OGL's busted bigtime. Can't even use OGLInitialize() without a -# program error on w2k. -# import wx import wx.ogl as ogl @@ -15,11 +10,6 @@ import images ##wx.Trap() -#---------------------------------------------------------------------- -# This creates some pens and brushes that the OGL library uses. - -ogl.OGLInitialize() - #---------------------------------------------------------------------- class DiamondShape(ogl.PolygonShape): @@ -254,7 +244,7 @@ class TestWindow(ogl.ShapeCanvas): # for some reason, the shapes have to be moved for the line to show up... fromShape.Move(dc, fromShape.GetX(), fromShape.GetY()) - wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) + self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy) def MyAddShape(self, shape, x, y, pen, brush, text): @@ -308,12 +298,14 @@ def runTest(frame, nb, log): #---------------------------------------------------------------------- +# The OGL library holds some resources that need to be freed before +# the app shuts down. class __Cleanup: - cleanup = ogl.OGLCleanUp - def __del__(self): - self.cleanup() + def __del__(self, cleanup=ogl.OGLCleanUp): + cleanup() -# when this module gets cleaned up then wxOGLCleanUp() will get called +# When this module gets cleaned up by Python then __cu will be cleaned +# up and it's __dell__ is called, which will then call ogl.OGLCleanUp. __cu = __Cleanup()