def map_pixels(self): # set all pixels by mapping each element of the "model" through # "fn" and setting the corresponding pixel value. The "fn" function # returns a tuple of three 8-bit RGB values. # print "active shaders: %s" % self.shaders nprocs = 1 chunksize = int(ceil(len(self.model) / float(nprocs))) # multiple_results = [pool.apply_async(os.getpid, ()) for i in range(4)] # print [res.get(timeout=1) for res in multiple_results] procs = [] for i in range(nprocs): p = multiprocessing.Process( target=self.worker, args=(chunksize * i,chunksize * (i + 1))) procs.append(p) p.start() draw()
def draw(self): draw()