What is the "best" way to handle sprite sheets with shaders and buffers? In immediate mode it is easy to modify a sprite's texcoords when it is drawn, but I don't know how to do this with modern opengl. Should I store all the texcoords in a buffer and change the pointer for every sprite, or is there a better way?
You can always make looong buffer "vertex;texcoord" repeat. And just use indices how you said. It is propably most easy and kinda similar to what you know.
If you want to save some memory. There is pretty neat solution and it is to have one sprite in buffer with unite texcoords and create UVs transformation matrix and send it to your shader and multiply texcoords with it (in vertex shader).
You dont have to create matrices by yourself if you are not fine with that. You can just use regular GL functions and than read matrix with
I created image to describe it better. glTranslate ang glScale can be looked as that they are just moving with the UV space basis.
If you don't know how to send matrix to shader i can share some code with you.
Edit: Added picture