Example and fix for non-main render target with SyphonServer

This commit is contained in:
Rein van der Woerd
2020-02-25 13:17:56 +01:00
committed by edwin
parent 4a1a4103c3
commit 6654a1737c
5 changed files with 63 additions and 22 deletions

View File

@@ -0,0 +1,34 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.isolatedWithTarget
import org.openrndr.draw.renderTarget
import kotlin.math.*
fun main() = application {
configure {
width = 1000
height = 1000
}
program {
val rt = renderTarget(100, 100) {
colorBuffer()
}
extend(SyphonServer("Test", rt))
extend {
/**
* This is what will be sent to Syphon, and drawn in a small corner of the screen
*/
drawer.isolatedWithTarget(rt) {
drawer.background(ColorRGBa(sin(seconds), cos(seconds / 2.0), 0.5, 1.0))
}
drawer.background(ColorRGBa.GRAY)
drawer.circle(width/2.0, height/2.0, sin(seconds) * width / 2.0)
drawer.image(rt.colorBuffer(0))
}
}
}