implemented most of texture batcher