简体   繁体   中英

How I can create a texture atlas in OpenGL with other existing textures?

I will like to generate a texture atlas from some textures that are already loaded in memory.

The textures I will like to include in the atlas are generated procedurally on runtime so I can't just create a png tilemap that already contains them.

Is this possible to do with OpenGL?

Create a texture big enough with glTexImage2D and use glTexSubImage2D to put the 100 tiny square textures into it. glTexSubImage2D allows the specification of the x and y offsets in the target texture and the size (width and height) of a tile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM