@Durzann said:
Hi, thanks for the answer, i'm glad to discover the godot community :)
Indeed, i see many answer pointed out the viewport drawing system
But what do you want to say by "setting the pixel within the visible area of the ViewPort" ?
I tried to drawCircle/Line per cell of my data, but it's actually monstrously heavier than the SetPixel method : Did I just miss something with your idea ?
I was thinking of draw_rect
with rectangles of 1x1 size, but yeah, using the draw_
functions in CanvasItem was what I was thinking. I did not know the draw_
functions are heavier than using set_pixel
, but thinking about it, at the individual pixel level (or even slightly above) it makes sense that it wouldn't perform as well since it would require an OpenGL draw call for each function used.
Maybe to improve performance, you could draw regions that have the same pixel color together with larger rectangles in the draw_rect
function? Or drawing lines of same colored pixels with draw_line
? I'm not sure how feasible it would be, nor if the extra processing to find areas of the same color would negate any performance benefits, but that might be something to look into.
Another thing I was thinking of while writing this is you might be a C# or C++ library (through GDNative) to manipulate an image saved on the user's computer, and then have Godot load the image when you make modifications. It likely wouldn't be any faster, but it is possible that by bypassing Godot and using an external library, you can modify the pixels faster.
Outside of that, I do not know right off. I'll keep an eye out for other solutions though and will post if I come across anything.