def _fixviewport(self): # # Called after redraw or resize, and initially. # # Fix the coordinate system so that (0, 0) is top left, # units are pixels, and positive axes point right and down. # # Make the viewport slightly larger than the window, # and set the screenmask exactly to the window; this # help fixing character clipping. # # Set self._area to the window rectangle in STDWIN coords. # gl.winset(self._gid) gl.reshapeviewport() x0, x1, y0, y1 = gl.getviewport() width, height = x1 - x0, y1 - y0 gl.viewport(x0 - MASK, x1 + MASK, y0 - MASK, y1 + MASK) gl.scrmask(x0, x1, y0, y1) gl.ortho2(-MASK, width + MASK, height + MASK, -MASK) self._area = (0, 0), (width, height)
def _fixviewport(self): # # Called after redraw or resize, and initially. # # Fix the coordinate system so that (0, 0) is top left, # units are pixels, and positive axes point right and down. # # Make the viewport slightly larger than the window, # and set the screenmask exactly to the window; this # help fixing character clipping. # # Set self._area to the window rectangle in STDWIN coords. # gl.winset(self._gid) gl.reshapeviewport() x0, x1, y0, y1 = gl.getviewport() width, height = x1-x0, y1-y0 gl.viewport(x0-MASK, x1+MASK, y0-MASK, y1+MASK) gl.scrmask(x0, x1, y0, y1) gl.ortho2(-MASK, width+MASK, height+MASK, -MASK) self._area = (0, 0), (width, height)
def noclip(self): #print 'noclip()' gl.scrmask(0, self.width, 0, self.height)
def cliprect(self, area): #print 'cliprect', area (left, top), (right, bottom) = area gl.scrmask(left, right, self.height-bottom, self.height-top)