Update orx-olive/README.md

This commit is contained in:
Edwin Jakobs
2020-01-24 11:03:10 +01:00
parent 7b965531bc
commit 7bccfbd609

View File

@@ -60,7 +60,35 @@ import org.openrndr.draw.*
}
}
```
The Reloadable store can be cleared using the `clearReloadables` function
The Reloadable store can be cleared using the `clearReloadables` function.
### Reloadable GPU resources
To store GPU resources or objects that use GPU resources (a.o. `ColorBuffer`, `VertexBuffer`, `Shader`, `BufferTexture`) in a `Reloadable` object one uses OPENRNDR's
`persistent {}` builder function.
```!kotlin
@file:Suppress("UNUSED_LAMBDA_EXPRESSION")
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
{ program: PersistentProgram ->
program.apply {
val a = object : Reloadable() {
var image = persistent { loadImage("data/images/pm5544.png" ) }
}
a.reload()
extend {
drawer.image(a.image)
}
}
}
```
Keep in mind that `Reloadable` should only be used for singleton classes.