NOTE: PGraphics.beginDraw(), PGraphics.endDraw() alternatives
how would i go about drawing to a shared PGraphics instance in the context each window that obtains the PGraphics instance could just invoke .background(0);
and erase the entire pgraphics drawing image
as the only option i see right know is to completely wrap the PGraphics to provide a containable drawing region such that, for example, fill(0) will only fill from x1, y2, to x2, y2 instead of from 0, 0, width, height
or even interfere with, and possibly maliciously overlay other windows should they be in possession of there known coordinates and width/size
basically how would i design this such that there is seperation between all intances and their windows, eg window X can only write to 50 by 100 of the 500 by 500 canvas, and window K can only write to 10 by 30 of the 500 by 500 window canvas, and as such, invoking background(0)
would ONLY fill the 10 by 30 region that is assigned, and 0,0 would correspond to 10,10 and 20,20 to 30,30
specifically
how would i go about implementing double buffering in the context of a window manager?
as tipically, based on osdev.org, it is implemented as a pointer that is (assumably) changed for each window being drawn as so that, for example, that window’s 0,0 points to the correct location in memory
but in java, pointers do not exist, and as such, i assume that to correctly implement this, a new buffer MUST be created for every window and then copied to the main buffer on each window draw
in which, the creation and destruction of a drawing context (eg via OpenGL) is expensive and as such
if i have for example 30 windows open my performance will drop to about 5FPS
when with no windows it is 60FPS
due to the overhead of the 60 drawing context creations and destructions, multiplied by 60 frames per second