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()
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()
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()
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()
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()
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()
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()
def setParameters(self): params = ol.getRenderParams() params.rate = 50000 #params.max_framelen = settings['calibration'].olRate params.on_speed = 1.0/1.0 params.off_speed = 1.0/1.0 params.start_dwell = 0 params.end_dwell = 0 params.corner_dwell = 0 params.curve_dwell = 0 params.curve_angle = cos(30.0*(pi/180.0)); # 30 deg params.start_wait = 28 params.end_wait = 95 params.snap = 1/100000.0; params.render_flags = ol.RENDER_NOREORDER; ol.setRenderParams(params)
def setParameters(self): params = ol.getRenderParams() params.rate = 50000 #params.max_framelen = settings['calibration'].olRate params.on_speed = 1.0/28.0 params.off_speed = 1.0/8.0 params.start_dwell = 4 params.end_dwell = 4 params.corner_dwell = 10 params.curve_dwell = 0 params.curve_angle = cos(30.0*(pi/180.0)); # 30 deg params.start_wait = 1 params.end_wait = 1 params.snap = 1/100000.0; params.render_flags = ol.RENDER_NOREORDER; ol.setRenderParams(params)
def setParametersToGuiValues(self): settings = LuxSettings() params = ol.getRenderParams() params.rate = settings['calibration'].olRate #params.max_framelen = settings['calibration'].olRate params.on_speed = 1.0/settings['calibration'].olOnSpeed params.off_speed = 1.0/settings['calibration'].olOffSpeed params.start_wait = settings['calibration'].olStartWait params.start_dwell = settings['calibration'].olStartDwell params.curve_dwell = settings['calibration'].olCurveDwell params.corner_dwell = settings['calibration'].olCornerDwell params.curve_angle = math.cos(30.0*(math.pi/180.0)); # 30 deg params.end_dwell = settings['calibration'].olEndDwell params.end_wait = settings['calibration'].olEndWait params.snap = 1/100000.0; params.render_flags = ol.RENDER_NOREORDER; ol.setRenderParams(params)
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import pylase as ol import sys if ol.init(10) < 0: sys.exit(1) 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) lines = sys.argv[1:] SIZE = 0.4 while True: lc = len(lines) font = ol.getDefaultFont() yoff = (lc / 2.0) * 0.4 for i, line in enumerate(lines): w = ol.getStringWidth(font, 0.4, line) ol.drawString(font, (-w / 2, yoff - i * 0.4), 0.4, ol.C_WHITE, line)
# You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import pylase as ol import sys if ol.init(10) < 0: sys.exit(1) 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) lines = sys.argv[1:] SIZE = 0.4 while True: lc = len(lines) font = ol.getDefaultFont() yoff = (lc/2.0) * 0.4 for i,line in enumerate(lines): w = ol.getStringWidth(font, 0.4, line) ol.drawString(font, (-w/2,yoff-i*0.4), 0.4, ol.C_WHITE, line)