示例#1
0
文件: main.py 项目: Zeath/Projects
def DrawGLScene():
    global keyIsPressed
    # Clear The Screen And The Depth Buffer
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    # Reset The View 
    # Draw a square (quadrilateral)
    fps.update(keyIsPressed)
    fps.draw()
    #  since this is double buffered, swap the buffers to display what just got drawn. 
    glutSwapBuffers()
示例#2
0
def run():
    """ Launch the main loop """
    while is_running:
        # Time
        time.update()
        fps.update()
        # Events
        events.reset()
        events.manage()
        if events.is_window_closed() or events.is_key_down(ord('x')):
            stop()
        # Drawing
        graph.clear_buffers()
        graph.load_3D_matrix()
        graph.draw_blocks()
        graph.load_2D_matrix()
        frame()
        window.display()
# start the FPS timer
fps = fps().start()

# loop over frames from the video file stream
while fvs.more():
    # grab the frame from the threaded video file stream, resize
    # it, and convert it to grayscale (while still retaining 3
    # channels)
    frame = fvs.read()
    #frame = imutils.resize(frame, width=450)
    frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    frame = np.dstack([frame, frame, frame])

    # display the size of the queue on the frame
    cv2.putText(frame, "Queue Size: {}".format(fvs.Q.qsize()), (10, 30),
                cv2.FONT_HERSHEY_SIMPLEX, 0.6, (0, 255, 0), 2)

    # show the frame and update the FPS counter
    cv2.imshow("Frame", frame)
    cv2.waitKey(1)
    fps.update()
    # stop the timer and display FPS information
    fps.stop()
    print("[INFO] elasped time: {:.2f}".format(fps.elapsed()))
    print("[INFO] approx. FPS: {:.2f}".format(fps.fps()))

    # do a bit of cleanup
    cv2.destroyAllWindows()
    fvs.stop()