[opengl 2.1]How should I move my 2d sprite?

Hi, I’m currently learning opengl basics and wanted to know what’s the best approach to move a 2d sprite with opengl(2.1).
I think that the most convenient way to do it is just by doing something like this(in pseudocode):

glTranslate(some value)
draw sprite

However I can also just update the vertex data in the vbo with buffersubdata.
The first method takes more opengl function calls, but it doesnt send any data to the gpu, while the second approach may need to re-send data practically every frame(if the player moves) but takes less function calls.

What method is most efficient?

In general you want to have as few OpenGL calls as possible, and you want to do many things at once. If you have many sprites, and they are all moving, just update the VBO data for all of them at once and re-send it to the GPU. If you only have one moving sprite then you could also do with the translation, it doesnt really matter.

Keep those meshes that are not moving in one vao and those that are moving in other. Use different translation matrix for those meshes that needs to be moved.

It sends the matrix. And updating the vertex data will certainly be more efficient than using one draw call per sprite.

If the number of sprites is so large that you actually have to worry about the overhead of sending new vertex data each frame, use instanced rendering (or read the offset from a texture or UBO based upon gl_VertexID).

I can’t create a vao, I’m using opengl 2.1(am I missing an extension?).

VAOs require OpenGL 3.0 or ARB_vertex_array_object.

But they’re really not that significant; they just reduce the number of calls required to set up the arrays prior to issuing a draw call. Any performance advantages are minimal.