コード例 #1
0
    def update(self):
        glLibPushView()
        glDisable(GL_BLEND)
        
        if self.pingpong == 1:
            if self.get_new:
                self.pos_time_texture = self.framebuffer2.get_texture(1)
            self.velocity_texture = self.framebuffer2.get_texture(2)
            self.framebuffer1.enable([1,2])
        else:
            if self.get_new:
                self.pos_time_texture = self.framebuffer1.get_texture(1)
            self.velocity_texture = self.framebuffer1.get_texture(2)
            self.framebuffer2.enable([1,2])

        glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
        glLoadIdentity()
        self.view_2D.set_view()
        glLibUseShader(self.update_shader)
        self.update_shader.pass_texture(self.pos_time_texture,1)
        self.update_shader.pass_texture(self.velocity_texture,2)
        self.update_shader.pass_texture(self.rand_tex,3)
        self.update_shader.pass_vec3("initialpos",self.origin)
        self.update_shader.pass_vec3("initialspeed",self.initialspeed)
        self.update_shader.pass_vec3("forces",self.forces)
        self.update_shader.pass_vec3("scale",self.scale)
        self.update_shader.pass_vec3("trans",self.trans)
        self.update_shader.pass_vec3("jitter",self.jitter)
        self.update_shader.pass_float("size",float(self.size[0]))
        self.update_shader.pass_float("step",self.density_constant*self.density)
        self.update_shader.pass_vec2("xedge",[self.negx,self.posx])
        self.update_shader.pass_vec2("yedge",[self.negy,self.posy])
        self.update_shader.pass_vec2("zedge",[self.negz,self.posz])
        
        self.particles.draw()
        glLibUseShader(None)

        if self.pingpong == 1:
            self.framebuffer1.disable()
        else:
            self.framebuffer2.disable()

        self.pingpong = 3 - self.pingpong

        glEnable(GL_BLEND)
        glLibPopView()
コード例 #2
0
    def update(self):
        glLibPushView()
        glDisable(GL_BLEND)

        if self.pingpong == 1:
            if self.get_new:
                self.pos_time_texture = self.framebuffer2.get_texture(1)
            self.velocity_texture = self.framebuffer2.get_texture(2)
            self.framebuffer1.enable([1, 2])
        else:
            if self.get_new:
                self.pos_time_texture = self.framebuffer1.get_texture(1)
            self.velocity_texture = self.framebuffer1.get_texture(2)
            self.framebuffer2.enable([1, 2])

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
        glLoadIdentity()
        self.view_2D.set_view()
        glLibUseShader(self.update_shader)
        self.update_shader.pass_texture(self.pos_time_texture, 1)
        self.update_shader.pass_texture(self.velocity_texture, 2)
        self.update_shader.pass_texture(self.rand_tex, 3)
        self.update_shader.pass_vec3("initialpos", self.origin)
        self.update_shader.pass_vec3("initialspeed", self.initialspeed)
        self.update_shader.pass_vec3("forces", self.forces)
        self.update_shader.pass_vec3("jitter", self.jitter)
        self.update_shader.pass_float("size", float(self.size[0]))
        self.update_shader.pass_float("step",
                                      self.density_constant * self.density)
        self.update_shader.pass_vec2("xedge", [self.negx, self.posx])
        self.update_shader.pass_vec2("yedge", [self.negy, self.posy])
        self.update_shader.pass_vec2("zedge", [self.negz, self.posz])

        self.particles.draw()
        glLibUseShader(None)

        if self.pingpong == 1:
            self.framebuffer1.disable()
        else:
            self.framebuffer2.disable()

        self.pingpong = 3 - self.pingpong

        glEnable(GL_BLEND)
        glLibPopView()
コード例 #3
0
 def glLibInternal_pop(self):
     glEnable(GL_BLEND)
     glLibPopView()
コード例 #4
0
 def glLibInternal_pop(self):
     glEnable(GL_BLEND)
     glLibPopView()