Dynamic skydome with textures

Hi I want to use the dynamic skydome shown here http://www.jmonkeyengine.com/wiki/doku.php?id=skydome&s=skydome but with daytime and night time textures so I did :


   TextureState tc = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
   if (dome.isNight()) {
      sky = Main.class.getClassLoader().getResource("texture/night.jpg");}
      else {
          sky = Main.class.getClassLoader().getResource("texture/day-fair.jpg");
      }
   Texture skydn = TextureManager.loadTexture(sky, Texture.MM_LINEAR_LINEAR, Texture.FM_LINEAR);
   tc.setTexture(skydn);
   dome.setRenderState(tc);


But this gives me java.lang.OutOfMemoryError: Java heap space, can anyone give me some clues?

neakor is developing a skydome with textures, you might wanna wait until his skydome is finished.

You're loading a texture on each call of the update method, which causes memory leaks. Load the two textures separately in an init method and switch them only if necessary (only on switches between day and night, rather on each update call).

thanks for the help, I've got it partially working now

Check this implementation:



http://www.jmonkeyengine.com/jmeforum/index.php?topic=5640.msg45363#msg45363