def draw(self, shape): """ draw the shape using the clashtest Shader Arguments: *shape* Shape object that will be drawn """ if not self.s_flg: opengles.glEnable(GL_SCISSOR_TEST) opengles.glScissor(GLint(0), GLint(self.y0), GLsizei(self.ix), GLsizei(1)) self.s_flg = True shape.draw(shader=self.shader)
def start_capture(self, clear=True): """ after calling this method all object.draw()s will rendered to this texture and not appear on the display. Large objects will obviously take a while to draw and re-draw """ super(PostProcess, self)._start(clear=clear) from pi3d.Display import Display xx = int(Display.INSTANCE.width / 2.0 * (1.0 - self.scale)) yy = int(Display.INSTANCE.height / 2.0 * (1.0 - self.scale)) ww = int(Display.INSTANCE.width * self.scale) hh = int(Display.INSTANCE.height * self.scale) opengles.glEnable(GL_SCISSOR_TEST) opengles.glScissor(GLint(xx), GLint(yy), GLsizei(ww), GLsizei(hh))
def repaint(self, t): self.move() self.bounce_wall(Display.INSTANCE.width, Display.INSTANCE.height) if t == 0: #TODO this is not good but there needs to be a way to say last ball! opengles.glScissor(GLint(0), GLint(0), GLsizei(int(Display.INSTANCE.width)), GLsizei(int(Display.INSTANCE.height))) #NB the screen coordinates for glScissor have origin in BOTTOM left else: opengles.glScissor( GLint(int(self.or_x + self.unif[0] - self.radius - 5)), GLint(int(self.or_y + self.unif[1] - self.radius - 5)), GLsizei(self.w + 10), GLsizei(self.h + 10)) self.draw()