anton-johansson / 2d-game

Apache License 2.0
0 stars 0 forks source link

Introduce buffer data hints #16

Closed anton-johansson closed 7 years ago

anton-johansson commented 7 years ago

Currently, we're always using GL_STATIC_DRAW. However, we're uploading vertex data for the map tiles every frame, and there's a better hint for that (maybe GL_DYNAMIC_DRAW?).

Try to check if we get any FPS increase, or if OpenGL already optimizes it anyway.

Use an enumeration for the hints.

anton-johansson commented 7 years ago

This page has really good explanations. I decided to go for two enumerations, to separate read/write-hint from frequency-hint.

I went with GL_STATIC_DRAW for the indices and GL_STREAM_DRAW for the vertices. I had ~3800 FPS before the hints and ~3900 FPS after. Could be coincidence, but either way, it's nice to give the correct hints.