Having many PGraphics loaded lags

Is it possible to prevent high gui usage with like 128 pgraphics?

Just curious, are you using all 128 at one time?

1 Like

A simple question without a simple answer

It depends on many things including

  • the size of the graphics (e.g. 256x256 requires ~64k, 1024x1024 requires ~1Mb)
  • if they are preloaded in setup or loaded on demand, perhaps in draw
  • if they are not loaded, when are they created e.g. inside draw()
  • are the images modified during program execution, if so when are they updated and are the modifications CPU intensive (e.g. pixel level manipulation)

I think you need to provide some more info about the graphics and how they are used in your sketch.

1 Like

no only one but i have an array with 128

the images are only modified for one. you can draw on one layer and not more at the same time.

Any reason why you can’t load them as you need them, instead of loading all of them at one time?

Hi
Additional for what @quark wrote
Loading or creating big files depends on :
CPU speed
VGA card ram
System ram
Finely organization of how import/export /calling data

In void setup things happen once
In void draw things without condition happen over and over

Store them as PImages instead of PGraphics and have just one PGraphics as your active drawing surface. image() the active layer to it, then modify, and then copy it back to a PImage when done editing. PImage will take up less memory than PGraphics, but even then, 128 full screen images will require a lot of resources.

That might actually work! Thanks!

cause a someone said they draw ob 500 layers/…