Пример #1
0
def on_draw(dt):
    # Clear depth and color buffers
    gl.glClearColor(*C0)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)
            
    # Opaque objects rendering
    gl.glDepthMask(gl.GL_TRUE)
    gl.glDisable(gl.GL_BLEND)
    
    # Transparent objects rendering
    gl.glDepthMask(gl.GL_FALSE)
    gl.glEnable(gl.GL_BLEND)
    framebuffer.activate()
    gl.glClearColor(0,0,0,1)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT)
    
    window.clear(color=(0,0,0,1))
    gl.glBlendFuncSeparate(gl.GL_ONE,  gl.GL_ONE,
                           gl.GL_ZERO, gl.GL_ONE_MINUS_SRC_ALPHA)
    scene.draw(gl.GL_TRIANGLES, indices)
    framebuffer.deactivate()
    
    # Compositing
    gl.glBlendFunc(gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_SRC_ALPHA)
    compose.draw(gl.GL_TRIANGLE_STRIP)
Пример #2
0
def on_draw(dt):
    # Clear depth and color buffers
    gl.glClearColor(*C0)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT | gl.GL_DEPTH_BUFFER_BIT)

    # Opaque objects rendering
    gl.glDepthMask(gl.GL_TRUE)
    gl.glDisable(gl.GL_BLEND)

    # Transparent objects rendering
    gl.glDepthMask(gl.GL_FALSE)
    gl.glEnable(gl.GL_BLEND)
    framebuffer.activate()
    gl.glClearColor(0, 0, 0, 1)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT)

    window.clear(color=(0, 0, 0, 1))
    gl.glBlendFuncSeparate(gl.GL_ONE, gl.GL_ONE, gl.GL_ZERO,
                           gl.GL_ONE_MINUS_SRC_ALPHA)
    scene.draw(gl.GL_TRIANGLES, indices)
    framebuffer.deactivate()

    # Compositing
    gl.glBlendFunc(gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_SRC_ALPHA)
    compose.draw(gl.GL_TRIANGLE_STRIP)
Пример #3
0
def on_draw(dt):
    app.clock.tick()
    window.clear()

    gl.glEnable(gl.GL_BLEND);
    gl.glBlendEquationSeparate(gl.GL_FUNC_ADD, gl.GL_FUNC_ADD);
    gl.glBlendFuncSeparate(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA);

    w, h = window.get_size()
    #print("----------")
    pipeline.render_screen(None, (w, h))
    var.ReloadVar.reload_vars()
Пример #4
0
def on_draw(dt):
    window.clear(color=C0)
    gl.glDepthMask(gl.GL_FALSE)
    gl.glEnable(gl.GL_BLEND)

    # Transparent surfaces
    framebuffer.activate()
    window.clear(color=(0, 0, 0, 1))
    gl.glBlendFuncSeparate(gl.GL_ONE, gl.GL_ONE, gl.GL_ZERO,
                           gl.GL_ONE_MINUS_SRC_ALPHA)
    quads.draw(gl.GL_TRIANGLES, indices)
    framebuffer.deactivate()

    # Compositing
    gl.glBlendFunc(gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_SRC_ALPHA)
    gl.glEnable(gl.GL_BLEND)
    post.draw(gl.GL_TRIANGLE_STRIP)
Пример #5
0
Файл: oit.py Проект: jk34/glumpy
def on_draw(dt):
    window.clear(color=C0)
    gl.glDepthMask(gl.GL_FALSE)
    gl.glEnable(gl.GL_BLEND)

    # Transparent surfaces
    framebuffer.activate()
    window.clear(color=(0,0,0,1))
    gl.glBlendFuncSeparate(gl.GL_ONE,  gl.GL_ONE,
                           gl.GL_ZERO, gl.GL_ONE_MINUS_SRC_ALPHA)
    quads.draw(gl.GL_TRIANGLES, indices)
    framebuffer.deactivate()
    
    # Compositing
    gl.glBlendFunc(gl.GL_ONE_MINUS_SRC_ALPHA, gl.GL_SRC_ALPHA)
    gl.glEnable(gl.GL_BLEND)
    post.draw(gl.GL_TRIANGLE_STRIP)
Пример #6
0
def on_draw(dt):
    global update_transitions

    app.clock.tick()
    window.clear()

    gl.glEnable(gl.GL_BLEND)
    gl.glBlendEquationSeparate(gl.GL_FUNC_ADD, gl.GL_FUNC_ADD)
    gl.glBlendFuncSeparate(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA,
                           gl.GL_ONE, gl.GL_ONE_MINUS_SRC_ALPHA)

    if update_transitions:
        transition.set_shader("common/passthrough.vert",
                              transitions[transitions_index]["glsl"])
        update_transitions = False

    w, h = window.get_size()
    #print("----------")
    pipeline.render_screen(None, (w, h))
    var.ReloadVar.reload_vars()