How to properly draw a 2D map without overloading the GPU?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By RuiCurado

Hi there! First post.

I’m trying to show a 2D map inside a PopupPanel, that you call by pressing “M”, you know, the usual stuff.

I can draw the map using the draw_* primitives, so drawing the map is not the problem.

But because the map can have around 90000 rectangles, it takes around half a second to draw. That could even be acceptable, but…

I know that _draw() is called once and then the draw instructions get memorized. But why is Godot trying to redraw 60 frames of a static drawing? Because of this, the GPU gets overloaded at 99,9%, unnecessarily IMO.

This behavior makes no sense because if draw_* primitives inside _draw() get memorized, they must be constant. And if they are constant, why keep redrawing them?

So, my question is: Is there a way for me to tell Godot to stop redrawing the map for every frame, or make it draw just once, and then update the display only when update() is called?