diff --git a/README.md b/README.md index 6b1e56ee..3b43ae73 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ A growing library of assorted data structures, algorithms and utilities. - [`orx-olive`](orx-olive/README.md), extensions that turns OPENRNDR in to a live coding environment - [`orx-osc`](orx-osc/README.md), open sound control interface - [`orx-palette`](orx-palette/README.md), manage color palettes +- [`orx-syphon`](orx-syphon/README.md), send frames to- and from OPENRNDR and other applications in real time using Syphon - [`orx-temporal-blur`](orx-temporal-blur/README.md), temporal (motion) blur for video production. # Developer notes diff --git a/orx-syphon/preview.gif b/orx-syphon/preview.gif index bb326d2c..41be1dbf 100644 Binary files a/orx-syphon/preview.gif and b/orx-syphon/preview.gif differ diff --git a/orx-syphon/src/main/kotlin/SyphonClient.kt b/orx-syphon/src/main/kotlin/SyphonClient.kt index 06d0776a..4be4c9d9 100644 --- a/orx-syphon/src/main/kotlin/SyphonClient.kt +++ b/orx-syphon/src/main/kotlin/SyphonClient.kt @@ -10,7 +10,7 @@ import org.openrndr.draw.* import org.openrndr.internal.gl3.ColorBufferGL3 -class SyphonClient: Extension { +class SyphonClient(private val appName: String? = null, private val serverName: String? = null): Extension { override var enabled = true private val client = JSyphonClient() @@ -18,7 +18,12 @@ class SyphonClient: Extension { override fun setup(program: Program) { buffer = colorBuffer(program.width, program.height) + client.init() + + // Choosing a different server + if (appName != null) client.setApplicationName(appName) + if (serverName != null) client.setServerName(serverName) } override fun beforeDraw(drawer: Drawer, program: Program) { @@ -43,6 +48,10 @@ class SyphonClient: Extension { rectBuffer.copyTo(buffer) } } + + override fun shutdown(program: Program) { + client.stop() + } } diff --git a/orx-syphon/src/test/kotlin/ClientExampleSpecificServer.kt b/orx-syphon/src/test/kotlin/ClientExampleSpecificServer.kt new file mode 100644 index 00000000..913507f0 --- /dev/null +++ b/orx-syphon/src/test/kotlin/ClientExampleSpecificServer.kt @@ -0,0 +1,25 @@ +import org.openrndr.application +import org.openrndr.color.ColorRGBa +import org.openrndr.extra.syphon.SyphonClient + +/** + * This example uses After Effects and OPENRNDR connected via Syphon + */ +fun main() = application { + configure { + // The maximum resolution supported by the free + // version of AESyphon + width = 1024 + height = 768 + } + + program { + val syphonClient = SyphonClient("Adobe After Effects", "Live Preview") + + extend(syphonClient) + extend { + drawer.background(ColorRGBa.BLACK) + drawer.image(syphonClient.buffer) + } + } +} \ No newline at end of file diff --git a/orx-syphon/src/test/kotlin/ServerExample.kt b/orx-syphon/src/test/kotlin/ServerExample.kt index bea9ece4..b3af2f4a 100644 --- a/orx-syphon/src/test/kotlin/ServerExample.kt +++ b/orx-syphon/src/test/kotlin/ServerExample.kt @@ -1,7 +1,7 @@ import org.openrndr.application import org.openrndr.color.ColorRGBa import org.openrndr.extra.syphon.SyphonServer -import kotlin.math.sin +import kotlin.math.* fun main() = application { @@ -14,8 +14,9 @@ fun main() = application { extend(SyphonServer("Test")) extend { - drawer.background(ColorRGBa.RED) - drawer.circle(width/2.0, height/2.0, sin(seconds) * width / 2.0) + drawer.background(ColorRGBa.PINK) + drawer.fill = ColorRGBa.WHITE + drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5) } } } \ No newline at end of file diff --git a/orx-syphon/src/test/kotlin/ServerExampleAlternateRenderTarget.kt b/orx-syphon/src/test/kotlin/ServerExampleAlternateRenderTarget.kt index 27299fcf..3a38ab70 100644 --- a/orx-syphon/src/test/kotlin/ServerExampleAlternateRenderTarget.kt +++ b/orx-syphon/src/test/kotlin/ServerExampleAlternateRenderTarget.kt @@ -28,8 +28,9 @@ fun main() = application { 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.background(ColorRGBa.PINK) + drawer.fill = ColorRGBa.WHITE + drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5) drawer.image(rt.colorBuffer(0)) } }