Changeset 1379


Ignore:
Timestamp:
Jun 11, 2014 5:27:13 PM (7 years ago)
Author:
toby
Message:

more wx2.9: partial fix for GL, fails until rotated, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r1378 r1379  
    8383    def __init__(self,parent,id=-1,dpi=None,**kwargs):
    8484        self.figure = wx.Panel.__init__(self,parent,id=id,**kwargs)
    85         if 'win' in sys.platform:           #Windows already double buffered
     85        if 'win' in sys.platform:           #Windows (& Mac) already double buffered
    8686            self.canvas = wx.glcanvas.GLCanvas(self,-1,**kwargs)
    8787        else:                               #fix from Jim Hester for X systems
    8888            attribs = (wx.glcanvas.WX_GL_DOUBLEBUFFER,)         
    8989            self.canvas = wx.glcanvas.GLCanvas(self,-1,attribList=attribs,**kwargs)
     90        # create GL context for wx > 2.8
     91        i,j= wx.__version__.split('.')[0:2]
     92        if int(i)+int(j)/10. > 2.8:
     93            self.context = wx.glcanvas.GLContext(self.canvas)
     94            self.canvas.SetCurrent(self.context)
     95        else:
     96            self.context = None
    9097        self.camera = {}
    9198        sizer=wx.BoxSizer(wx.VERTICAL)
     
    41234130                RenderBackbone(Backbone,BackboneColor,bondR)
    41244131#        print time.time()-time0
     4132        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    41254133        Page.canvas.SwapBuffers()
    4126        
     4134        
    41274135    def OnSize(event):
    41284136        Draw('size')
     
    44184426            RenderBonds(x,y,z,Bonds[iat],0.05,color)
    44194427            RenderLabel(x,y,z,'  '+atNames[iat],matRot)
     4428        if Page.context: Page.canvas.SetCurrent(Page.context)    # wx 2.9 fix
    44204429        Page.canvas.SwapBuffers()
    44214430
Note: See TracChangeset for help on using the changeset viewer.