Search code examples
javaopengldynamictextureslwjgl

JOGL Loading textures individually and using multiple at once


Alright, I couldn't find a good name for this, so I will explain in a bit further detail.

I am making a game using LWJGL and I have gotten some basic rendering done, but now I want to do something a bit more advanced.

Here is the situation:

I have a mesh (positions, normals, texture coords, indices) I generate which can currently support 1 texture, this would be great if I had a single image containing all of the textures, but sadly that isn't the case. I have a individual image for each texture which needs to be loaded individually.

Now, I see a way how I could do this, but it doesn't seem practical or like a good usage of memory. -Load all the textures into one image and save where each one is in that image for usage with the texture coords.

The textures should NOT blend together, hard coding anything is not an option as I wish to allow modding to be easy to implement, and anywhere from 1 (best case scenario) to 65,536+ textures (worst case scenario) are able to be used in the same "mesh".


Solution

  • I am simply going to use a Texture Atlas as doing anything else seems impractical. Thanks @httpdigest for the suggestion.