def draw(self): # Adjust for margin gl.glTranslatef(self.cfg.window_margin_x, self.cfg.window_margin_y, 0.0) # Adjust for axis bar gl.glTranslatef((20.0 if self.cfg.show_axis else 0), (20.0 if self.cfg.show_axis else 0), 0.0) # Adjust for status bar gl.glTranslatef(0.0, (self.cfg.status_height if self.cfg.show_status_bar else 0), 0.0) # Draw base plane self._draw_background() # Adjust for view gl.glTranslatef(self.live_tx, self.live_ty, self.live_tz) # Scale to fit window gl.glScalef(*self.cfg._update_scaling()) # Compute centre point cx = float((self.cfg.plot_width / 2.0) - (self.live_tx / self.cfg.scale_x)) cy = float((self.cfg.plot_height / 2.0) - (self.live_ty / self.cfg.scale_y)) #cz = float(glCfg.plot_depth / 2.0) # Scale according to zoom factors about centre point gl.glTranslatef(cx, cy, 0.0) gl.glScalef(self.live_zoom_x, self.live_zoom_y, self.live_zoom_z) gl.glTranslatef(-cx, -cy, 0.0) # Rotate about X axis #glRotatef(-90.0, 10.0, 0.0, 0.0) # Draw axis if self.cfg.show_axis: self._draw_axis() # Draw plot elements as lines self._draw_plot() if self.cfg.show_marker: self._draw_marker() if self.cfg.show_status_bar: self._draw_status_bar()
def set_state(self): gl.glPushMatrix() gl.glTranslatef(0, 0, -60) gl.glRotatef(45, 1, 0, 0) gl.glRotatef(45, 0, 1, 0)
def set_state(self): gl.glPushMatrix() gl.glTranslatef(*self.translate)