Improving Performance of Rendering 2D Tiled Terrain

Started by Setlock, November 04, 2018, 16:48:19

Previous topic - Next topic

Setlock

Quote from: mudlee on November 07, 2018, 09:43:01
frequently = all thousands of objects 60times per second? :) Note that, when KAIHH writes that calling glDraw* is expensive, it also means calling gl* is expensive. When you update data in the gpu's memory, it's expensive.

Quote from: Setlock on November 06, 2018, 20:11:01
Quote from: mudlee on November 06, 2018, 16:56:28
Why do you update the transform in every frame? Also, why do you even create a new one in every frame? Once data in the GPU's memory, it should only be updated when it was really changed. Here is my rendering logic. Note that, updateBatchDataInGPU gets called ONLY if anything was changed.

https://gist.github.com/mudlee/94f2bd3bed5e1f1234a8dccf1a962c38

Well I update the transform for each object every frame since objects are frequently moving on screen.

Well actually I only call a gl function once per texture and there is only really two textures(which will be lowered by using a texture atlas in the future) for each object I edit a float array then change the data in the vao after editing that float array for all objects. So I only call a gl* function once per texture