Compare commits

...

15 Commits

Author SHA1 Message Date
Edwin Jakobs
97c55825e2 Upgrade to OPENRNDR 0.3.39 2020-02-14 15:48:06 +01:00
Edwin Jakobs
15c188aee0 Fix for aarch64 architecture 2020-01-29 14:07:47 +01:00
Edwin Jakobs
6c3d1319cb Update README.md 2020-01-29 12:44:43 +01:00
Edwin Jakobs
ede734d74c Add support for cross building and support for future linux-arm64 version 2020-01-29 12:43:32 +01:00
Edwin Jakobs
89fce80aff Upgrade to OPENRNDR 0.3.38, add TemplateLiveProgram.kt 2020-01-28 00:12:33 +01:00
Edwin Jakobs
0a478a98a6 Fix orx-kinect-v1 native dependencies 2020-01-13 21:00:56 +01:00
Edwin Jakobs
b994ccfd28 Update README.md 2020-01-13 20:17:02 +01:00
edwin
79d9a7971a Bump OPENRNDR, ORX, Panel, Gradle 2019-12-16 18:48:34 +01:00
Edwin Jakobs
d99af16ab8 Bump to ORX 0.3.42 2019-11-29 13:52:05 +01:00
Edwin Jakobs
b781680fb6 Bump to ORX 0.3.41 2019-11-28 16:36:13 +01:00
edwin
e2108f86e5 Bump to OPENRNDR 0.3.36, ORX 0.3.40, Panel 0.3.18 2019-11-25 19:41:26 +01:00
Edwin Jakobs
1ab4b6e538 Add default simple logging
* Bump library versions
 * Bump template version
 * Small clean-up of TemplateProgram.kt
2019-11-10 14:26:16 +01:00
edwin
c0205c03b8 Bumped orx to 0.3.36 2019-11-04 17:02:22 +01:00
edwin
d31446821f Version bump 2019-10-07 17:24:58 +02:00
edwin
71f315f5ca Version bump 2019-10-07 17:10:49 +02:00
5 changed files with 169 additions and 63 deletions

View File

@@ -1,12 +1,18 @@
# openrndr-template # OPENRNDR template project
A feature rich template for creating OPENRNDR programs based on Gradle/Kts A feature rich template for creating OPENRNDR programs based on Gradle/Kts
You will find some [basic instructions](https://guide.openrndr.org/#/02_Getting_Started_with_OPENRNDR/C00_SetupYourFirstProgram) in the [OPENRNDR guide](https://guide.openrndr.org)
The template consists of a configuration for Gradle and an example OPENRNDR program. The Gradle configuration should serve as the The template consists of a configuration for Gradle and an example OPENRNDR program. The Gradle configuration should serve as the
go-to starting point for writing OPENRNDR-based software. go-to starting point for writing OPENRNDR-based software.
If you are looking at this from IntelliJ IDEA you can start by expanding the _project_ tab on the left. You will find a template program in `src/main/kotlin/TemplateProgram.kt`
You will find some [basic instructions](https://guide.openrndr.org/#/02_Getting_Started_with_OPENRNDR/C00_SetupYourFirstProgram) in the [OPENRNDR guide](https://guide.openrndr.org)
## Gradle tasks ## Gradle tasks
- `run` runs the TemplateProgram - `run` runs the TemplateProgram
- `jar` creates an executable platform specific jar file with all dependencies - `jar` creates an executable platform specific jar file with all dependencies
- `zipDistribution` creates a zip file containing the application jar and the data folder - `zipDistribution` creates a zip file containing the application jar and the data folder
## Cross builds
To create runnable jars for a platform different from the platform you use to build one uses `./gradlew jar --PtargetPlatform=<platform>`. The supported platforms are `windows`, `macos`, `linux-x64` and `linux-arm64`. Note that the `linux-arm64` platform will only work with OPENRNDR snapshot builds from master and OPENRNDR 0.3.39 (a future version).

View File

@@ -1,41 +1,93 @@
import org.gradle.internal.os.OperatingSystem import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
val kotlinVersion = "1.3.41" /* the name of this project, default is the template version but you are free to change these */
group = "org.openrndr.template"
version = "0.3.10"
val applicationMainClass = "TemplateProgramKt"
/* Which additional (ORX) libraries should be added to this project. */
val orxFeatures = setOf(
// "orx-camera",
"orx-compositor",
// "orx-easing",
// "orx-filter-extension",
// "orx-file-watcher",
"orx-fx",
"orx-gui",
// "orx-integral-image",
// "orx-interval-tree",
"orx-image-fit",
// "orx-jumpflood",
// "orx-kinect-v1",
// "orx-kdtree",
// "orx-mesh-generators"
// "orx-midi",
// "orx-noclear",
"orx-noise",
// "orx-obj"
"orx-olive",
// "orx-osc"
// "orx-palette"
// "orx-runway"
"orx-shade-styles"
)
/* Which OPENRNDR libraries should be added to this project? */
val openrndrFeatures = setOf(
"panel",
"video"
)
/* Which version of OPENRNDR, ORX and Panel should be used? */
val openrndrUseSnapshot = false
val openrndrVersion = if (openrndrUseSnapshot) "0.4.0-SNAPSHOT" else "0.3.39"
val panelUseSnapshot = false
val panelVersion = if (panelUseSnapshot) "0.4.0-SNAPSHOT" else "0.3.21"
val orxUseSnapshot = false
val orxVersion = if (orxUseSnapshot) "0.4.0-SNAPSHOT" else "0.3.47"
//<editor-fold desc="This is code for OPENRNDR, no need to edit this .. most of the times">
val supportedPlatforms = setOf("windows", "macos", "linux-x64", "linux-arm64")
val openrndrOs = if (project.hasProperty("targetPlatform")) {
val platform : String = project.property("targetPlatform") as String
if (platform !in supportedPlatforms) {
throw IllegalArgumentException("target platform not supported: $platform")
} else {
platform
}
} else when (OperatingSystem.current()) {
OperatingSystem.WINDOWS -> "windows"
OperatingSystem.MAC_OS -> "macos"
OperatingSystem.LINUX -> when(val h = DefaultNativePlatform("current").architecture.name) {
"x86-64" -> "linux-x64"
"aarch64" -> "linux-arm64"
else ->throw IllegalArgumentException("architecture not supported: $h")
}
else -> throw IllegalArgumentException("os not supported")
}
//</editor-fold>
enum class Logging {
NONE,
SIMPLE,
FULL
}
/* What type of logging should this project use? */
val applicationLogging = Logging.SIMPLE
val kotlinVersion = "1.3.61"
plugins { plugins {
java java
kotlin("jvm") version("1.3.41") kotlin("jvm") version("1.3.61")
} }
group = "org.openrndr.template"
version = "0.3.1"
val applicationMainClass = "TemplateProgramKt"
val applicationFullLogging = false
val openrndrUseSnapshot = false
val openrndrVersion = if (openrndrUseSnapshot) "0.4.0-SNAPSHOT" else "0.3.35-rc1"
val openrndrOs = when (OperatingSystem.current()) {
OperatingSystem.WINDOWS -> "windows"
OperatingSystem.MAC_OS -> "macos"
OperatingSystem.LINUX -> "linux-x64"
else -> throw IllegalArgumentException("os not supported")
}
// supported features are: video, panel
val openrndrFeatures = setOf("video", "panel")
val panelUseSnapshot = false
val panelVersion = if (panelUseSnapshot) "0.4.0-SNAPSHOT" else "0.3.17-m3"
val orxUseSnapshot = false
val orxVersion = if (orxUseSnapshot) "0.1.0-SNAPSHOT" else "0.0.31"
// supported features are: orx-camera, orx-compositor,orx-easing, orx-filter-extension,orx-file-watcher,
// orx-integral-image, orx-interval-tree, orx-jumpflood,orx-kdtree, orx-mesh-generators,orx-midi, orx-no-clear,
// orx-noise, orx-obj, orx-olive
val orxFeatures = setOf("orx-noise")
repositories { repositories {
mavenCentral() mavenCentral()
@@ -57,48 +109,73 @@ fun DependencyHandler.openrndrNatives(module: String): Any {
return "org.openrndr:openrndr-$module-natives-$openrndrOs:$openrndrVersion" return "org.openrndr:openrndr-$module-natives-$openrndrOs:$openrndrVersion"
} }
fun DependencyHandler.orxNatives(module: String): Any {
return "org.openrndr.extra:$module-natives-$openrndrOs:$orxVersion"
}
dependencies { dependencies {
runtime(openrndr("gl3"))
runtime(openrndrNatives("gl3"))
compile(openrndr("core"))
compile(openrndr("svg"))
compile(openrndr("animatable"))
compile(openrndr("extensions"))
compile(openrndr("filter"))
compile("org.jetbrains.kotlinx", "kotlinx-coroutines-core","1.3.0-RC") /* This is where you add additional (third-party) dependencies */
compile("io.github.microutils", "kotlin-logging","1.7.2") // implementation("org.jsoup:jsoup:1.12.2")
// implementation("com.google.code.gson:gson:2.8.6")
if (!applicationFullLogging) { //<editor-fold desc="Managed dependencies">
runtime("org.slf4j","slf4j-nop","1.7.25") runtimeOnly(openrndr("gl3"))
} else { runtimeOnly(openrndrNatives("gl3"))
runtime("org.apache.logging.log4j", "log4j-slf4j-impl", "2.12.0") implementation(openrndr("openal"))
runtime("com.fasterxml.jackson.core", "jackson-databind", "2.8.7") runtimeOnly(openrndrNatives("openal"))
runtime("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", "2.8.7") implementation(openrndr("core"))
implementation(openrndr("svg"))
implementation(openrndr("animatable"))
implementation(openrndr("extensions"))
implementation(openrndr("filter"))
implementation("org.jetbrains.kotlinx", "kotlinx-coroutines-core","1.3.3")
implementation("io.github.microutils", "kotlin-logging","1.7.8")
when(applicationLogging) {
Logging.NONE -> {
runtimeOnly("org.slf4j","slf4j-nop","1.7.29")
}
Logging.SIMPLE -> {
runtimeOnly("org.slf4j","slf4j-simple","1.7.29")
}
Logging.FULL -> {
runtimeOnly("org.apache.logging.log4j", "log4j-slf4j-impl", "2.13.0")
runtimeOnly("com.fasterxml.jackson.core", "jackson-databind", "2.10.1")
runtimeOnly("com.fasterxml.jackson.dataformat", "jackson-dataformat-yaml", "2.10.1")
}
} }
if ("video" in openrndrFeatures) { if ("video" in openrndrFeatures) {
compile(openrndr("ffmpeg")) implementation(openrndr("ffmpeg"))
runtime(openrndrNatives("ffmpeg")) runtimeOnly(openrndrNatives("ffmpeg"))
} }
if ("panel" in openrndrFeatures) { if ("panel" in openrndrFeatures) {
compile("org.openrndr.panel:openrndr-panel:$panelVersion") implementation("org.openrndr.panel:openrndr-panel:$panelVersion")
} }
for (feature in orxFeatures) { for (feature in orxFeatures) {
compile(orx(feature)) implementation(orx(feature))
}
if ("orx-kinect-v1" in orxFeatures) {
runtimeOnly(orxNatives("orx-kinect-v1"))
} }
if ("orx-olive" in orxFeatures) { if ("orx-olive" in orxFeatures) {
compile("org.jetbrains.kotlin", "kotlin-scripting-compiler-embeddable") implementation("org.jetbrains.kotlin", "kotlin-scripting-compiler-embeddable")
} }
implementation(kotlin("stdlib-jdk8")) implementation(kotlin("stdlib-jdk8"))
testCompile("junit", "junit", "4.12") testImplementation("junit", "junit", "4.12")
//</editor-fold>
} }
// --------------------------------------------------------------------------------------------------------------------
configure<JavaPluginConvention> { configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
} }
@@ -130,4 +207,4 @@ tasks.create("zipDistribution", Zip::class.java) {
tasks.create("run", JavaExec::class.java) { tasks.create("run", JavaExec::class.java) {
main = applicationMainClass main = applicationMainClass
classpath = sourceSets.main.get().runtimeClasspath classpath = sourceSets.main.get().runtimeClasspath
}.dependsOn(tasks.build) }.dependsOn(tasks.build)

View File

@@ -1,5 +1,5 @@
#Thu Aug 01 12:32:31 CEST 2019 #Thu Aug 01 12:32:31 CEST 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@@ -0,0 +1,22 @@
import org.openrndr.Program
import org.openrndr.application
import org.openrndr.extra.olive.Olive
/**
* This is a template for a live program.
* The first you will run this program it will create a script file at src/main/kotlin/live.kts
* This script file can be modified while the program is running.
*
* Please refer to https://guide.openrndr.org/#/10_OPENRNDR_Extras/C03_Live_coding for more
* instructions on using the live coding environment.
*/
fun main() = application {
configure {
width = 800
height = 800
}
program {
extend(Olive<Program>())
}
}

View File

@@ -1,8 +1,10 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.draw.FontImageMap import org.openrndr.draw.loadFont
import org.openrndr.draw.loadImage import org.openrndr.draw.loadImage
import org.openrndr.draw.tint import org.openrndr.draw.tint
import kotlin.math.cos
import kotlin.math.sin
fun main() = application { fun main() = application {
configure { configure {
@@ -11,20 +13,19 @@ fun main() = application {
} }
program { program {
val image = loadImage("data/images/pm5544.png")
val image = loadImage("file:data/images/pm5544.png") val font = loadFont("data/fonts/IBMPlexMono-Regular.ttf", 64.0)
val font = FontImageMap.fromUrl("file:data/fonts/IBMPlexMono-Regular.ttf", 64.0)
extend { extend {
drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(0.2)) drawer.drawStyle.colorMatrix = tint(ColorRGBa.WHITE.shade(0.2))
drawer.image(image) drawer.image(image)
drawer.fill = ColorRGBa.PINK drawer.fill = ColorRGBa.PINK
drawer.circle(Math.cos(seconds)*width/2.0+width/2.0, Math.sin(0.5*seconds)*height/2.0 + height/2.0, 140.0) drawer.circle(cos(seconds) * width / 2.0 + width / 2.0, sin(0.5 * seconds) * height / 2.0 + height / 2.0, 140.0)
drawer.fontMap = font drawer.fontMap = font
drawer.fill = ColorRGBa.WHITE drawer.fill = ColorRGBa.WHITE
drawer.text("OPENRNDR", width/2.0, height /2.0) drawer.text("OPENRNDR", width / 2.0, height / 2.0)
} }
} }
} }