def __init__(self, *args, **kwargs): super(SSAO, self).__init__(*args, **kwargs) self.sf = 3 w, h = self.size[0] / self.sf, self.size[1] / self.sf self.normdepth = FBO(["color0", "depth"], size=(w, h)) self.ping = FBO(['color0'], size=(w, h)) self.pong = FBO(["color0"], size=(w, h)) self.add_shader("fsquad", GL_VERTEX_SHADER, "fsquad.v.glsl") self.add_shader("ssao_pass1", GL_FRAGMENT_SHADER, "ssao_pass1.f.glsl") self.add_shader("ssao_pass2", GL_FRAGMENT_SHADER, "ssao_pass2.f.glsl") self.add_shader("ssao_pass3", GL_FRAGMENT_SHADER, "ssao_pass3.f.glsl", "phong.f.glsl") self.add_shader("hblur", GL_FRAGMENT_SHADER, "hblur.f.glsl") self.add_shader("vblur", GL_FRAGMENT_SHADER, "vblur.f.glsl") #override the default shader with this passthru + ssao_pass1 to store depth self.add_program("ssao_pass1", ("passthru", "ssao_pass1")) self.add_program("ssao_pass2", ("fsquad", "ssao_pass2")) self.add_program("hblur", ("fsquad", "hblur")) self.add_program("vblur", ("fsquad", "vblur")) self.add_program("ssao_pass3", ("passthru", "ssao_pass3")) randtex = np.random.rand(3, w, h) randtex /= randtex.sum(0) self.rnm = Texture(randtex.T, wrap_x=GL_REPEAT, wrap_y=GL_REPEAT, magfilter=GL_NEAREST, minfilter=GL_NEAREST) self.rnm.init() self.clips = args[2], args[3]
def __init__(self, *args, **keyargs): """Constructor""" # construct the base class super(FBOWindow, self).__init__(*args, **keyargs) # construct the fbo and attach it self.fbo = FBO(self.width, self.height) self.fbo.attach()
def on_resize(self, w, h): super(FBOWindow, self).on_resize(w, h) self.fbo.detach() self.fbo = FBO(w, h) self.fbo.attach()