0

So how can I store textures within lwjgl so that when I call a texture it does not have to go and open the file to get the texture, as this is time consuming and inefficient.

I am going to be creating an animation and need several images from a texture atlas, so how can I store the first sub pic to a specific term/variable to call later?

GilbertN
  • 37
  • 5
  • This question is completely unclear as written. Are these files the individual images that need to go into the atlas, or the complete atlas itself? Do you just want to load the image into memory (in Java), or into whatever LWJGL wrapped library (such as OpenGL) that you're using? What have you already tried, and why didn't it work? – AnOccasionalCashew Feb 18 '18 at 11:21
  • Yes I want to store it in memory, so that it can be called later on without having to use a method such as my example "loadTexture()", ########public static Texture loadTexture(String path, String type) { Texture tex = null; InputStream in = ResourceLoader.getResourceAsStream(path); try { tex = TextureLoader.getTexture(type, in); } catch (IOException e) { e.printStackTrace(); } return tex; }############. currently every time the game renders it goes through this method, how can I make it more efficient so it can render faster? – GilbertN Feb 18 '18 at 17:38
  • You didn't actually answer any of the questions I asked. You "want to store it in memory". Ok, **what** memory? Are we talking GPU via a library, or RAM? What format is it supposed to be in memory? What format are the files in? And again, are these the individual object textures, or the entire ready-to-go texture atlases? – AnOccasionalCashew Feb 18 '18 at 23:06
  • For that matter, how are you actually rendering things? That is, what LWJGL wrapped library are you using? You know LWJGL doesn't do anything itself, right? It's a wrapper to allow you to use libraries written in *other languages* from within Java. You need to **edit your question to include all of this info directly**. – AnOccasionalCashew Feb 18 '18 at 23:08

0 Answers0