Пример #1
0
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

    # Creating shapes on GPU memory
    gpuBoo = es.to_gpu_shape(
        shapes.create_texture_quad('example_data/boo.png'), GL_REPEAT,
        GL_NEAREST)
    gpuQuestionBox = es.to_gpu_shape(
        shapes.create_texture_quad('example_data/question_box.png', 10, 1),
        GL_REPEAT, GL_NEAREST)

    # Create objets
    obj_boo = AdvancedGPUShape(gpuBoo, shader=pipeline)
    obj_question = AdvancedGPUShape(gpuQuestionBox, shader=pipeline)

    # Apply object transform
    obj_question.scale(sx=-2, sy=0.2)
    obj_question.translate(ty=-0.8)

    # Mainloop
    while not glfw.window_should_close(window):

        # Using GLFW to check for input events
        glfw.poll_events()

        # OpenGL polygon mode
        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)

        # Clearing the screen in both, color and depth
        glClear(GL_COLOR_BUFFER_BIT)

        theta = glfw.get_time()
Пример #2
0
        bs.create4_vertex_texture('example_data/bricks.jpg', s1, s2, s3, s4),
        GL_REPEAT, GL_LINEAR)
    obj_planeS = AdvancedGPUShape(gpuTexturePlane, shader=textureShaderProgram)
    obj_planeS.rotation_x(np.pi / 2)

    # Bottom plane
    s1 = (0.5, 0, 0)
    s2 = (-0.5, 0, 0)
    s3 = (-0.5, 0.55, 0)
    s4 = (0.5, 0.55, 0)
    gpuTexturePlane = es.to_gpu_shape(
        bs.create4_vertex_texture('example_data/boo.png', s1, s2, s3, s4),
        GL_REPEAT, GL_LINEAR)
    obj_planeB = AdvancedGPUShape(gpuTexturePlane, shader=textureShaderProgram)
    obj_planeB.rotation_z(np.pi)
    obj_planeB.scale(1, 2, 1)

    # Create camera target
    obj_camTarget = AdvancedGPUShape(es.to_gpu_shape(
        bs.create_color_cube(1, 0, 0.5)),
                                     shader=colorShaderProgram)
    obj_camTarget.uniform_scale(0.05)

    # Main loop
    while not glfw.window_should_close(window):

        # Using GLFW to check for input events
        glfw.poll_events()

        # Filling or not the shapes depending on the controller state
        if controller.fillPolygon: