In my program I have objects with different textures, that are in the same vbo. I cant have an array of samplers in my shaderprogram, so i have to use a texture atlas. I have seen some ways to make a texture atlas out of PNGs, but that would mean that I'll have to load those textures twice. Is there a way to put two textures together in one atlas? For example i have:
id = 1;
width = 32;
height = 32;
and
id = 2;
width = 32
height = 32
I want something like this
int atlas = createTexture(t1.width + t2.width, t1.height + t2.height);
glBindTexture(GL_TEXTURE_2D, atlas)
//add(offset x, y, id)
glAdd(0,0,t1.id);
glAdd(t1.width, t1.height, t2.id);
I am not ooking for a texture packing algorithm! I need a way to create an atlas out of textures loaded to the GPU (OpenGL)