def _draw(self): # Update ticks prior to drawing if required if self._ticks_need_updating: self._update_xticks() self._update_yticks() self._ticks_need_updating = False # Prepare for plotting gl.glMatrixMode(gl.GL_MODELVIEW) gl.glPushMatrix() gl.glLoadMatrixd(self._gl_mview_xylims) # Clip everything in the pane gl.glScissor(*self._gl_scissor_xylims) gl.glEnable(gl.GL_SCISSOR_TEST) # Clear region defined by scissor-clipping gl.glClearColor(*self._bgcolour) gl.glClear(gl.GL_COLOR_BUFFER_BIT) for line in self.lines: line.draw() # Unclip to draw borders (all settings should be restored) gl.glDisable(gl.GL_SCISSOR_TEST) # Draw border in figure space (line never needs updating) gl.glLoadMatrixd(self._figure._gl_mview_xylims) self._edge_line.draw() # Draw tick text in pixel space gl.glPopMatrix() for t in self._gl_xticks.values() + self._gl_yticks.values(): t['glt'].draw()
def _InitGL(self): """ Default _InitGL. This should be overridden by subclasses of GLPanel This should not be called. It will be called when the GLPanel recieves its first EVT_PAINT event. """ gl.glDisable(gl.GL_DEPTH_TEST) gl.glShadeModel(gl.GL_SMOOTH)
def _initgl(self): """Initialise OpenGL settings (called once before first draw)""" # All drawing is 2d gl.glDisable(gl.GL_DEPTH_TEST) gl.glDisable(gl.GL_LIGHTING) # Shading is not needed gl.glShadeModel(gl.GL_FLAT) # Anti-aliasing settings gl.glHint(gl.GL_LINE_SMOOTH_HINT, gl.GL_NICEST) gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA) gl.glEnable(gl.GL_LINE_SMOOTH) gl.glEnable(gl.GL_BLEND)