• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pylase.loadIdentity函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pylase.loadIdentity函数的典型用法代码示例。如果您正苦于以下问题:Python loadIdentity函数的具体用法?Python loadIdentity怎么用?Python loadIdentity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了loadIdentity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        # set basic coord system
        ol.perspective(60, 1, 1, 100)
        ol.translate3((0, 0, -40))

        ol.color3(0.0, 0.0, 1.0)
        ol.scale3((1.0, 1.0, 1.0))

        # for i in range(10):
        #    x = random()*40-20
        #    y = random()*40-20
        # x = randint(-20,20)
        # y = randint(-20,20)
        #    square(x,y,.1)

        # truly randomly sampled by image vals
        # for i in range(20):
        #    x,y,val = rndlena()
        #    ol.color3(0.0,0.0,val/255.)
        #    square(x*40./SIZEX-20,y*40/SIZEY-20,.1)

        # totally random, weighted by image value
        for i in range(20):
            x = randint(0, SIZEX - 1)
            y = randint(0, SIZEY - 1)
            # val = lena.getpixel((x,y))
            # val = 1.-exp(-.5*lenadat[x*SIZEX+y]/255.)
            val = lenadat[x * SIZEX + y] / 255.0 * 0.77
            ol.color3(0.0, 0.0, val)
            square(x * 40.0 / SIZEX - 20, y * 40 / SIZEY - 20, 0.05)
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:33,代码来源:phospho_paint.py


示例2: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        ol.loadIdentity3()
        ol.perspective(20, 1, 1, 100)
        ol.translate3((0, 0, -20))

        ol.color3(1.0,1.0,0.0);
        ol.translate3( (cos(lux.time/2.0), cos(lux.time/3.0), cos(lux.time/7.0)) )
        ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate)
        ol.rotate3X(lux.time * pi * 0.25 * lux.simple_rate)
        ol.rotate3Y(lux.time * pi * 0.13 * lux.simple_rate)
        

        for row in self.torender:
            ol.begin(ol.LINESTRIP)
            vi = self.faces[row]
            vi = vi + [vi[0]]

            for i in vi:
                tup = tuple(self.verts[i,:])
                ol.vertex3(tup)
            
            ol.end()
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:25,代码来源:mesh.py


示例3: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        # Grab the raw audio buffers
        newbuffer = audio_engine.mono_buffer()

        # Make sure they aren't empty!!
        if (len(newbuffer) == 0):
            return
        else:
            self.mono = newbuffer

        # Openlase can only draw 30000 points in one cycle (less that
        # that, actually!).  Clear the audio buffer and try again!
        if self.mono.shape[0] > 10000:
            audio_engine.clear_all()

        ol.loadIdentity3()
        ol.color3(*(self.color_cycle()))

        ol.begin(ol.POINTS)
        for i in range(0, self.mono.shape[0]-1, self.SUBSAMP):

            val = tanh(self.mono[i] * self.BOOST)
            val = val * 0.5 + 0.5
            val = val * (self.MAX_SIZE - self.MIN_SIZE) + self.MIN_SIZE
            
            ol.vertex3((cos(self.pos) * val, sin(self.pos) * val, -1))
            
            self.pos = self.pos + self.W / 30000.0;
            while(self.pos >= 2*pi):
                self.pos = self.pos -2*pi
        ol.end()
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:34,代码来源:circlescope.py


示例4: run

	def run(self):
		while self.trace is None and not self.die:
			time.sleep(0.1)

		if self.die:
			return

		if ol.init(4) < 0:
			return
		print "OL Initialized"
		params = ol.RenderParams()
		params.render_flags = ol.RENDER_GRAYSCALE
		params.on_speed = 2/120.0
		params.off_speed = 2/30.0
		params.flatness = 0.000001
		params.max_framelen = 48000 / 25
		params.min_length = 30
		params.snap = 0.04
		ol.setRenderParams(params)
		ol.loadIdentity()
		ol.scale((2, -2))
		ol.translate((-0.5, -0.5))
		ol.scale((1/640.0, 1/640.0))
		ol.translate((0, (640-480)/2))

		while not self.die:
			#ol.rect((100, 100), (640-100, 480-100), ol.C_WHITE)
			objects = self.trace
			for o in objects:
				ol.begin(ol.POINTS)
				for point in o[::2]:
					ol.vertex(point, ol.C_WHITE)
				ol.end()
			ftime = ol.renderFrame(60)
		ol.shutdown()
开发者ID:CNCBASHER,项目名称:openlase,代码行数:35,代码来源:kinect_shadows.py


示例5: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        # Grab the raw audio buffers
        mono = audio_engine.left_buffer()
#        mono = np.zeros(512)

        # Make sure they aren't empty!!
        if (mono.shape[0] == 0):
            return

        # Openlase can only draw 30000 points in one cycle (less that
        # that, actually!).  Clear the audio buffer and try again!
        if mono.shape[0] > 10000:
            audio_engine.clear_all()
            return

        ol.loadIdentity3()
        ol.color3(*(self.color_cycle()))

        ol.begin(ol.LINESTRIP)
        for i in range(0, mono.shape[0]-1, self.subsamp):
            scale_factor = pow(0.9-abs(self.x_coord),0.5)*2
            if (mono[i] <= -1.0):
                mono[i] = 1.0
            ol.vertex3((self.x_coord, tanh(mono[i]*scale_factor), -1))
#            ol.vertex3((self.x_coord, log(mono[i]*scale_factor+1.0), -1))
            self.x_coord = self.x_coord + self.step
            if (self.x_coord > 0.9) : self.x_coord = -0.9
        ol.end()
开发者ID:gschmidt,项目名称:Fiat-Lux,代码行数:31,代码来源:scope.py


示例6: draw

    def draw(self):

        self.x_phase = 0.4*cos(1.7 * lux.time * self.RATE) + 0.6*cos(0.7 * lux.time * self.RATE)
        self.y_phase = cos(2.2 * lux.time * self.RATE)
        self.z_phase = cos(5.7 * lux.time * self.RATE)
        self.z_ratio = 2 + cos(0.1 * lux.time * self.RATE)

        ol.loadIdentity3()
        ol.loadIdentity()

        ol.perspective(20, 1, 1, 100)
        ol.translate3((0, 0, -10))
        ol.scale3((0.5, 0.5, 0.5))

        ol.rotate3Z(lux.time * pi * 0.01)
        ol.rotate3X(lux.time * pi * 0.025)
        ol.rotate3Y(lux.time * pi * 0.013)

        ol.color3(*(self.color_cycle()))

        ol.begin(ol.POINTS)
        decay_factor = 1
        first_point = None
        for i in range(self.SAMPLES_PER_FRAME):
            theta = float(i) / self.SAMPLES_PER_FRAME * self.MAX_THETA
            x = sin(self.x_ratio * theta + self.x_phase)
            y = sin(self.y_ratio * theta + self.y_phase)
            z = sin(self.z_ratio * theta + self.z_phase)
            if (i == 0):
                first_point = (x * decay_factor, y * decay_factor, z * decay_factor)
            ol.vertex3((x * decay_factor, y * decay_factor, z * decay_factor))
            decay_factor = decay_factor * self.decay
        ol.vertex3(first_point)
        ol.end()
开发者ID:gschmidt,项目名称:Fiat-Lux,代码行数:34,代码来源:harmonograph.py


示例7: draw

    def draw(self):
        time = lux.time
        #time = self.time
        ctf = self.color_time_frequency
        clf = self.color_length_frequency
        caf = self.color_angle_frequency/2
        theta = abs(math.sin(time*self.time_scale))
        R = self.R * math.sin(2*pi*time*self.time_scale*self.R_frequency)
        r = self.r * math.sin(2*pi*time*self.time_scale*self.r_frequency)
        p = self.p * math.sin(2*pi*time*self.time_scale*self.p_frequency) * self.bass

        ol.color3(1.0, 0.0, 1.0);
        ol.loadIdentity3()
        ol.loadIdentity()
        ol.perspective(60, 1, 1, 100)
        ol.translate3((0, 0, -3))
        
        first = True
        n = 0
        while theta < 2*pi*self.max_cycles and n < self.max_segments:
            theta += self.theta_step
            #x = (R + r) * math.cos(theta)
            #y = (R + r) * math.sin(theta)
            x = (R + r) * math.cos(theta) + (r + p) * math.cos((R+r)/r * theta)
            y = (R + r) * math.sin(theta) + (r + p) * math.sin((R+r)/r * theta)
            
            if first:
                ol.begin(ol.LINESTRIP)
                #ol.begin(ol.POINTS)
                first = False
            #red = math.sin(ctf*time*n/37) * math.sin(csf*theta*n/37)
            #green = math.sin(ctf*time*n/23) * math.sin(csf*theta*n/23)
            #blue = math.sin(ctf*time*n/128) * math.sin(csf*theta*n/128)
            
            angle = math.atan2(y, x)/(2*pi)
            red   = abs(math.sin(2*pi*(self.r_prime/3+ctf*time+clf*n+caf*angle)))
            green = abs(math.sin(2*pi*(self.g_prime/3+ctf*time+clf*n+caf*angle)))
            blue =  abs(math.sin(2*pi*(self.b_prime/3+ctf*time+clf*n+caf*angle)))
            ol.color3(red, green, blue)
            
            #this makes it square-ish
            #x += math.cos(2*pi*angle*self.spatial_resonance)*self.spatial_resonance_amplitude
            #y += math.sin(2*pi*angle*self.spatial_resonance)*self.spatial_resonance_amplitude
            x += math.cos(2*pi*angle*(self.spatial_resonance+1)+2*pi*self.spatial_resonance_offset)*self.spatial_resonance_amplitude
            y += math.sin(2*pi*angle*(self.spatial_resonance+1)+2*pi*self.spatial_resonance_offset)*self.spatial_resonance_amplitude


            x *= self.width
            y *= self.height
            ol.vertex3((x,y,0))
            n += 1
        ol.end()
        #dynamically adjust resolution
        target = self.max_segments * 0.8
        error = (target - n)/target
        self.theta_step = min(max(1e-100, self.theta_step * (1-error)), 1)
        #print n,  angle
        self.time += 1/30
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:58,代码来源:guilloche.py


示例8: draw

    def draw(self):
        ol.loadIdentity()

        ol.color3(1.0, 1.0, 1.0);

        # bounding box
        ol.begin(ol.LINESTRIP)
        self.square(1,1,-1,-1)
        ol.end()
        
        # horizontal line
        ol.begin(ol.LINESTRIP)
        ol.vertex((-1,0))
        ol.vertex((1,0))        
        ol.end()

        # vertical line
        ol.begin(ol.LINESTRIP)
        ol.vertex((0,-1))
        ol.vertex((0,1))        
        ol.end()

        # inner box, for fun
        ol.color3(0.0, 1.0, 0.0);
        size = (sin(lux.time) * .2)+.5
        ol.begin(ol.LINESTRIP)
        self.square(size,size,-size,-size)
        ol.end()

        # Red dots
        ol.loadIdentity()
        ol.loadIdentity3()

        ol.begin(ol.LINESTRIP)
        for y in range(0, 20):
            ol.color3(float(y)/20.0, 0.0, 0.0);
            ol.vertex3((-0.6, (float(y-10) / 12.0), -1.0))
        ol.end()

        # Green dots
        ol.begin(ol.LINESTRIP)
        for y in range(0, 20):
            ol.color3(0.0, float(y)/20.0, 0.0);
            ol.vertex3((-0.4, (float(y-10) / 12.0), -1.0))
        ol.end()

        # Blue dots
        ol.begin(ol.LINESTRIP)
        for y in range(0, 20):
            ol.color3(0.0, 0.0, float(y)/20.0);
            ol.vertex3((-0.2, (float(y-10) / 12.0), -1.0))
        ol.end()

        # vertical line
        ol.begin(ol.LINESTRIP)
        ol.vertex((0,-1))
        ol.vertex((0,1))        
        ol.end()
开发者ID:fenn,项目名称:Fiat-Lux,代码行数:58,代码来源:testpattern.py


示例9: play_ugo

def play_ugo(size, frames, meta):
    frame_pts = []
    total_time = 0
    for frame_meta in meta['frames']:
        frame_pts.append(total_time)
        total_time += frame_meta['delay'] / 1000.0

    if ol.init(3) < 0:
        return

    width, height = size

    params = ol.RenderParams()
    params.render_flags = ol.RENDER_GRAYSCALE
    params.on_speed = 2/60.0
    params.off_speed = 2/30.0
    params.flatness = 0.000001
    params.max_framelen = 48000 / 25
    params.min_length = 30
    params.snap = 0.04
    ol.setRenderParams(params)
    ol.loadIdentity()
    ol.scale((2, -2))
    ol.translate((-0.5, -0.5))
    mw = float(max(width, height))
    print width, height, mw
    ol.scale((1/mw, 1/mw))
    ol.translate(((mw-width)/2, (mw-height)/2))

    frame = 0
    time = 0

    DECIMATE = 2

    while True:
        while time > total_time:
            time -= total_time
            frame = 0

        while (frame+1) < len(frames) and frame_pts[frame+1] < time:
            frame += 1

        print "t=%.02f frame=%d" % (time, frame)

        objects = frames[frame]
        points = 0
        for o in objects:
            ol.begin(ol.POINTS)
            for point in o[::DECIMATE]:
                ol.vertex(point, ol.C_WHITE)
                points += 1
            ol.end()
        print "%d objects, %d points" % (len(objects), points)
        time += ol.renderFrame(60)

    ol.shutdown()
开发者ID:SteveClement,项目名称:openlase,代码行数:56,代码来源:ugoira_player.py


示例10: draw_frame

def draw_frame():
        global DRAW, frame_number

        #print "drawing frame ", frame_number
        frame_number = frame_number + 1
        
        ol.loadIdentity()
        #ol.scale((MAX_X, MAX_Y))
        DRAW.draw()
        ol.renderFrame(50)
开发者ID:nomad2012,项目名称:laser-asteroids,代码行数:10,代码来源:main.py


示例11: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        ol.color3(1.0, 0.0, 1.0);
        font = ol.getDefaultFont()
        s = "Lux!"
        w = ol.getStringWidth(font, 0.2, s)
        ol.drawString(font, (-w/2,0.1), 0.2, s)

        ol.perspective(60, 1, 1, 100)
        ol.translate3((0, 0, -3))

        for i in range(2):

            if (i == 1):
                ol.color3(1.0,1.0,0.0);
            else:
                ol.color3(0.0,1.0,1.0);
                    
            ol.scale3((0.6, 0.6, 0.6))
            ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate)
            ol.rotate3X(lux.time * pi * 0.8 * lux.simple_rate)
            ol.rotate3Y(lux.time * pi * 0.73 * lux.simple_rate)
            
            ol.begin(ol.LINESTRIP)
            ol.vertex3((-1, -1, -1))
            ol.vertex3(( 1, -1, -1))
            ol.vertex3(( 1,  1, -1))
            ol.vertex3((-1,  1, -1))
            ol.vertex3((-1, -1, -1))
            ol.vertex3((-1, -1,  1))
            ol.end()

            ol.begin(ol.LINESTRIP);
            ol.vertex3(( 1,  1,  1))
            ol.vertex3((-1,  1,  1))
            ol.vertex3((-1, -1,  1))
            ol.vertex3(( 1, -1,  1))
            ol.vertex3(( 1,  1,  1))
            ol.vertex3(( 1,  1, -1))
            ol.end()

            ol.begin(ol.LINESTRIP)
            ol.vertex3(( 1, -1, -1))
            ol.vertex3(( 1, -1,  1))
            ol.end()

            ol.begin(ol.LINESTRIP)
            ol.vertex3((-1,  1,  1))
            ol.vertex3((-1,  1, -1))
            ol.end()
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:52,代码来源:simple.py


示例12: draw

    def draw(self):
        ol.loadIdentity()

        ol.rotate(lux.time / 10)

        # Grab the raw audio buffer
        mono = audio_engine.mono_buffer()

        # Make sure it ain't empty!!
        if mono.shape[0] == 0:
            return

        # Openlase can only draw 30000 points in one cycle (less that
        # that, actually!).  Clear the audio buffer and try again!
        if mono.shape[0] > 10000:
            audio_engine.clear_all()
            return

        ol.color3(*(self.color_cycle()))
        ol.perspective(60, 1, 1, 100)
        ol.translate3((0, 0, -3))

        if lux.time > self.nextSnapshot:
            # print "snapshot"
            self.nextSnapshot = lux.time + self.interval
            self.currentWave = self.nextWave
            self.nextWave = zeros(shape=(self.renderPointCount))
            # load in new values
            for i in range(self.renderPointCount - 1):
                self.nextWave[i] = mono[i * self.skip]

        # draw shape
        fracIntervalComplete = (lux.time - (self.nextSnapshot - self.interval)) / self.interval
        #        print '%f %f %f' % (lux.time,fracIntervalComplete, self.nextSnapshot)
        coordsToRender = zeros(shape=(self.renderPointCount, 2))
        firstVal = None
        for i in range(self.renderPointCount - 1):
            val = ((self.nextWave[i] - self.currentWave[i]) * fracIntervalComplete) + self.currentWave[i]
            if firstVal is None:
                firstVal = val
            # print "next: %f  curr:  %f   frac: %f" % (self.nextWave[i], self.currentWave[i], fracIntervalComplete)
            (x, y) = self.doTheTrigStuff(val, (float(i) / float(self.renderPointCount)), firstVal)
            coordsToRender[i][0] = x
            coordsToRender[i][1] = y
        coordsToRender[self.renderPointCount - 1] = coordsToRender[0]

        # render shape
        ol.begin(ol.LINESTRIP)
        for i in range(self.renderPointCount):
            #            print '%f: %f,%f' % (i,coordsToRender[i][0], coordsToRender[i][1])
            ol.vertex((coordsToRender[i][0], coordsToRender[i][1]))
        ol.end()
开发者ID:fenn,项目名称:Fiat-Lux,代码行数:52,代码来源:bouncyball.py


示例13: run

	def run(self):
		ol.init()
		params = ol.RenderParams()
		params.render_flags = ol.RENDER_NOREORDER | ol.RENDER_GRAYSCALE
		ol.setRenderParams(params)

		while not self.die:
			ol.loadIdentity()
			for x,y in self.dots:
				ol.dot((x,y), 30, ol.C_WHITE)

			ol.renderFrame(100)
		ol.shutdown()
开发者ID:CNCBASHER,项目名称:openlase,代码行数:13,代码来源:harp2.py


示例14: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()

        for i in range(2):
            ol.loadIdentity3()
            ol.perspective(20, 1, 1, 100)
            ol.translate3((0, 0, -20))

            if (i == 1):
                ol.color3(1.0,1.0,0.0);
                ol.translate3((cos(lux.time/2.0), cos(lux.time/3.0), cos(lux.time/7.0)))
                ol.rotate3Z(lux.time * pi * 0.1 * lux.simple_rate)
                ol.rotate3X(lux.time * pi * 0.25 * lux.simple_rate)
                ol.rotate3Y(lux.time * pi * 0.13 * lux.simple_rate)
            else:
                ol.color3(0.0,1.0,1.0);
                ol.scale3((0.6, 0.6, 0.6))
                ol.translate3((cos(lux.time/3.2), cos(lux.time/2.6), cos(lux.time/5.4)))
                ol.rotate3Z(lux.time * pi * 0.14 * lux.simple_rate)
                ol.rotate3X(lux.time * pi * 0.53 * lux.simple_rate)
                ol.rotate3Y(lux.time * pi * 0.22 * lux.simple_rate)
            
            ol.begin(ol.LINESTRIP)
            ol.vertex3((-1, -1, -1))
            ol.vertex3(( 1, -1, -1))
            ol.vertex3(( 1,  1, -1))
            ol.vertex3((-1,  1, -1))
            ol.vertex3((-1, -1, -1))
            ol.vertex3((-1, -1,  1))
            ol.end()

            ol.begin(ol.LINESTRIP);
            ol.vertex3(( 1,  1,  1))
            ol.vertex3((-1,  1,  1))
            ol.vertex3((-1, -1,  1))
            ol.vertex3(( 1, -1,  1))
            ol.vertex3(( 1,  1,  1))
            ol.vertex3(( 1,  1, -1))
            ol.end()

            ol.begin(ol.LINESTRIP)
            ol.vertex3(( 1, -1, -1))
            ol.vertex3(( 1, -1,  1))
            ol.end()

            ol.begin(ol.LINESTRIP)
            ol.vertex3((-1,  1,  1))
            ol.vertex3((-1,  1, -1))
            ol.end()
开发者ID:fenn,项目名称:Fiat-Lux,代码行数:50,代码来源:two_cubes.py


示例15: draw

    def draw(self):
        '''a square'''
        #self.x = math.cos(2*pi*rotate_frequency*lux.time + self.angle + self.base_angle) * self.distance * self.distance_scale
        #self.y = math.sin(2*pi*rotate_frequency*lux.time + self.angle + self.base_angle) * self.distance * self.distance_scale
        
        #stolen from guilloche
        time = lux.time * time_scale 
        R = math.sin(2*pi*self.R_frequency*time) * self.R + 0.0001
        r = math.sin(2*pi*self.r_frequency*time) * self.r + 0.0001
        p = math.sin(2*pi*self.p_frequency*time) * self.p + 0.0001
        self.x = (R + r) * math.cos(time) + (r + p) * math.cos((R+r)/r * time) 
        self.y = (R + r) * math.sin(time) + (r + p) * math.sin((R+r)/r * time) 
        
        #clamp to display area
        if clamp_display:
            if self.x > 1: self.x = 1
            if self.y > 1: self.y = 1
            if self.x < -1: self.x = -1
            if self.y < -1: self.y = -1
        self.x *= scale
        self.y *= scale
        #self.graphics.circle(0, 0, self.radius)
        ol.loadIdentity3()
        ol.loadIdentity()


        #ol.color3(self.color[0], self.color[1], self.color[2])
        ol.color3(self.red, self.green, self.blue)
        ol.translate3((self.x, self.y, 0))
        angle = math.atan2(self.y, self.x)/(2*pi)
        red   = abs(math.sin(2*pi*(r_prime/3+ctf*time+clf*self.n+caf*angle)))*self.red
        green = abs(math.sin(2*pi*(g_prime/3+ctf*time+clf*self.n+caf*angle)))*self.green
        blue =  abs(math.sin(2*pi*(b_prime/3+ctf*time+clf*self.n+caf*angle)))*self.blue
        if seizure_mode:
          #red, green, blue = red/self.radius, green/self.radius, blue/self.radius
          red = abs(red*math.tan((2*pi*self.radius/node_big_radius)))
          green = abs(green*math.tan((2*pi*self.radius/node_big_radius)))
          blue = abs(blue*math.tan((2*pi*self.radius/node_big_radius)))
        
        ol.color3(red, green, blue)
 
        #do squares have radii?
        s = self.radius
        ol.begin(ol.POINTS)
        ol.vertex3((-s, s,0))
        ol.vertex3((-s, s,0))
        ol.vertex3(( s, s,0))
        ol.vertex3(( s,-s,0))
        ol.vertex3((-s,-s,0))
        ol.end()
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:50,代码来源:pulse_noaudio.py


示例16: run

	def run(self):
		if ol.init(10) < 0:
			return
		params = ol.RenderParams()
		params.render_flags = ol.RENDER_NOREORDER | ol.RENDER_GRAYSCALE
		params.on_speed = 2/120.0
		params.off_speed = 2/30.0
		params.flatness = 0.000001
		ol.setRenderParams(params)
		ol.setPixelShader(self.shade)
		time = 0
		frames = 0
		cur_tweets = self.tweets
		xpos = 0
		idx = 0
		startpos = 1.3
		while not self.die:
			ol.loadIdentity3()
			ol.loadIdentity()

			if cur_tweets is None and self.tweets is not None:
				cur_tweets = self.tweets
				idx = 0
				xpos = startpos

			w = 0
			#print cur_tweets
			if cur_tweets is not None:
				font = ol.getDefaultFont()
				w = ol.getStringWidth(font, 0.4, cur_tweets[idx])
				col = ol.C_WHITE
				#print "Render %f %s 0x%x"%(xpos, cur_tweets[idx], col)
				ol.drawString(font, (xpos,0.1), 0.4, col, cur_tweets[idx])
	
			#print "render"
			ftime = ol.renderFrame(60)
			#print "done"
			xpos -= 0.6*ftime
			if xpos < (-w-1) and cur_tweets is not None:
				xpos = startpos
				idx += 1
				idx %= len(cur_tweets)
				if self.tweets != cur_tweets:
					idx = 0
					cur_tweets = self.tweets
					print("Reset and update")
				print("Finished, new idx: %d"%idx)
			frames += 1
			time += ftime
		ol.shutdown()
开发者ID:marcan,项目名称:openlase,代码行数:50,代码来源:tweet.py


示例17: draw

    def draw(self):
        ol.loadIdentity3()
        ol.loadIdentity()
        ol.color3(0.0, 1.0, 1.0)
        ol.perspective(60, 1, 1, 100)
        ol.translate3((0, 0, -3))

        # target_x, target_y = random.uniform(-1, 1), random.uniform(-1, 1)
        target_x, target_y = (
            math.sin(2 * pi * swoosh_frequency * lux.time * 3),
            math.sin(2 * pi * swoosh_frequency * lux.time * 5),
        )
        # target_x, target_y = math.tan(2*pi*swoosh_frequency*lux.time*3), math.sin(2*pi*swoosh_frequency*lux.time*5)
        for arm in self.arms:
            arm.draw([target_x, target_y])
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:15,代码来源:reach.py


示例18: draw

  def draw(self, val):
    '''a square'''
    ol.loadIdentity3()
    ol.loadIdentity()
    ol.color3(self.color[0], self.color[1], self.color[2])
    ol.translate3((self.x, self.y, 0))
    ol.begin(ol.POINTS)
    ol.vertex3((.0,.0,.0))
    ol.vertex3((.0,.1,.0))
    ol.vertex3((.1,.1,.0))
    ol.vertex3((.1,.0,.0))
    ol.vertex3((.0,.0,.0))
    ol.end()

    self.moving = True
    return self
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:16,代码来源:tween_chain.py


示例19: draw

    def draw(self):
        time = lux.time
        ctf = self.color_time_frequency
        clf = self.color_length_frequency
        caf = self.color_angle_frequency/2
        theta0 = abs(math.sin(time*self.time_scale))

        
        for braid_count in range(1,self.NUM_CIRCLES):
            first = True
            n = 0
            theta = theta0
            
            ol.color3(1.0, 0.0, 1.0);
            ol.loadIdentity3()
            ol.loadIdentity()
            ol.perspective(40, 1, 1, 100)
            ol.translate3((0, 0, -3))
            ol.rotate3Z(lux.time * pi * self.z_rotations[braid_count])
            ol.rotate3X(lux.time * pi * self.x_rotations[braid_count])
            ol.rotate3Z(lux.time * pi * self.x_rotations[braid_count])

            ol.begin(ol.LINESTRIP)
            while theta < theta0 + 2*pi:

                r = (0.5+sin(10*theta)/2.0) / float(braid_count) * self.scale
                x = r * cos(theta)
                y = r * sin(theta)

                angle = math.atan2(y, x)/(2*pi)
                red   = abs(math.sin(2*pi*(self.r_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count]))
                green = abs(math.sin(2*pi*(self.g_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count]))
                blue =  abs(math.sin(2*pi*(self.b_prime/3+ctf*time+clf*n+caf*angle)+self.color_phases[braid_count]))
                ol.color3(red, green, blue)
                ol.vertex3((x,y,0))
                n += 1

                theta += 1.0/float(self.max_segments)

            r = (0.5+sin(10*theta)/2.0) / float(braid_count) * self.scale
            x = r * cos(theta)
            y = r * sin(theta)
            ol.vertex3((x,y,0))  # Close the path
            ol.end()
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:44,代码来源:daisy.py


示例20: draw

    def draw(self):

        a = self.alpha * cos(lux.time / 10.0 * self.RATE)
        b = self.beta * sin(lux.time / 7.0 * self.RATE) + 10
        c = self.gamma * cos(lux.time / 11.0 * self.RATE)
        A = self.rho

        ol.loadIdentity3()
        ol.loadIdentity()
        ol.rotate3Z(lux.time * pi * 0.03)
        ol.color3(*(self.color_cycle()))

        ol.begin(ol.LINESTRIP)
        for i in range(self.SAMPLES_PER_FRAME):
            theta = float(i) / self.SAMPLES_PER_FRAME * self.MAX_THETA
            r = exp(cos(a * theta)) - A * cos(b*theta) + pow(abs(sin(theta/c)),b)
            r = r / (2.7 - A + pow(1,b)) * self.overall_amplitude

            ol.vertex3((r * cos(theta), r * sin(theta), -1))
        ol.end()
开发者ID:fenn,项目名称:Fiat-Lux,代码行数:20,代码来源:butterfly_curve.py



注:本文中的pylase.loadIdentity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pylast.get_lastfm_network函数代码示例发布时间:2022-05-25
下一篇:
Python core.run函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap