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

1.1k Views Asked by At

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?

1

There are 1 best solutions below

2
On BEST ANSWER

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.