What would be the best way of implementing multiple textures in OpenGL? I’ve done some research online, and some methods to do this would be create a texture atlas with a lot of the required textures. Another method would be to use an array texture. However, they both don’t seem to be the best way of doing it, as the first method would require a very, very large picture and the 2nd method would require another attribute (I suppose?) to point to which texture to use. What do big games such as COD or Battlefield use to load a huge amount of textures to the GPU?
What would be the best way of implementing multiple textures in OpenGL? I’ve done
Share
The reason to use array textures and/or texture atlases is primarily performance. And this performance is achieved in one way: by decreasing the number of draw calls you need.
Therefore, if you will frequently need to change state between objects anyway (matrices in shaders, etc), there’s not much point. Sure, not having to change textures is a good thing, but not as big of a performance saver as having fewer draw calls.
Texture atlases are often used for font glyph images, 2D game assets, GUI assets, and the like for this reason: you’re just drawing a bunch of quads. You don’t want to change textures between every quad, so you draw all of the text, 2D sprites, GUI elements, etc in a single (or very few) draw calls. Certainly not one draw call per quad.
Array textures are more for things like drawing many copies of the same mesh, but with different textures. And so forth.