0
votes

So I'm relatively new to OpenGL, and in this case I'm using libGDX to draw on my target platform (Android). What I want to be able to do is specify a source rectangle for my mesh texture so that I can pack a bunch of textures onto just one file and then choose the right texture with that source rectangle. The mesh should then be drawn with this smaller texture applied to it. Any help would be appreciated.

P.S. I am pretty experienced with DirectX and XNA, so any comparisons that can be drawn between this solution and those frameworks to help me understand are much appreciated.

1

1 Answers

1
votes

I think you are looking for "texture atlas" support (a single square texture composed from multiple separate textures). LibGDX includes run-time support for building sprites and texturing meshes from a texture atlas, and libGDX also includes a "texture packer" tool that generates these textures and the text file describing them. There are also nice 3rd party tools like "TexturePacker Pro" that will generate a libGDX-compatible texture atlas.

See this question+answer for more details: Texture from texturepacker in LibGDX