Coder Social home page Coder Social logo

openrndr-tutorials's Introduction

OPENRNDR

Download Build status

A Kotlin/JVM and Kotlin/JS library for creative coding, real-time and interactive graphics. Can currently be used on Windows, macOS and Linux/x64 to create standalone graphical applications.

Basics and use are further explained in the OPENRNDR guide.

Repository structure

module description
openrndr-animatable Tooling for interactive animations
openrndr-application Application and Program classes
openrndr-binpack Binpacking algorithm used for texture atlasses
openrndr-color Color spaces
openrndr-dds DirectDraw Surface file (.dds) loader
openrndr-demos A collection of small in-repository demos
openrndr-draw Drawing primitives
openrndr-event Event classes
openrndr-extensions Built-in OPENRNDR extensions
openrndr-filter Built-in filters
openrndr-js Kotlin/JS specific modules
openrndr-jvm Kotlin/JVM specific modules
openrndr-math Math functions and classes
openrndr-nullgl Mock graphics back-end
openrndr-shape Classes and functions for working with 2D shapes
openrndr-svg Loading and saving SVG
openrndr-utils Assorted utilities

Using OPENRNDR

You are advised to use the OPENRNDR template which provides a quick start to using the library.

OPENRNDR's Javascript/WebGL is still experimental and under development. However, if you feel like trying it you should use the OPENRNDR JS template.

Building OPENRNDR

After cloning the repository, make sure you have Java 11 or newer installed and run the following command:

./gradlew build

This should start the build process, which will take some time to complete.

Note that OPENRNDR does not depend on anything that is not on Maven Central, builds should be easy and predictable.

Installing OPENRNDR as Maven artifacts

In order to use the OPENRNDR build from your applications one has to install OPENRNDR's Maven artifacts in the local Maven repository.

./gradlew publishToMavenLocal snapshot

A more detailed walk-through of building, publishing to Maven local and contributing can be found in the wiki.

Community

Visit the OPENRNDR website for the latest news on OPENRNDR, showcases and events

Join us on the OPENRNDR forum for questions, tutorials and showcases.

Reach us more directly on the OPENRNDR Slack.

openrndr-tutorials's People

Contributors

boydrotgans avatar daniel5gh avatar edwinrndr avatar hamoid avatar joelongstreet avatar krksgbr avatar morisil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openrndr-tutorials's Issues

Problem with

Not sure whether this is a Mac specific issue, but on my MacBook Pro running the slit-scan-001 tutorial via

./gradlew :slit-scan-001:run

results in

3.3.0 Cocoa NSGL dynamic
tracking verteBuffer org.openrndr.internal.gl3.VertexBufferGL3@31c88ec8
OpenGL vendor: ATI Technologies Inc.
OpenGL version: 4.1 ATI-2.9.26
looked for format: org.bytedeco.javacpp.avformat$AVInputFormat[address=0x13f282070,position=0,limit=0,capacity=0,deallocator=null] got avfoundation
[avfoundation @ 0x7fa6da0ab200] Selected framerate (29.970030) is not supported by the device
...
Exception in thread "main" org.openrndr.ffmpeg.adopted.FrameGrabber$Exception: avformat_open_input() error -5: Could not open input "0". (Has setFormat() been called?)
        at org.openrndr.ffmpeg.adopted.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:638)
        at org.openrndr.ffmpeg.adopted.FFmpegFrameGrabber.start(FFmpegFrameGrabber.java:567)
        at org.openrndr.ffmpeg.FFMPEGVideoPlayer.start(FFMPEGVideoPlayer.kt:101)
        at Example.setup(Example.kt:24)
        at org.openrndr.internal.gl3.ApplicationGLFWGL3.loop(ApplicationGLFWGL3.kt:510)
        at org.openrndr.Application$Companion.run(Application.kt:29)
        at ExampleKt.main(Example.kt:67)
Assertion failed: (_localEvalOnceCondition), function PropertiesChanged, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleUSBCamera/AppleUSBCamera-193.260.10/Sources/Extras/CoreMediaIO/DeviceAbstractionLayer/Devices/DP/Base/CMIO_DP_Object.cpp, line 582.

Including a specific framerate in https://github.com/openrndr/openrndr-tutorials/blob/master/slit-scan-001/src/main/kotlin/Example.kt, ie:

videoPlayer = FFMPEGVideoPlayer.fromDevice()

โ†’

videoPlayer = FFMPEGVideoPlayer.fromDevice(framerate=30.0)

makes it work for me.

start-dialog-001 does not start

Even though I fixed the code of this module to finally compile (issue #19), it still doesn't start:

Exception in thread "main" kotlin.UninitializedPropertyAccessException: lateinit property application has not been initialized
	at org.openrndr.Program.getApplication(Program.kt:43)
	at org.openrndr.Program$mouse$2.invoke(Program.kt:208)
	at org.openrndr.Program$mouse$2.invoke(Program.kt:35)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at org.openrndr.Program.getMouse(Program.kt)
	at Dialog.<init>(Example.kt:17)
	at ExampleKt.main(Example.kt:53)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)

It's hard for me to tell the original intention behind this code.

Example 'rectangle-001' compile error

Example 'rectangle-001' fails with the following compile error:

Error:(26, 37) Kotlin: Type inference failed. Expected type mismatch: inferred type is List<Rectangle> but Rectangle was expected

The offending line is :

        drawer.rectangle((0..20000).map { Rectangle(Math.random() * width, Math.random() * height, 10.0, 10.0) })

Example 'text-001' : "java.net.MalformedURLException: no protocol"

Example app 'text-001' crashes when run on WIndows 10-

Exception in thread "main" java.net.MalformedURLException: no protocol: data/fonts/Roboto-Medium.ttf
	at java.base/java.net.URL.<init>(URL.java:627)
	at java.base/java.net.URL.<init>(URL.java:523)
	at java.base/java.net.URL.<init>(URL.java:470)
	at org.openrndr.internal.gl3.FontImageMapManagerGL3.fontMapFromUrl(FontImageMapManagerGL3.kt:35)
	at org.openrndr.draw.FontImageMap$Companion.fromUrl(FontMap.kt:36)
	at org.openrndr.draw.FontImageMap$Companion.fromUrl$default(FontMap.kt:34)
	at Example.setup(Example.kt:15)
	at org.openrndr.internal.gl3.ApplicationGLFWGL3.loop(ApplicationGLFWGL3.kt:434)
	at org.openrndr.Application$Companion.run(Application.kt:18)
	at ExampleKt.main(Example.kt:28)

The offending line is -

font = FontImageMap.fromUrl("data/fonts/Roboto-Medium.ttf", 16.0)

Prefixing the string with file: (as in Examples 'text-002' & 'text-003') fixes the issue.

Examples 'rectangle-001' & rectangle-002' not in build config?

Issue with trying to build & run Example modules 'rectangle-001' & rectangle-002'. (IDE build/run icon not visible.)

These modules are not included in the 'settings.gradle' file so are ignored?

Adding them as follows fixes this issue. (However, now the compile errors are evident - I'll raise separate issues for the compile arrors!)

rootProject.name = 'openrndr-tutorials'

include 'rectangles-001',
        'rectangles-002',
        'animation-001',
        'camera-001',
        ...

Example 'rectangle-002' has compile errors

Example 'rectangle-002' has compile errors:

Error:(17, 73) Kotlin: The integer literal does not conform to the expected type VertexElementType
Error:(17, 77) Kotlin: Type mismatch: inferred type is VertexElementType but Int was expected
Error:(18, 28) Kotlin: The integer literal does not conform to the expected type VertexElementType
Error:(18, 31) Kotlin: Type mismatch: inferred type is VertexElementType but Int was expected
Error:(48, 43) Kotlin: Type inference failed. Expected type mismatch: inferred type is List<Rectangle> but Rectangle was expected

The corresponding src lines:
line 17 -

transforms = vertexBuffer(vertexFormat { attribute("transform", 16, VertexElementType.FLOAT32)

line 18 -

attribute("color", 4, VertexElementType.FLOAT32)}, 100000)

line 48-

drawer.rectangle((0 until 100000).map { Rectangle(-0.5, -0.5, 1.0, 1.0) })

Shader error in custom-rendering-001

The following lines produce an error in this example (I'm using Windows 10):

drawer.shadeStyle = shadeStyle {
            fragmentTransform = """
                x_fill.rgb = vec3(cos(view.position.x*0.1)*0.5+0.5, 0.0, 0.0);
                """
        }

I believe the issue is the view variable, since it does not appear to be declared in the generated shader code:

#version 331


layout(origin_upper_left) in vec4 gl_FragCoord;

uniform sampler2D image;

uniform mat4 u_modelNormalMatrix;
uniform mat4 u_modelMatrix;
uniform mat4 u_normalMatrix; // will be deleted soon
uniform mat4 u_viewNormalMatrix;
uniform mat4 u_viewMatrix;
uniform mat4 u_projectionMatrix;
uniform mat4 u_viewProjectionMatrix; // will be deleted soon
uniform vec4 u_fill;
uniform vec4 u_stroke;
uniform float u_strokeWeight;
uniform float[25] u_colorMatrix;

in vec3 va_position;



in vec3 v_worldNormal;
in vec3 v_viewNormal;
in vec3 v_worldPosition;
in vec3 v_viewPosition;
in vec4 v_clipPosition;


out vec4 o_color;


flat in int v_instance;


void main(void) {
    vec2 c_screenPosition = gl_FragCoord.xy;
    float c_contourPosition = 0.0;
    vec4 x_fill = u_fill;
    vec4 x_stroke = u_stroke;
    {

                x_fill.rgb = vec3(cos(view.position.x*0.1)*0.5+0.5, 0.0, 0.0);

    }
    o_color = x_fill;
    o_color.rgb *= o_color.a;
}

Perhaps this example is outdated, as I could not find any reference to view in the guide for this topic.

cubemaps-001 example missing data folder

I get the following error when I run it:

Exception in thread "main" java.io.FileNotFoundException: data/garage.dds (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:220)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:158)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:113)
	at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
	at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
	at java.base/java.net.URL.openStream(URL.java:1117)
	at org.openrndr.internal.gl3.CubemapGL3$Companion.fromUrl(CubemapGL3.kt:45)
	at org.openrndr.internal.gl3.DriverGL3.createCubemapFromUrls(GLFWDriver.kt:127)
	at org.openrndr.draw.Cubemap$Companion.fromUrl(Cubemap.kt:22)
	at Example.setup(Example.kt:13)
	at org.openrndr.internal.gl3.ApplicationGL3.loop(ApplicationGL3.kt:426)
	at org.openrndr.Application$Companion.run(Application.kt:13)
	at org.openrndr.ApplicationKt.application(Application.kt:39)
	at ExampleKt.main(Example.kt:120)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.