title: How to save and reload a rendered model/list to save loading and rendering time at startup in python,pygame and pyopengl?
body: <p>First off, this what I'm trying to achieve: I have a rendered height map object stored in a file, which when I open it up at the beginning of my game the terrain is already loaded saving countless minutes of loading and rendering, not counting all the other objects in my game, which i would do the same thing for.</p>
  
  <p>I'm programming a map editor that would first let me edit a map then I compile/render it and then saves the compiled list of the map to a file. Then when I go on my game, the game loads the file up and stores the list into an object template class.</p>
  
  <p>This is the algo for how I'd like to load up the list from the file at the startup of the game:</p>
  
  <pre><code>renderedList = load_map("map.pom") # &lt;- this would call a function which would open the file and dump it to a renderedList variable
  class Obj():
      def __init__(self, renderedList):
          self.list = renderedList
      def draw(self,pos=[0,0,0],rotations=[],scalar=1.0):
          glPushMatrix()
          glTranslatef(*pos)
          if len(rotations) == 3:
              if rotations[0] != 0: glRotatef(rotations[0],1,0,0)
              if rotations[1] != 0: glRotatef(rotations[1],0,1,0)
              if rotations[2] != 0: glRotatef(rotations[2],0,0,1)
          glScalef(scalar,scalar,scalar)
          glCallList(self.list)
          glPopMatrix()
      def __del__(self):
          del self.list
  
  Map = Obj(renderedList) # &lt;- here I create an object which allows me to draw or delete the list to/from the screen
  
  ...
  ''' IN THE GAME LOOP '''
  Window.clear()
  Map.draw()
  Window.flip()
  </code></pre>
  
  <p>So how do I save and reload a rendered model/list to save loading and rendering time at startup in python,pygame and pyopengl?</p>
  
  <p>EDIT: I'm programming in python 2.7</p>