[orx-syphon] Move demos from test to demo, add OpenGL requirements
This commit is contained in:
@@ -35,7 +35,7 @@ val main: SourceSet by sourceSets.getting
|
|||||||
|
|
||||||
@Suppress("UNUSED_VARIABLE")
|
@Suppress("UNUSED_VARIABLE")
|
||||||
val demo: SourceSet by sourceSets.creating {
|
val demo: SourceSet by sourceSets.creating {
|
||||||
val skipDemos = setOf("openrndr-demos", "orx-minim", "orx-realsense2", "orx-runway", "orx-video-profiles", "orx-midi")
|
val skipDemos = setOf("openrndr-demos", "orx-minim", "orx-realsense2", "orx-runway", "orx-video-profiles", "orx-midi", "orx-syphon")
|
||||||
if (project.name !in skipDemos) {
|
if (project.name !in skipDemos) {
|
||||||
collectScreenshots(project, this@creating) { }
|
collectScreenshots(project, this@creating) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,9 @@ import org.openrndr.color.ColorRGBa
|
|||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
|
|
||||||
fun main() = application {
|
fun main() {
|
||||||
|
System.setProperty("org.openrndr.gl3.gl_type", "gl")
|
||||||
|
application {
|
||||||
configure {
|
configure {
|
||||||
width = 1000
|
width = 1000
|
||||||
height = 1000
|
height = 1000
|
||||||
@@ -27,6 +29,7 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Sharing a different render target
|
#### Sharing a different render target
|
||||||
@@ -38,7 +41,9 @@ import org.openrndr.draw.renderTarget
|
|||||||
import kotlin.math.*
|
import kotlin.math.*
|
||||||
|
|
||||||
|
|
||||||
fun main() = application {
|
fun main() {
|
||||||
|
System.setProperty("org.openrndr.gl3.gl_type", "gl")
|
||||||
|
application {
|
||||||
configure {
|
configure {
|
||||||
width = 1000
|
width = 1000
|
||||||
height = 1000
|
height = 1000
|
||||||
@@ -66,6 +71,7 @@ fun main() = application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Syphon Client
|
### Syphon Client
|
||||||
|
|||||||
23
orx-jvm/orx-syphon/src/demo/kotlin/DemoClient01.kt
Normal file
23
orx-jvm/orx-syphon/src/demo/kotlin/DemoClient01.kt
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import jsyphon.SyphonClient
|
||||||
|
import org.openrndr.application
|
||||||
|
import org.openrndr.color.ColorRGBa
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
System.setProperty("org.openrndr.gl3.gl_type", "gl")
|
||||||
|
application {
|
||||||
|
configure {
|
||||||
|
width = 1000
|
||||||
|
height = 800
|
||||||
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
val syphonClient = SyphonClient()
|
||||||
|
|
||||||
|
extend(syphonClient)
|
||||||
|
extend {
|
||||||
|
drawer.clear(ColorRGBa.BLACK)
|
||||||
|
drawer.image(syphonClient.buffer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
27
orx-jvm/orx-syphon/src/demo/kotlin/DemoServer01.kt
Normal file
27
orx-jvm/orx-syphon/src/demo/kotlin/DemoServer01.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import jsyphon.SyphonServer
|
||||||
|
import org.openrndr.application
|
||||||
|
import org.openrndr.color.ColorRGBa
|
||||||
|
|
||||||
|
import kotlin.math.*
|
||||||
|
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
// force to use GL driver
|
||||||
|
System.setProperty("org.openrndr.gl3.gl_type", "gl")
|
||||||
|
application {
|
||||||
|
configure {
|
||||||
|
width = 1000
|
||||||
|
height = 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
program {
|
||||||
|
extend(SyphonServer("Test"))
|
||||||
|
|
||||||
|
extend {
|
||||||
|
drawer.clear(ColorRGBa.PINK)
|
||||||
|
drawer.fill = ColorRGBa.WHITE
|
||||||
|
drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,13 @@ package jsyphon
|
|||||||
import org.openrndr.Extension
|
import org.openrndr.Extension
|
||||||
import org.openrndr.Program
|
import org.openrndr.Program
|
||||||
import org.openrndr.draw.*
|
import org.openrndr.draw.*
|
||||||
|
import org.openrndr.internal.Driver
|
||||||
|
|
||||||
|
|
||||||
import org.openrndr.internal.gl3.ColorBufferGL3
|
import org.openrndr.internal.gl3.ColorBufferGL3
|
||||||
|
import org.openrndr.internal.gl3.DriverTypeGL
|
||||||
import org.openrndr.internal.gl3.TextureStorageModeGL
|
import org.openrndr.internal.gl3.TextureStorageModeGL
|
||||||
|
import org.openrndr.internal.gl3.glType
|
||||||
|
|
||||||
|
|
||||||
class SyphonClient(private val appName: String? = null, private val serverName: String? = null): Extension {
|
class SyphonClient(private val appName: String? = null, private val serverName: String? = null): Extension {
|
||||||
@@ -18,6 +21,10 @@ class SyphonClient(private val appName: String? = null, private val serverName:
|
|||||||
var buffer: ColorBuffer = colorBuffer(10, 10)
|
var buffer: ColorBuffer = colorBuffer(10, 10)
|
||||||
|
|
||||||
override fun setup(program: Program) {
|
override fun setup(program: Program) {
|
||||||
|
require(Driver.glType == DriverTypeGL.GL) {
|
||||||
|
"The SyphonClient extension will only work when using OpenGL. Use -Dorg.openrndr.gl3.gl_type=gl to force OPENRNDR to use OpenGL."
|
||||||
|
}
|
||||||
|
|
||||||
buffer = colorBuffer(program.width, program.height)
|
buffer = colorBuffer(program.width, program.height)
|
||||||
|
|
||||||
client.init()
|
client.init()
|
||||||
|
|||||||
@@ -7,8 +7,11 @@ import org.openrndr.Program
|
|||||||
import org.openrndr.draw.Drawer
|
import org.openrndr.draw.Drawer
|
||||||
import org.openrndr.draw.RenderTarget
|
import org.openrndr.draw.RenderTarget
|
||||||
import org.openrndr.draw.renderTarget
|
import org.openrndr.draw.renderTarget
|
||||||
|
import org.openrndr.internal.Driver
|
||||||
|
|
||||||
import org.openrndr.internal.gl3.ColorBufferGL3
|
import org.openrndr.internal.gl3.ColorBufferGL3
|
||||||
|
import org.openrndr.internal.gl3.DriverTypeGL
|
||||||
|
import org.openrndr.internal.gl3.glType
|
||||||
|
|
||||||
|
|
||||||
class SyphonServer(private val name: String = "OPENRNDR", var providedTarget: RenderTarget? = null): Extension {
|
class SyphonServer(private val name: String = "OPENRNDR", var providedTarget: RenderTarget? = null): Extension {
|
||||||
@@ -17,6 +20,10 @@ class SyphonServer(private val name: String = "OPENRNDR", var providedTarget: Re
|
|||||||
private var targetToSend: RenderTarget? = null
|
private var targetToSend: RenderTarget? = null
|
||||||
|
|
||||||
override fun setup(program: Program) {
|
override fun setup(program: Program) {
|
||||||
|
require(Driver.glType == DriverTypeGL.GL) {
|
||||||
|
"The SyphonServer extension will only work when using OpenGL. Use -Dorg.openrndr.gl3.gl_type=gl to force OPENRNDR to use OpenGL."
|
||||||
|
}
|
||||||
|
|
||||||
server.initWithName(name)
|
server.initWithName(name)
|
||||||
|
|
||||||
// Create a new target that binds to the main one if no target is provided
|
// Create a new target that binds to the main one if no target is provided
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
import jsyphon.SyphonClient
|
|
||||||
import org.openrndr.application
|
|
||||||
import org.openrndr.color.ColorRGBa
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun main() = application {
|
|
||||||
configure {
|
|
||||||
width = 1000
|
|
||||||
height = 800
|
|
||||||
}
|
|
||||||
|
|
||||||
program {
|
|
||||||
val syphonClient = SyphonClient()
|
|
||||||
|
|
||||||
extend(syphonClient)
|
|
||||||
extend {
|
|
||||||
drawer.clear(ColorRGBa.BLACK)
|
|
||||||
drawer.image(syphonClient.buffer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import jsyphon.SyphonServer
|
|
||||||
import org.openrndr.application
|
|
||||||
import org.openrndr.color.ColorRGBa
|
|
||||||
|
|
||||||
import kotlin.math.*
|
|
||||||
|
|
||||||
|
|
||||||
fun main() = application {
|
|
||||||
configure {
|
|
||||||
width = 1000
|
|
||||||
height = 1000
|
|
||||||
}
|
|
||||||
|
|
||||||
program {
|
|
||||||
extend(SyphonServer("Test"))
|
|
||||||
|
|
||||||
extend {
|
|
||||||
drawer.clear(ColorRGBa.PINK)
|
|
||||||
drawer.fill = ColorRGBa.WHITE
|
|
||||||
drawer.circle(drawer.bounds.center, abs(cos(seconds)) * height * 0.5)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user