Worley noise, Syphon and noise filter parameters...
This commit is contained in:
committed by
edwin
parent
1eaf8607db
commit
bb7439db54
1
orx-syphon/README.md
Normal file
1
orx-syphon/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# orx-syphon
|
||||
6
orx-syphon/build.gradle
Normal file
6
orx-syphon/build.gradle
Normal file
@@ -0,0 +1,6 @@
|
||||
dependencies {
|
||||
compile "org.openrndr:openrndr-core:$openrndrVersion"
|
||||
compile "org.openrndr:openrndr-gl3:$openrndrVersion"
|
||||
compile "org.lwjgl:lwjgl-opengl:3.2.3"
|
||||
compile "org.openrndr:openrndr-gl3-natives-macos:$openrndrVersion"
|
||||
}
|
||||
0
orx-syphon/src/main/kotlin/SyphonClient.kt
Normal file
0
orx-syphon/src/main/kotlin/SyphonClient.kt
Normal file
54
orx-syphon/src/main/kotlin/SyphonServer.kt
Normal file
54
orx-syphon/src/main/kotlin/SyphonServer.kt
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
import jsyphon.JSyphonServer
|
||||
import org.openrndr.Extension
|
||||
import org.openrndr.Program
|
||||
import org.openrndr.draw.Drawer
|
||||
import org.openrndr.draw.RenderTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.internal.gl3.ColorBufferGL3
|
||||
|
||||
|
||||
class SyphonServer(private val name: String = "OPENRNDR", var target: RenderTarget? = null): Extension {
|
||||
override var enabled = true
|
||||
private val server = JSyphonServer()
|
||||
|
||||
override fun setup(program: Program) {
|
||||
server.initWithName(name)
|
||||
|
||||
if (target == null) {
|
||||
target = renderTarget(program.width, program.height) {
|
||||
colorBuffer()
|
||||
depthBuffer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun beforeDraw(drawer: Drawer, program: Program) {
|
||||
target?.bind()
|
||||
}
|
||||
|
||||
override fun afterDraw(drawer: Drawer, program: Program) {
|
||||
target?.unbind()
|
||||
drawer.image(target?.colorBuffer(0)!!)
|
||||
val glBuffer = target?.colorBuffer(0) as ColorBufferGL3
|
||||
|
||||
println(glBuffer.multisample)
|
||||
|
||||
// Send to Syphon
|
||||
server.publishFrameTexture(
|
||||
glBuffer.texture, glBuffer.target, 0, 0,
|
||||
program.width, program.height, program.width, program.height, false
|
||||
)
|
||||
}
|
||||
|
||||
override fun shutdown(program: Program) {
|
||||
// Cleanup
|
||||
server.stop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
orx-syphon/src/main/kotlin/jsyphon/Syphon
Executable file
BIN
orx-syphon/src/main/kotlin/jsyphon/Syphon
Executable file
Binary file not shown.
11
orx-syphon/src/main/kotlin/jsyphon/Util.kt
Normal file
11
orx-syphon/src/main/kotlin/jsyphon/Util.kt
Normal file
@@ -0,0 +1,11 @@
|
||||
package jsyphon
|
||||
|
||||
class NSSize (var x: Int, var y: Int)
|
||||
class NSPoint(var x: Int, var y: Int)
|
||||
|
||||
class NSRect(var origin: NSPoint, var size: NSSize) {
|
||||
constructor(startX: Int, xLength: Int, startY: Int, yLength: Int) : this(
|
||||
NSPoint(startX, startY),
|
||||
NSSize(xLength, yLength)
|
||||
)
|
||||
}
|
||||
BIN
orx-syphon/src/main/kotlin/jsyphon/libJSyphon.jnilib
Executable file
BIN
orx-syphon/src/main/kotlin/jsyphon/libJSyphon.jnilib
Executable file
Binary file not shown.
38
orx-syphon/src/test/kotlin/ClientExample.kt
Normal file
38
orx-syphon/src/test/kotlin/ClientExample.kt
Normal file
@@ -0,0 +1,38 @@
|
||||
import jsyphon.JSyphonClient
|
||||
import jsyphon.JSyphonImage
|
||||
import org.lwjgl.opengl.GL11C.GL_TEXTURE_2D
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.*
|
||||
import org.openrndr.internal.Driver
|
||||
import org.openrndr.internal.gl3.ColorBufferGL3
|
||||
import kotlin.math.sin
|
||||
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1000
|
||||
height = 1000
|
||||
}
|
||||
|
||||
program {
|
||||
val client = JSyphonClient()
|
||||
client.init()
|
||||
|
||||
|
||||
extend {
|
||||
drawer.background(ColorRGBa.RED)
|
||||
|
||||
if (client.hasNewFrame()) {
|
||||
println("hasnewframe")
|
||||
val img = client.newFrameImageForContext()
|
||||
val buffer = ColorBufferGL3(GL_TEXTURE_2D, img.textureName(), img.textureWidth(), img.textureHeight(),
|
||||
1.0, ColorFormat.RGBa, ColorType.UINT8, 1, BufferMultisample.Disabled, Session.active)
|
||||
|
||||
|
||||
drawer.image(buffer)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
20
orx-syphon/src/test/kotlin/ServerExample.kt
Normal file
20
orx-syphon/src/test/kotlin/ServerExample.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import kotlin.math.sin
|
||||
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 1000
|
||||
height = 1000
|
||||
}
|
||||
|
||||
program {
|
||||
extend(SyphonServer("Test"))
|
||||
|
||||
extend {
|
||||
drawer.background(ColorRGBa.RED)
|
||||
drawer.circle(width/2.0, height/2.0, sin(seconds) * width / 2.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user