示例#1
0
def on_draw():
    window.clear()

    with nested(projection, texture):
        glPushMatrix()
        glTranslatef(0, 0, -3)
        glRotatef(-45, 1, 0, 0)
        glRotatef(rotation, 0.0, 0.0, 1.0)
        quad(-1, 1, 1, -1)
        glPopMatrix()
示例#2
0
    def step(self):
        self.framebuffer.textures[0] = self.tex1
        self.tex1.unit = GL_TEXTURE0
        self.tex2.unit = GL_TEXTURE1
        self.tex3.unit = GL_TEXTURE2

        with nested(self.framebuffer, self.program, self.tex2, self.tex3):
            quad(self.width, self.height, 0, 0)

        self.tex1, self.tex2, self.tex3 = self.tex2, self.tex3, self.tex1
示例#3
0
    def step(self):
        self.framebuffer.textures[0] = self.tex1
        self.tex1.unit = GL_TEXTURE0
        self.tex2.unit = GL_TEXTURE1
        self.tex3.unit = GL_TEXTURE2

        with nested(self.framebuffer, self.program, self.tex2, self.tex3):
            quad(self.width, self.height, 0, 0)

        self.tex1, self.tex2, self.tex3 = self.tex2, self.tex3, self.tex1
示例#4
0
def on_draw():
    window.clear()


    with nested(projection, texture):
        glPushMatrix()
        glTranslatef(0, 0, -3)
        glRotatef(-45, 1, 0, 0)
        glRotatef(rotation, 0.0, 0.0, 1.0)
        quad(-1, 1, 1, -1)
        glPopMatrix()
示例#5
0
文件: sprite.py 项目: timo/pinpediq
  def draw(self, image = None, alpha = 1.0):
    if image:
      image.bind()
    else:
      self.img.bind()

    if self.state == "ouch" and timer.blink(0.1):
      glColor4f(1.0, 1.0, 1.0, alpha / 2)
    else:
      glColor4f(1.0, 1.0, 1.0, alpha)

    glPushMatrix()
    glTranslatef(self.x, self.y, 0)
    if self.vx < 0:
      glTranslatef(self.w, 0, 0)
      glScalef(-1, 1, 0)
    glScalef(self.w, self.h, 1)

    util.quad()
    
    glPopMatrix()
示例#6
0
from math import pi, sin

import util

if __name__ == '__main__':
    print('8 squared = {}'.format(util.square(8)))

    val = util.quad(pi)
    print('pi quad = {:0.6f}'.format(val))

    print('sin(pi) = {:0.2f}'.format(sin(pi)))

    xs = [1, 2, 3, 4]
    x = 6
    if x in xs:
        print('{} is in {}'.format(x, xs))
    else:
        print('{} is not in  {}'.format(x, xs))
示例#7
0
文件: r2vb.py 项目: tpascal/GLETools
 def update_from(self, source):
     with nested(self.fbo, self.view, source, self.program):
         quad(self.width, self.height, 0, 0)
         self.vbo.vertices.copy_from(self.vertex_texture)
         self.vbo.normals.copy_from(self.normal_texture)
示例#8
0
 def update_from(self, source):
     with nested(self.fbo, self.view, source, self.program):
         quad(self.width, self.height, 0, 0)
         self.vbo.vertices.copy_from(self.vertex_texture)
         self.vbo.normals.copy_from(self.normal_texture)