Esempio n. 1
0
def load_shaders():
    global uniform
    global tess_program
    global draw_cp_program
    
    if (tess_program):
        glDeleteProgram(tess_program)

    shaders = [GLuint(0) for _ in range(4)]

    shaders[0] = shader_load("cubicbezier.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("cubicbezier.tcs.glsl", GL_TESS_CONTROL_SHADER)
    shaders[2] = shader_load("cubicbezier.tes.glsl", GL_TESS_EVALUATION_SHADER)
    shaders[3] = shader_load("cubicbezier.fs.glsl", GL_FRAGMENT_SHADER)

    tess_program = link_from_shaders(shaders, 4, True)

    uniform.patch.mv_matrix = glGetUniformLocation(tess_program, "mv_matrix")
    uniform.patch.proj_matrix = glGetUniformLocation(tess_program, "proj_matrix")
    uniform.patch.mvp = glGetUniformLocation(tess_program, "mvp")

    if (draw_cp_program):
        glDeleteProgram(draw_cp_program)

    shaders[0] = shader_load("draw-control-points.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("draw-control-points.fs.glsl", GL_FRAGMENT_SHADER)

    draw_cp_program = link_from_shaders(shaders, 2, True)

    uniform.control_point.draw_color = glGetUniformLocation(draw_cp_program, "draw_color")
    uniform.control_point.mvp = glGetUniformLocation(draw_cp_program, "mvp")
Esempio n. 2
0
def load_shaders():
    global program

    shaders = [GLuint(0) for _ in range(2)]

    shaders[0] = shader_load("render.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("render.fs.glsl", GL_FRAGMENT_SHADER)

    program = link_from_shaders(shaders, 2, True)
Esempio n. 3
0
def load_shaders():
    global view_program
    global display_program
    global filter_program

    shaders = [GLuint(0) for _ in range(4)]

    shaders[0] = shader_load("render.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("render.fs.glsl", GL_FRAGMENT_SHADER)

    if (view_program):
        glDeleteProgram(view_program)

    view_program = link_from_shaders(shaders, 2, True)

    uniforms.view.proj_matrix = glGetUniformLocation(view_program,
                                                     "proj_matrix")
    uniforms.view.mv_matrix = glGetUniformLocation(view_program, "mv_matrix")
    uniforms.view.full_shading = glGetUniformLocation(view_program,
                                                      "full_shading")
    uniforms.view.diffuse_albedo = glGetUniformLocation(
        view_program, "diffuse_albedo")

    shaders[0] = shader_load("display.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("display.fs.glsl", GL_FRAGMENT_SHADER)

    if (display_program):
        glDeleteProgram(display_program)

    display_program = link_from_shaders(shaders, 2, True)

    uniforms.dof.focal_distance = glGetUniformLocation(display_program,
                                                       "focal_distance")
    uniforms.dof.focal_depth = glGetUniformLocation(display_program,
                                                    "focal_depth")

    shaders[0] = shader_load("gensat.cs.glsl", GL_COMPUTE_SHADER)

    if (filter_program):
        glDeleteProgram(filter_program)

    filter_program = link_from_shaders(shaders, 1, True)
Esempio n. 4
0
def load_shaders():
    global program_render
    global program_filter
    global program_resolve
    global uniforms

    shaders = [GLuint(0), GLuint(0)]

    if (program_render):
        glDeleteProgram(program_render)

    shaders[0] = shader_load("hdrbloom-scene.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("hdrbloom-scene.fs.glsl", GL_FRAGMENT_SHADER)
    program_render = link_from_shaders(shaders, 2, True)

    uniforms.scene.bloom_thresh_min = glGetUniformLocation(
        program_render, "bloom_thresh_min")
    uniforms.scene.bloom_thresh_max = glGetUniformLocation(
        program_render, "bloom_thresh_max")

    if (program_filter):
        glDeleteProgram(program_filter)

    shaders[0] = shader_load("hdrbloom-filter.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("hdrbloom-filter.fs.glsl", GL_FRAGMENT_SHADER)
    program_filter = link_from_shaders(shaders, 2, True)

    if (program_resolve):
        glDeleteProgram(program_resolve)

    shaders[0] = shader_load("hdrbloom-resolve.vs.glsl", GL_VERTEX_SHADER)
    shaders[1] = shader_load("hdrbloom-resolve.fs.glsl", GL_FRAGMENT_SHADER)
    program_resolve = link_from_shaders(shaders, 2, True)

    uniforms.resolve.exposure = glGetUniformLocation(program_resolve,
                                                     "exposure")
    uniforms.resolve.bloom_factor = glGetUniformLocation(
        program_resolve, "bloom_factor")
    uniforms.resolve.scene_factor = glGetUniformLocation(
        program_resolve, "scene_factor")
def load_shaders():
    global prefix_sum_prog
    global show_image_prog

    cs = shader_load("prefixsum2d.cs.glsl", GL_COMPUTE_SHADER)

    if (prefix_sum_prog):
        glDeleteProgram(prefix_sum_prog)

    prefix_sum_prog = link_from_shaders(cs, 1, True)

    class show_image_shaders_:
        vs = GLuint(0)
        fs = GLuint(0)

    show_image_shaders = show_image_shaders_()

    show_image_shaders.vs = shader_load("showimage.vs.glsl", GL_VERTEX_SHADER)
    show_image_shaders.fs = shader_load("showimage.fs.glsl",
                                        GL_FRAGMENT_SHADER)

    show_image_shaders_list = [show_image_shaders.vs, show_image_shaders.fs]

    show_image_prog = link_from_shaders(show_image_shaders_list, 2, True)