For developing with scenery, or scenery itself, it's quite useful to have an IDE that supports you in your coding tasks. We recommend using IntelliJ as IDE, which is available as free Community Edition from Jetbrains. In case you are an Eclipse user, there is a Kotlin plugin available in the Eclipse market place that can be used for development with scenery.
scenery and IntelliJ require an installed Java Development Kit (JDK), with versions 8, 11, and 12 being supported. scenery is fully compatible with OpenJDK, which you can download at https://adoptopenjdk.net/.
git clone https://github.com/scenerygraphics/scenery.git
Should you already have a Github account and an SSH key set up with that account, you can also use
That'll clone the scenery repository to a folder named
sceneryon your hard drive.
The scenery repository consists of the following major directories:
src/main/kotlin/graphics/scenerycontains the main scenery source code.
src/test/tests/graphics/scenery/tests/examplescontains example code and small applications for getting started and for demonstrating features of scenery.
src/test/tests/graphics/scenery/tests/unitcontains unit tests that are automatically executed when scenery is built to ensure everything is still working. scenery uses the JUnit testing framework for that.
src/main/resources/graphics/scenerycontains images, shader files and other files that are not Kotlin or Java source code.
Furthermore, there is an
artworkdirectory, containing some scenery logos.
To build scenery on the command line, change to the scenery directory and run
Bash (Linux, macOS, git bash)
This will download the Gradle version required automatically, followed by all dependencies required. Then, it will build the scenery JAR files in the
build/libsdirectory. The first build will take a while because all dependencies are downloaded from teh interwebs. When the build is successful, there should be multiple files there, named
From the scenery repository directory, you can then run
Bash (Linux, macOS, git bash)
... and the TexturedCubeExample should (semi-)magically show up.
First, import the project in IntelliJ:
- Click File > Open and navigate to the scenery directory,
- Open the file
build.gradle.ktsthere. When IntelliJ asks to open as project or as file, select Open as Project,
IntelliJ will now resolve and download all dependencies of scenery, which might take a while when you are doing this for the first time.
When IntelliJ is done importing, navigate to the examples directory with the directory browser on the left. The directory is
src/test/tests/graphics/scenery/tests/examplesa. You can alternatively switch the directory tree to Packages mode and navigate to
Find an example you want to run, e.g.
TexturedCubeExample, open the file, and click on the small green Play button that appears next to the main routine in that file:
The example should now compile and magically show up on screen.
The examples of scenery are a good starting point for exploring features or developing your own applications. Tinker around and modify them to your needs.