I want to translate code from Processing to OPENRNDR but pushMatrix and popMatrix code block is how can I translate OPENNRDR. You did a great job to write code kotlin so anything other approach you to find and not implemented, I assumed.
Hello @art-coder ! Welcome to the forum
pushMatrix
and popMatrix
always need to be used in pairs and it’s easy to accidentally call one more times than the other. OPENRNDR provides a different approach which makes it impossible to make that mistake:
drawer.isolated {
drawer.rotate(...)
drawer.translate(...)
drawer.rectangle(...)
}
Basically, you can replace a push/pop matrix pair by drawer.isolated { ... }
, and it behaves like push and pop in p5js.
If you prefer to use the same approach like in Processing you can call pushTransforms()
and popTransforms()
. Or for more fine-grained methods, see pushStyle()
, popStyle()
, pushModel()
, popModel()
, pushView()
, popView()
, pushProjection()
, popProjection()
. The source code for these methods is found in Drawer.kt.
Thank you for your guide. I also have question about processing’s arc function I find in document to write about make arc through logical operation but it is always do write circle and logical operation? I can find arcTo oh, i forgot exact name of this method, but how to use them is not wrote in documentation. Most easy approach I can write processing’s arc method like draw is. I would like to know.
I’m afraid I don’t fully understand your question.
Does this example help you?
PS. Maybe www.deepl.com can help translating to and from English