I am working on generating a procedural 3D terrain in libGDX. I've managed to create the mesh, but now I am having trouble finding an efficient way of texturing it.
The way I do it now is by creating a pixmap and iterating through all the heightmap values. Based on each height value, I extract one pixel from an appropriate texture (e.g. if the value is < 100 extract a pixel from the water texture, if it's > 100 && < 150 extract the pixel from the sand texture etc.) and after doing some blending I place it in the pixmap I've created. In the end, I'll just generate a new texture based on the pixmap I've created and assign it to the terrain. This works and gives out satisfying results, but iterating through every single pixel and creating a texture this way leads to very bad performance and long start up times for my game. My question is, what other options do I have?
Is there a more efficient way of creating textures than by iterating through pixmaps one pixel at a time? Is there a way to efficiently "copy a part of a pixmap and paste it onto another"?
Should I do it in some completely different manner? Maybe FBO's or Shaders? If so, please point me to some resources, I don't have much experience with those.
Thanks!