Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen capture demo #123

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {
apply plugin: 'org.jetbrains.dokka'

project.ext {
openrndrVersion = "0.3.43-rc.5"
openrndrVersion = "0.3.43-rc.11"
kotlinVersion = "1.3.72"
spekVersion = "2.0.10"
libfreenectVersion = "0.5.7-1.5.3"
Expand Down
3 changes: 3 additions & 0 deletions openrndr-demos/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ def boofcvVersion = "0.34"
dependencies {
demoImplementation(project(":orx-mesh-generators"))
demoImplementation(project(":orx-camera"))
demoImplementation(project(":orx-parameters"))

demoImplementation("org.openrndr:openrndr-core:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-extensions:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-ffmpeg:$openrndrVersion")
demoRuntimeOnly("org.openrndr:openrndr-ffmpeg-natives-$openrndrOS:$openrndrVersion")
demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
demoImplementation(sourceSets.getByName("main").output)
Expand Down
44 changes: 44 additions & 0 deletions openrndr-demos/src/demo/kotlin/DemoScreenCapture01.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.DepthTestPass
import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.isolated
import org.openrndr.draw.shadeStyle
import org.openrndr.extras.meshgenerators.boxMesh
import org.openrndr.ffmpeg.VideoPlayerFFMPEG
import org.openrndr.math.Vector3

fun main() {
application {
program {
val cube = boxMesh()
val screen = VideoPlayerFFMPEG.fromScreen(
frameRate = 15.0,
imageWidth = 300,
imageHeight = 300
)

screen.play()
extend {
screen.draw(drawer, true) // update the screen grabber
drawer.isolated {
clear(ColorRGBa.WHITE)
perspective(60.0, width * 1.0 / height, 0.01, 1000.0)
depthWrite = true
depthTestPass = DepthTestPass.LESS_OR_EQUAL
shadeStyle = shadeStyle {
fragmentTransform = "x_fill = texture(p_tex, vec2(1.0-va_texCoord0.x, va_texCoord0.y));"
screen.colorBuffer?.run {
parameter("tex", this)
}
}
rotate(Vector3.UNIT_Z, 90.0)
translate(0.0, 0.0, -120.0)
rotate(Vector3.UNIT_X, seconds * 10)
scale(90.0)
vertexBuffer(cube, DrawPrimitive.TRIANGLES)
}
}
}
}
}