예제 #1
0
파일: glplot.py 프로젝트: essar/pySki
 def on_draw(self):
     # Clear buffers and reset transforms
     gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
     gl.glLoadIdentity()
             
     self.plot.draw()
         
     gl.glFlush()    
예제 #2
0
파일: glplot.py 프로젝트: essar/pySki
 def draw(self, status_text):
     gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
 
     # Clear transforms
     gl.glLoadIdentity()
     
     # Update status label
     if status_text is not None:
         self.lbl_status.text = status_text
     self.lbl_status.draw()
     
     # Update FPS label
     py_fps = pyglet.app.clock.get_fps()
     self.lbl_fps.text =  '[{0:3.3f}fps]'.format(py_fps)
     self.lbl_fps.draw()
예제 #3
0
파일: glplot.py 프로젝트: essar/pySki
 def on_resize(self, width, height):
     self.plot.cfg.window_width = width
     self.plot.cfg.window_height = height
     
     gl.glViewport(0, 0, width, height)
             
     gl.glMatrixMode(gl.GL_PROJECTION)
     gl.glLoadIdentity()
     #gluPerspective(70, 1.0 * width/height, 0.1, 1000.0)
     gl.glOrtho(0, width, 0, height, -1000, 1000)
     gl.glMatrixMode(gl.GL_MODELVIEW)
     gl.glLoadIdentity()
     
     self.plot.status.set_width(width)        
             
     return True
예제 #4
0
파일: glplot.py 프로젝트: essar/pySki
 def _draw_axis(self):
     gl.glPushMatrix()
     
     # Scale to fit window
     self.cfg._update_scaling()
     
     width = int(self.cfg.plot_width)
     height = int(self.cfg.plot_height)
     log.debug('Drawing axis; width=%d, height=%d', width, height)
     
     gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
     gl.glColor4f(1.0, 1.0, 1.0, 1.0)
     
     gl.glBegin(gl.GL_LINES)
     gl.glVertex3i(0, 0, 0)
     gl.glVertex3i(width, 0, 0)
     
     gl.glVertex3i(0, 0, 0)
     gl.glVertex3i(0, height, 0)
     
     gl.glEnd()
     
     for (_lbl, pos) in self.plot_data[self.plot_idx].x_axis_markers:
         gl.glBegin(gl.GL_LINES)
         gl.glVertex3i(int(pos), 0, 0)
         gl.glVertex3i(int(pos), -1, 0)
         gl.glEnd()
         log.debug('Drawing x-axis marker at %d', int(pos))
         
         if _lbl is not None:
             gl.glPushMatrix()
             gl.glLoadIdentity()
             pyglet.text.Label(str(_lbl), font_name='Arial', font_size=8, x=pos, y=-0.5).draw()
             gl.glPopMatrix()
         
     for (_lbl, pos) in self.plot_data[self.plot_idx].y_axis_markers:
         gl.glBegin(gl.GL_LINES)
         gl.glVertex3i(0, int(pos), 0)
         gl.glVertex3i(-1, int(pos), 0)
         gl.glEnd()
         log.debug('Drawing y-axis marker at %d', int(pos))
     
     gl.glPopMatrix()