Whoops, the code in the previous message should have these two lines: t = self.getTile(iii, jjj) t.height = heightMap[iii][jjj] Changed to: t = self.getTile((i, j)) t.height = heightMap[i][j]
By the way, I lowered my hopes a little and will save height stuff for a future RTS. Right now I'd be happy with a map made out of a few big quads(for minor culling), with a repeating texture. I know how to use textures with glBegin and glEnd 'tags', but how do I go about mapping textures onto vertex lists or indexed vertex lists(which by the way I'd like to know how to make, since I couldn't find examples anywhere, and I looked a lot)? On May 16, 8:46 pm, eFFeeMMe <[EMAIL PROTECTED]> wrote: > Hello, I'm still working on that little RTS project. > > I've managed to make a Map class, which stores information about the > terrain, and produces OpenGL output based on it. So far I've randomly > generated stuff like height and tile color, but I wanted to be able to > load those from a file, possibly an image. The problem is, I have no > clue how to use the output from ImageData.get_data. > > My code so far: > def heightMapFromImage(self, image): > imageData = image.get_image_data() > data = imageData.get_data('RGB', imageData.width * 3) > > def heightFromHeightMap(self, heightMap): > iii = min(len(heightMap), self.width) > jjj = min(len(heightMap[0]), self.height) > > for i in range(iii): > for j in range(jjj): > t = self.getTile(iii, jjj) > t.height = heightMap[iii][jjj] > > In the second function, heightMap is supposed to be a bidimensional > array containing integers. How do I get those integers out of the > string get_data returns me? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to pyglet-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---