2
votes

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
Yes, it is possible.Hihikomori
So I've been thinking that one thing I can do is to merge in some way the data that I pass to glTexImage2D instead of actually creating the textures to then merge them into an atlas. Do you know how I can do that?ellipticaldoor
You can pass several textures to fragment shader, and make merging there.Hihikomori
@МатвейВислоух Ah, yes, of course. The contributor is taking about a texture atlas. Very likely we are taking about square textures.Rabbid76
yes they are square, thank you @Rabbid76 glTexSubImage2D its what I was looking forellipticaldoor

1 Answers

2
votes

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.