This thread is for OPENRNDR users who update openrndr and orx to version 0.4.5 or later. At this point it’s not yet officially released, but the changes may affect users building SNAPSHOT versions.
In most cases upstream changes to those repositories only bring new features or optimizations and require no changes in our code. But sometimes the changes do require us to update our programs.
I plan to document such changes in this thread to make it easier to live on the edge
With this change code shared by the 2D and 3D segments is de-duplicated making it easier to maintain (and I suspect adding missing functionality to Segment3D).
Since orx-shapes has grown quite a lot, its various shape constructors were organized into logical packages. The functionality is still the same but the import statements in existing projects must be updated if switching to orx 0.4.5.
The .uniform() methods were recently updated to make use of better hash functions. We can now query random uniform points from Rectangle, Triangle, Circle and Box. In these changes Rectangle.uniform was moved into a shapes package, which requires to update the import as listed below (otherwise the IDE will complain about the wrong number of arguments).
The OPENRNDR Random class gets often confused with the Kotlin Random class. Less experienced users may import the wrong one using the IDE’s automatic import feature, and the code would fail to run.
Therefore it has been recently deprecated. Here alternatives to commonly used methods:
Before
After
Import
Random.double()
Double.uniform(-1.0, 1.0)
import org.openrndr.extra.noise.uniform
Random.double(0.0)
Double.uniform(0.0, 1.0)
import org.openrndr.extra.noise.uniform
Random.double0()
Double.uniform(0.0, 1.0)
import org.openrndr.extra.noise.uniform
Random.bool(0.01)
Boolean.random(0.01)
import org.openrndr.extra.noise.primitives.random
Random.simplex(0.1)
simplex(1234, 0.1, 0.0)
import org.openrndr.extra.noise.simplex
Random.simplex(vec2 * 0.1)
simplex(1234, vec2 * 0.1)
import org.openrndr.extra.noise.simplex
Random.int(12, 34)
Int.uniform(12, 34)
import org.openrndr.extra.noise.primitives.random
Random.int0(123)
Int.uniform(0, 123)
import org.openrndr.extra.noise.primitives.random
Random.seed
If your program uses Random.seed because you want reproducible randomness, there are some required changes. Random.seed expected a String, but we will now use Kotlin’s Random, which expects an Int for a seed in its constructor. You will need to figure out an approach for switching to integer seeds. Once you do,
Before: Random.seed = "friendly parrot"
Now: val rnd = Random(seed = 2) // remember to import kotlin.random.Random
Then pass the rnd variable to any of the methods in the table above, or to methods like Rectangle.scatter():
first off, thanks for this AWESOME work I’ve just updated a bigger project from 0.4.4 to 0.4.5-alpha9. Besides the things in this thread, it seemed to me that somehow my system (OSX, M1) switched to OpenGL ES instead of plain OpenGL - which broke all my custom shaders .
After some debugging, it turned out to be this line where it switched to OpenGL ES for M1 OSX Mac.
=> so for me setting -Dorg.openrndr.gl3.gl_type=gl was crucial.
All the best, and keep up the great work,
Sebastian
Thank you @skurfuerst for your kind words and for sharing your discovery. Welcome to the forum! I’ll share it with the team in case we can give more info about this change.