def snapshot(self, path): """ Takes a snapshot of the meshviewer window and saves it to disc. :param path: path to save the snapshot at. .. note:: Requires the Pillow package to be installed. """ from PIL import Image from OpenGL.GLU import GLubyte self.on_draw() x = 0 y = 0 width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) data = (GLubyte * (3 * width * height))(0) glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, data) image = Image.frombytes(mode="RGB", size=(width, height), data=data) image = image.transpose(Image.FLIP_TOP_BOTTOM) # Save image to disk image.save(path)
def handle_mouse_move(self, x, screen_y): """ Called when the mouse is moved """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y # invert the y coordinate because OpenGL is inverted if self.pressed is not None: dx = x - self.mouse_loc[0] dy = y - self.mouse_loc[1] if self.pressed == GLUT_RIGHT_BUTTON and self.trackball is not None: # ignore the updated camera loc because we want to always rotate around the origin self.trackball.drag_to(self.mouse_loc[0], self.mouse_loc[1], dx, dy) elif self.pressed == GLUT_LEFT_BUTTON: self.trigger('move', x, y) elif self.pressed == GLUT_MIDDLE_BUTTON: self.translate(dx / 60.0, dy / 60.0, 0) else: pass glutPostRedisplay() self.mouse_loc = (x, y)
def draw_colour_legend(self): menubar_height = self.logo.size[1] + 4 width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) # Colour legend left_x = width - 20 right_x = width - 10 min_y = menubar_height + 5 max_y = height - 20 time_step_size = math.ceil(self.max_hit_time / 20 / 50) * 50 hit_times = list(range(int(self.min_hit_time), int(self.max_hit_time), int(time_step_size))) if len(hit_times) > 1: segment_height = int((max_y - min_y) / len(hit_times)) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glDisable(GL_LIGHTING) glBegin(GL_QUADS) for hit_time in hit_times: segment_nr = hit_times.index(hit_time) glColor3f(*self.spectrum(hit_time)) glVertex2f(left_x, max_y - segment_height * segment_nr) glVertex2f(right_x, max_y - segment_height * segment_nr) glColor3f(*self.spectrum(hit_time + time_step_size)) glVertex2f(left_x, max_y - segment_height * (segment_nr + 1)) glVertex2f(right_x, max_y - segment_height * (segment_nr + 1)) glEnd() # Colour legend labels self.colourist.now_text() for hit_time in hit_times: segment_nr = hit_times.index(hit_time) draw_text_2d("{0:>5}ns".format(hit_time), width - 80, (height - max_y) + segment_height * segment_nr)
def handle_keystroke(self, key, x, screen_y): """ Called on keyboard input from the user """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y if key == 's': self.trigger('place', 'sphere', x, y) elif key == 'c': self.trigger('place', 'cube', x, y) elif key == 'f': self.trigger('place', 'figure', x, y) elif key == GLUT_KEY_UP: self.trigger('scale', up=True) elif key == GLUT_KEY_DOWN: self.trigger('scale', up=False) elif key == GLUT_KEY_LEFT: self.trigger('rotate_color', forward=True) elif key == GLUT_KEY_RIGHT: self.trigger('rotate_color', forward=False) elif key == '\033': self.trigger('close') elif key == 'm': self.trigger('setCameraMode','LookAt') elif key == ',': self.trigger('setCameraMode','LookAtFollow') elif key == 'n': self.trigger('setCameraMode','Trackball') # embed() glutPostRedisplay()
def handle_mouse_button(self, button, mode, x, y): """ Called when the mouse button is pressed or released """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - y # invert the y coordinate because OpenGL is inverted self.mouse_loc = (x, y) if mode == GLUT_DOWN: self.pressed = button if button == GLUT_RIGHT_BUTTON: pass elif button == GLUT_LEFT_BUTTON: # pick self.trigger('pick', x, y) elif button == 3: # scroll up self.translate(0, 0, 1.0) elif button == 4: # scroll down self.translate(0, 0, -1.0) else: # mouse button release self.pressed = None glutPostRedisplay()
def draw_text_2d(text, x, y, line_height=17, color=None): """Draw a text at a given 2D position. A very basic 2D drawing function for drawing (multi-line) text." """ width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) glMatrixMode(GL_PROJECTION) glPushMatrix() #matrix = glGetDouble( GL_PROJECTION_MATRIX ) glLoadIdentity() glOrtho(0.0, width, 0.0, height, -1.0, 1.0) glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() if color: glColor3f(*color) glRasterPos2i(x, y) lines = 0 for character in text: if character == '\n': lines += 1 glRasterPos(x, y - (lines * line_height)) else: glutBitmapCharacter(GLUT_BITMAP_8_BY_13, ord(character)) glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() #glLoadMatrixd(matrix) glMatrixMode(GL_MODELVIEW)
def get_dimensions(self): d = {} d['window_width'] = glutGet(GLUT_WINDOW_WIDTH) d['window_height'] = glutGet(GLUT_WINDOW_HEIGHT) d['subwindow_width'] = self.width_pct * d['window_width'] d['subwindow_height'] = self.height_pct * d['window_height'] d['subwindow_origin_x'] = self.x1_pct * d['window_width'] d['subwindow_origin_y'] = self.y1_pct * d['window_height'] return d
def save_screenshot(self, name='screenshot.png'): width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) pixelset = (GLubyte * (3*width*height))(0) glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixelset) image = Image.fromstring(mode="RGB", size=(width, height), data=pixelset) image = image.transpose(Image.FLIP_TOP_BOTTOM) image.save(name) print("Screenshot saved as '{0}'.".format(name))
def display(): width, height = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) elapsed = glutGet(GLUT_ELAPSED_TIME) / 1000.0 ctx.clear(0.9, 0.9, 0.9) scale.value = (height / width * 0.75, 0.75) rotation.value = elapsed vao.render() glutSwapBuffers()
def draw_gui(self): logo = self.logo logo_bytes = self.logo_bytes menubar_height = logo.size[1] + 4 width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() glOrtho(0.0, width, height, 0.0, -1.0, 10.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #glDisable(GL_CULL_FACE) glShadeModel(GL_SMOOTH) glClear(GL_DEPTH_BUFFER_BIT) # Top bar #glBegin(GL_QUADS) #glColor3f(0.14, 0.49, 0.87) #glVertex2f(0, 0) #glVertex2f(width - logo.size[0] - 10, 0) #glVertex2f(width - logo.size[0] - 10, menubar_height) #glVertex2f(0, menubar_height) #glEnd() try: self.draw_colour_legend() except TypeError: pass glPushMatrix() glLoadIdentity() glRasterPos(4, logo.size[1] + 4) glDrawPixels(logo.size[0], logo.size[1], GL_RGB, GL_UNSIGNED_BYTE, logo_bytes) glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() glMatrixMode(GL_MODELVIEW) self.colourist.now_text() #draw_text_2d("{0}ns".format(int(self.min_hit_time)), width - 80, 20) #draw_text_2d("{0}ns".format(int(self.max_hit_time)), width - 80, height - menubar_height - 10) #draw_text_2d("{0}ns".format(int((self.min_hit_time + self.max_hit_time) / 2)), width - 80, int(height/2)) if self.show_help: self.display_help() if self.show_info: self.display_info()
def ViewportSetup(self): xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) aspect_ratio = float(xSize) / float(ySize) self.aspect = aspect_ratio # set up the projection matrix glMatrixMode(GL_PROJECTION) glLoadIdentity() glViewport(0, 0, xSize, ySize) gluPerspective(self.fovy, self.aspect, self.near, self.far) # postcondition: matrix mode is modelview glMatrixMode(GL_MODELVIEW)
def init_view(self): """ initialize the projection matrix """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) aspect_ratio = float(xSize) / float(ySize) # load the projection matrix. Always the same glMatrixMode(GL_PROJECTION) glLoadIdentity() glViewport(0, 0, xSize, ySize) gluPerspective(70, aspect_ratio, 0.1, 1000.0) glTranslated(0, 0, -15)
def handle_mouse_button(self, button, mode, x, y): xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - y # opengl's o is zuoxia, window's o is zuoshang self.mouse_loc = (x, y) if mode == GLUT_DOWN: self.pressed = button if button == GLUT_RIGHT_BUTTON: pass elif button == GLUT_LEFT_BUTTON: self.trigger('pick', x, y) else: self.pressed = None # current window need redrawing glutPostRedisplay()
def init_view(self): """ 初始化投影矩阵 """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) # 屏幕宽高比 aspect_ratio = float(xSize) / float(ySize) # 设置投影矩阵 glMatrixMode(GL_PROJECTION) glLoadIdentity() #设置视口,应该与窗口重合 glViewport(0, 0, xSize, ySize) # 设置透视,摄像机上下视野幅度70 # 视野范围到距离摄像机1000个单位为止 gluPerspective(70, aspect_ratio, 0.1, 1000.0) # 摄像机镜头从原点后退15个单位 glTranslated(0, 0, -15)
def snapshot(self, path): import cv self.on_draw() x = 0 y = 0 width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) data = glReadPixels(x, y, width, height, GL_BGR, GL_UNSIGNED_BYTE) image = cv.CreateImage((width, height), cv.IPL_DEPTH_8U, 3) flipped_image = cv.CreateImage((width, height), cv.IPL_DEPTH_8U, 3) cv.SetData(image, data) cv.Flip(image, flipped_image, 0) cv.SaveImage(path, flipped_image)
def handle_mouse_button(self, button, mode, x, y): """ 当鼠标按键被点击或者释放的时候调用 """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - y # OpenGL原点在窗口左下角,窗口原点在左上角,所以需要这种转换。 self.mouse_loc = (x, y) if mode == GLUT_DOWN: # 鼠标按键按下的时候 self.pressed = button if button == GLUT_RIGHT_BUTTON: pass elif button == GLUT_LEFT_BUTTON: self.trigger('pick', x, y) else: # 鼠标按键被释放的时候 self.pressed = None # 标记当前窗口需要重新绘制 glutPostRedisplay()
def handle_keystroke(self, key, x, screen_y): """ 键盘输入时调用 """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y if key == 's': self.trigger('place', 'sphere', x, y) elif key == 'c': self.trigger('place', 'cube', x, y) elif key == GLUT_KEY_UP: self.trigger('scale', up=True) elif key == GLUT_KEY_DOWN: self.trigger('scale', up=False) elif key == GLUT_KEY_LEFT: self.trigger('rotate_color', forward=True) elif key == GLUT_KEY_RIGHT: self.trigger('rotate_color', forward=False) glutPostRedisplay()
def handle_keystroke(self, key, x, screen_y): """ Called on keyboard input from the user """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y if key == 's': self.trigger('place', 'sphere', x, y) elif key == 'c': self.trigger('place', 'cube', x, y) elif key == GLUT_KEY_UP: self.trigger('scale', up=True) elif key == GLUT_KEY_DOWN: self.trigger('scale', up=False) elif key == GLUT_KEY_LEFT: self.trigger('rotate_color', forward=True) elif key == GLUT_KEY_RIGHT: self.trigger('rotate_color', forward=False) glutPostRedisplay()
def init_view(self): """init shadow matrix""" xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) #get screen's kuangaobi aspect_ratio = float(xSize) / float(ySize) #set shadow matrix glMatrixMode(GL_PROJECTION) glLoadIdentity() #set viewport, should be chonghe with window glViewport(0, 0, xSize, ySize) #set toushi, eyesight width 70 degree, 1000 distance fron camare gluPerspective(70, aspect_ratio, 0.1, 1000.0) #jinftou back 15 distances from o glTranslated(0, 0, -15)
def handle_mouse_move(self, x, screen_y): """ 鼠标移动时调用 """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y if self.pressed is not None: dx = x - self.mouse_loc[0] dy = y - self.mouse_loc[1] if self.pressed == GLUT_RIGHT_BUTTON and self.trackball is not None: # 变化场景的角度 self.trackball.drag_to(self.mouse_loc[0], self.mouse_loc[1], dx, dy) elif self.pressed == GLUT_LEFT_BUTTON: self.trigger('move', x, y) elif self.pressed == GLUT_MIDDLE_BUTTON: self.translate(dx/60.0, dy/60.0, 0) else: pass glutPostRedisplay() self.mouse_loc = (x, y)
def handle_mouse_move(self, x, screen_y): """ Called when the mouse is moved """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y # invert the y coordinate because OpenGL is inverted if self.pressed is not None: dx = x - self.mouse_loc[0] dy = y - self.mouse_loc[1] if self.pressed == GLUT_RIGHT_BUTTON and self.trackball is not None: # ignore the updated camera loc because we want to always rotate around the origin self.trackball.drag_to(self.mouse_loc[0], self.mouse_loc[1], dx, dy) elif self.pressed == GLUT_LEFT_BUTTON: self.trigger('move', x, y) elif self.pressed == GLUT_MIDDLE_BUTTON: self.translate(dx/60.0, dy/60.0, 0) else: pass glutPostRedisplay() self.mouse_loc = (x, y)
def handle_mouse_button(self, button, mode, x, y): """ Called when the mouse button is pressed or released """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - y # invert the y coordinate because OpenGL is inverted self.mouse_loc = (x, y) if mode == GLUT_DOWN: self.pressed = button if button == GLUT_RIGHT_BUTTON: pass elif button == GLUT_LEFT_BUTTON: # pick self.trigger('pick', x, y) elif button == 3: # scroll up self.translate(0, 0, 1.0) elif button == 4: # scroll up self.translate(0, 0, -1.0) else: # mouse button release self.pressed = None glutPostRedisplay()
def draw_gui(self): menubar_height = logo.size[1] + 4 width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() glOrtho(0.0, width, height, 0.0, -1.0, 10.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glDisable(GL_CULL_FACE) glClear(GL_DEPTH_BUFFER_BIT) glBegin(GL_QUADS) glColor3f(0.14, 0.49, 0.87) glVertex2f(0, 0) glVertex2f(width - logo.size[0] - 10, 0) glVertex2f(width - logo.size[0] - 10, menubar_height) glVertex2f(0, menubar_height) glEnd() glPushMatrix() glLoadIdentity() glRasterPos(width - logo.size[0] - 4, logo.size[1] + 2) glDrawPixels(logo.size[0], logo.size[1], GL_RGB, GL_UNSIGNED_BYTE, logo_bytes) glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() glMatrixMode(GL_MODELVIEW) glColor3f(1.0, 1.0, 1.0) draw_text_2d("FPS: {0:.1f}\nTime: {1:.0f} ns" .format(self.clock.fps, self.clock.time), 10, 30) if self.show_help: self.display_help() if self.show_info: self.display_info()
def handle_keystroke(self, key, x, screen_y): """ 键盘输入时调用 """ print('进入handle_keystroke()函数') xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y print('key值:',key) if key == b'S': self.trigger('place', 'sphere', x, y) elif key == b'C': self.trigger('place', 'cube', x, y) elif key == GLUT_KEY_UP: print('come in :key_up') self.trigger('scale', up=True) elif key == GLUT_KEY_DOWN: self.trigger('scale', up=False) elif key == GLUT_KEY_LEFT: self.trigger('rotate_color', forward=True) elif key == GLUT_KEY_RIGHT: self.trigger('rotate_color', forward=False) glutPostRedisplay()
def CalcFps(self): """calculates GUI.fps and GUI.tps (call every frame)""" self.frame += 1 actualtime = glutGet(GLUT_ELAPSED_TIME) timenow = actualtime - self.lasttime turnsnow = self.world.turns - self.lastturns if(timenow > 1000): self.fps = self.frame * 1000.0 / timenow self.lasttime = actualtime self.lastturns = self.world.turns self.tps = turnsnow * 1000.0 / timenow self.frame = 0
def send_mouseclick_to_caller(self, cursor_x, cursor_y, button='right'): client = zmq.Context.instance().socket(zmq.PUSH) client.connect('tcp://127.0.0.1:%d' % (self.mouseclick_port)) cameras = self.on_draw(want_cameras=True) window_height = glutGet(GLUT_WINDOW_HEIGHT) depth_value = glReadPixels(cursor_x, window_height - cursor_y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT) pyobj = { 'event_type': 'mouse_click_%sbutton' % button, 'u': None, 'v': None, 'x': None, 'y': None, 'z': None, 'subwindow_row': None, 'subwindow_col': None } for subwin_row, camera_list in enumerate(cameras): for subwin_col, camera in enumerate(camera_list): # test for out-of-bounds if cursor_x < camera['viewport'][0]: continue if cursor_x > (camera['viewport'][0] + camera['viewport'][2]): continue if window_height - cursor_y < camera['viewport'][1]: continue if window_height - cursor_y > (camera['viewport'][1] + camera['viewport'][3]): continue xx, yy, zz = gluUnProject(cursor_x, window_height - cursor_y, depth_value, camera['modelview_matrix'], camera['projection_matrix'], camera['viewport']) pyobj = { 'event_type': 'mouse_click_%sbutton' % button, 'u': cursor_x - camera['viewport'][0], 'v': window_height - cursor_y - camera['viewport'][1], 'x': xx, 'y': yy, 'z': zz, 'which_subwindow': (subwin_row, subwin_col) } client.send_pyobj(pyobj) del self.mouseclick_port
def draw_gui(self): logo = self.logo logo_bytes = self.logo_bytes width = glutGet(GLUT_WINDOW_WIDTH) height = glutGet(GLUT_WINDOW_HEIGHT) glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() glOrtho(0.0, width, height, 0.0, -1.0, 10.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glShadeModel(GL_SMOOTH) glClear(GL_DEPTH_BUFFER_BIT) try: self.draw_colour_legend() except TypeError: pass glPushMatrix() glLoadIdentity() glRasterPos(4, logo.size[1] + 4) glDrawPixels(logo.size[0], logo.size[1], GL_RGB, GL_UNSIGNED_BYTE, logo_bytes) glPopMatrix() glMatrixMode(GL_PROJECTION) glPopMatrix() glMatrixMode(GL_MODELVIEW) self.colourist.now_text() if self.show_help: self.display_help() if self.show_info: self.display_info()
def spin_display(): global progress global current_mosaic_picture global start_picture_coord global start_orientation duration = args.duration * 1000. old_progress = progress progress = (glutGet(GLUT_ELAPSED_TIME) % duration) / duration if progress < old_progress: current_tile_picture = current_mosaic_picture start_orientation = current_mosaic_picture.orientation current_mosaic_picture = iterator.next() start_picture_coord = find_picture_in_mosaic( current_tile_picture, mosaic_factory.mosaic(current_mosaic_picture, args.tiles, args.reuse)) glutPostRedisplay()
def mouse(self, button, state, x, y): width = glutGet(GLUT_WINDOW_WIDTH) if button == GLUT_LEFT_BUTTON: if state == GLUT_DOWN: if x > width - 70: self.drag_mode = 'spectrum' else: self.drag_mode = 'rotate' self.camera.is_rotating = False self.mouse_x = x self.mouse_y = y if state == GLUT_UP: self.drag_mode = None if button == 3: self.camera.distance = self.camera.distance + 2 if button == 4: self.camera.distance = self.camera.distance - 2
def spin_display(): global progress global current_mosaic_picture global start_picture_coord global start_orientation duration = args.duration * 1000. old_progress = progress progress = (glutGet(GLUT_ELAPSED_TIME) % duration) / duration if progress < old_progress: current_tile_picture = current_mosaic_picture start_orientation = current_mosaic_picture.orientation current_mosaic_picture = iterator.next() start_picture_coord = find_picture_in_mosaic( current_tile_picture, mosaic_factory.mosaic( current_mosaic_picture, args.tiles, args.reuse ) ) glutPostRedisplay()
def handle_keystroke(self, key, x, screen_y): """ Called on keyboard input from the user """ xSize, ySize = glutGet(GLUT_WINDOW_WIDTH), glutGet(GLUT_WINDOW_HEIGHT) y = ySize - screen_y if key == b's': self.trigger('place', 'sphere', x, y) elif key == b'c': self.trigger('place', 'cube', x, y) elif key == b'f': self.trigger('place', 'figure', x, y) #############################################################2 #2 elif key == b'b': #2 #2 self.trigger('place', 'cylinder', x, y) #2 ############################################################## elif key == b'x': # # self.trigger('remove', up=False) # ############################################################## ############################################################## elif key == b'8': # # self.trigger('rotate', up="x") # elif key == b'2': # # self.trigger('rotate', up="-x") elif key == b'4': # # self.trigger('rotate', up="y") # elif key == b'6': # # self.trigger('rotate', up="-y") elif key == b'5': # # self.trigger('rotate', up="z") # elif key == b'1': # # self.trigger('rotate', up="-z") # ############################################################## elif key == GLUT_KEY_UP: self.trigger('scale', up=True) elif key == GLUT_KEY_DOWN: self.trigger('scale', up=False) elif key == GLUT_KEY_LEFT: self.trigger('rotate_color', forward=True) elif key == GLUT_KEY_RIGHT: self.trigger('rotate_color', forward=False) glutPostRedisplay()
def get(cls, state: State): return glutGet(state.value)
def screen_width(self): return glutGet(GLUT_SCREEN_WIDTH)
def display_info(self): pos_y = glutGet(GLUT_WINDOW_HEIGHT) - 100 draw_text_2d(self.blob_info, 10, pos_y)
def display_help(self): pos_y = glutGet(GLUT_WINDOW_HEIGHT) - 80 draw_text_2d(self.help_string, 10, pos_y)
def screen_height(self): return glutGet(GLUT_SCREEN_HEIGHT)
def width(self): return glutGet(GLUT_WINDOW_WIDTH)
def height(self): return glutGet(GLUT_WINDOW_HEIGHT)