Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Java LWJGL Need Help Designing more efficient texture loading.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 coppyhop   Members   -  Reputation: 128

Like
0Likes
Like

Posted 06 July 2014 - 01:50 PM

I really need help with this, I'm building a 2d sandbox game and when you select a world size, it begins to load the textures and stuff needed to play, but depending on the world size, this can be long or short. For instance, if you choose Huge it takes 5+ min, the reason, I have a grid setup as an array, the bigger the world, the bigger the array, when every GridSpace initializes, it loads 2 textures, it's alpha and rgb, in reality, it's only 8 images, but these 8 images are being loaded hundreds to thousands of times, how can I setup it so It loads only once? (I'm using Slick-Utils and when it's a static Texture the Texture Load doesn't work, on can only be on non-static textures, and Getters and setters don't help)



Sponsor:

#2 coppyhop   Members   -  Reputation: 128

Like
1Likes
Like

Posted 06 July 2014 - 07:35 PM

No Replies? I really need help with this, I will sometimes get a Too Many Files Exception, which is BAD because it just freezes and does nothing, and if you forget to save, worst nightmare!



#3 Aldacron   GDNet+   -  Reputation: 3278

Like
4Likes
Like

Posted 06 July 2014 - 07:44 PM

Have your texture loader cache your textures in a HashMap keyed on the file name. When you ask it to load a texture, it first checks the cache to see if the texture exists. If it does, it returns the existing instance rather than loading it from disk again.



#4 coppyhop   Members   -  Reputation: 128

Like
0Likes
Like

Posted 07 July 2014 - 04:03 PM

How can I do that?  I 'm new to LWJGL.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS