OPENRNDR filling up computer memory and crashing | Making a variable-width line

I am trying to draw a variable width line by using an array of circles that I add circles with different radi to.
Every frame (inside the extend block) the sketch processes 50 new circles and adds them to a MutableList which is then drawn using drawer.circles().

Once the sketch has been running for a long enough time it completely fills up the computers memory and causes it to crash.

I understand that this is probably not the best way to do what I’m trying to do, but can’t think of any other way of drawing dynamic-width lines.

It would probably help if I didn’t have to store all of the circles in a list, but could draw them on the screen and not have them cleared when the next frame is rendered.

Lmk if you can help,
Cheers!

Terve Eino! :slight_smile:

And welcome to the forum :slight_smile: There are several ways to do that. Maybe the easiest is to use orx-no-clear which allows you to draw and keep the previous content visible. That way you only draw one circle.

Or create your own RenderTarget instead (that’s what orx-no-clear does for you behind the scenes).

If you want to draw an animated morphing variable thickness line you could take this different approach, but it’s a bit more convoluted:

I’ll create an easy to use function and post it as a reply later.

ps. Feel free to share an image of what you are trying to create (here in the forum or somewhere else like https://imgur.com/ if you can’t yet share images here): maybe a different approach comes to mind when I see it.

Cheers!

Thanks for the help. I think I’ll try orx-no-clear and then post an image.

Edit: apparently orx-no-clear is not in the current orx version so I’ll try doing it myself since it doesn’t seem that complicated.

The RenderTarget way worked, only that it seems lower resolution or interpolated somehow. I tried both with multisample AA and not.


This is what I’m making. It takes an image to use as a “flow field” and to use as the size of the circles to draw the image.

image

1 Like

That’s odd. I think it’s been there for a long time. Did you enable it in build.gradle.kts?

Is one of the images you posted the correct look and another one the “lower resolution” one?
Did you set a stroke color / weight when drawing circles?

Ah… I think it may look different when you draw ten circles all in one frame and when you draw the same ten circles in ten different frames. Something worth trying.

ps. I wrote a class to draw thick lines.

Nah, I don’t think I did. I didn’t know you had to do that, know I do. The other approach ended up suiting my needs better.

1 Like

All of the images are the blurrier seeming ones, I couldn’t get it working without this NoClear “hack”. It’s small enough to not really annoy me and I’m constantly working on stuff so I dunno how interested I am in trying to “fix” it.