def calculateVBOList(self, image = None): ''' Create the VBO list to be passed on to the module for drawing vbolist could possibly be a multi-layered tuple, one tuple per layer. So that it doesn't have to be recalculated every time one single image is changed. ''' self.vbolist = [self.VBO, ADT.arrayByteCount(numpy.zeros((2, 2), 'f'))] for layer in self.layers: for img in self.images[layer]: if img.hidden: continue self.vbolist.append(img.textureId) self.vbolist.append(img.offset) glmod.setVBO(tuple(self.vbolist))
def calculateVBOList(self, image = None, delete = False): ''' Create the VBO list to be passed on to the module for drawing or if the change is only one image, modify it. ''' if len(self.layers) > 0 and image != None: if delete: #print "delete" temp = [self.layers.index(image.layer)] for img in self.images[image.layer]: if img.hidden or img == image: continue temp.append(int(img.textureId)) temp.append(img.offset) glmod.setVBOlayer(tuple(temp)) elif image.createLayer: layer = self.layers.index(image.layer) glmod.insertVBOlayer((layer, int(image.textureId), image.offset)) #print "addLayer", (layer, image.textureId, image.offset) image.createLayer = False else: layer = self.layers.index(image.layer) #print "addEntry", (layer, image.textureId, image.offset) glmod.addVBOentry((layer, int(image.textureId), image.offset)) return vbolist = [] for layer in self.layers: temp = [] for img in self.images[layer]: if img.hidden: continue temp.append(img.textureId) temp.append(img.offset) vbolist.append(tuple(temp)) if len(vbolist) > 0: #print "setVBO", vbolist glmod.setVBO(tuple(vbolist))