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 _resize(self, width, height): """Resize the OpenGL scene (only called by event handlers)""" gl.glViewport(0, 0, width, height) gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() width = width or 1 height = height or 1 gl.glOrtho(0, width, 0, height, -1, 1) gl.glMatrixMode(gl.GL_MODELVIEW) self.set_rect([0, 0, width, height])
def _ResizeGL(self, width, height): """ Default _ResizeGL. This should be overridden by subclasses of GLPanel This function should not be called directly. To inform the GLPanel that it needs to resize call __OnSize(). """ gl.glViewport(0, 0, width, height) gl.glMatrixMode(gl.GL_PROJECTION) gl.glLoadIdentity() gl.glOrtho(-1,1,-1,1,-1,1) gl.glMatrixMode(gl.GL_MODELVIEW)
def _draw(self): gl.glMatrixMode(gl.GL_MODELVIEW) gl.glPushMatrix() gl.glMultMatrixd(self._gl_mview_offset_scale) super(GLLineOffsetScale, self)._draw() gl.glPopMatrix()