Hello Guest

Improving Performance of Rendering 2D Tiled Terrain

  • 15 Replies
  • 884 Views
Re: Improving Performance of Rendering 2D Tiled Terrain
« Reply #15 on: November 07, 2018, 15:30:32 »
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.

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