aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/icecream/IcecreamProgram.kt
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-10-25 14:52:36 +0530
committerAkshay Nair <phenax5@gmail.com>2026-10-25 14:52:36 +0530
commitd41559270e57752cc16f97f7e820f3781ed03a49 (patch)
treee92d55544f78966bd3283b39269a34fa61fb57d8 /src/main/kotlin/icecream/IcecreamProgram.kt
parent5e51938952b5275debce06e5cee4a5f71eacaeb1 (diff)
downloadart-playground-openrndr-d41559270e57752cc16f97f7e820f3781ed03a49.tar.gz
art-playground-openrndr-d41559270e57752cc16f97f7e820f3781ed03a49.zip
Ice cream sandwichmaster
Diffstat (limited to '')
-rw-r--r--src/main/kotlin/icecream/IcecreamProgram.kt48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/kotlin/icecream/IcecreamProgram.kt b/src/main/kotlin/icecream/IcecreamProgram.kt
new file mode 100644
index 0000000..69e8297
--- /dev/null
+++ b/src/main/kotlin/icecream/IcecreamProgram.kt
@@ -0,0 +1,48 @@
+package icecream
+
+import org.openrndr.application
+import org.openrndr.color.*
+import org.openrndr.draw.*
+import org.openrndr.math.IntVector2
+import phenax.utils.*
+
+fun main() = application {
+ recordDuration(20.seconds())
+
+ if (captureEnabled) {
+ configure {
+ width = 1920
+ height = 1440
+ windowResizable = false
+ }
+ } else {
+ configure {
+ width = 640
+ height = 480
+ windowResizable = false
+ }
+ }
+
+ oliveProgram {
+ val enableAntialiasing = captureEnabled
+ val shaderLocalSize = IntVector2(8, 8)
+ val cs by liveComputeShader("icecream")
+
+ val outputBuffer = colorBuffer(width, height, type = ColorType.UINT8)
+
+ // if (captureEnabled)
+ // repeat(1.0) { println("${Math.round((seconds / recordDuration()) * 10000)/100}%") }
+
+ extend {
+ cs.uniform("enable_antialiasing", enableAntialiasing)
+ cs.uniform("seconds", seconds)
+ cs.image("output_image", 0, outputBuffer.imageBinding(0, ImageAccess.WRITE))
+ cs.execute(
+ (outputBuffer.width + shaderLocalSize.x - 1) / shaderLocalSize.x,
+ (outputBuffer.height + shaderLocalSize.y - 1) / shaderLocalSize.y,
+ 1
+ )
+ drawer.image(outputBuffer, 0.0, 0.0, width.toDouble(), height.toDouble())
+ }
+ }
+}