Up until now I've always used glDrawElements, and have my vertex and index buffers bound. From what I've read, glDrawElements is generally the way to go, and it works fine. However, I'm starting a new project and am questioning whether this is still the best fit.

For the current project, I'm recomposing a 2D scene from scratch every frame. The player's character runs around, and I only draw the part of the world that is visible, generating 2D quads from the map tiles and building the vertex/index buffers.

Given that (from my understanding) glDrawElements works best when you upload your VBOs and make multiple draw calls against them, wouldn't it be better to use something else in this case, such as glDrawArrays? I've generally read that glDrawArrays is slower, but given that I'm having to push the vertex data every frame anyway, that might not be true here.

I don't want to switch draw calls and assume I made the right choice when I could in fact be using it improperly to begin with, invalidating any performance improvements I see.

| improve this question | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.