Coder Social home page Coder Social logo

processing-core-4's Introduction

Processing Core (4.x)

This is a mirror of the core library from Processing 4, with the addition of a pom.xml, turning it into a standalone Maven artifact.

It is hosted as a Maven dependency via JitPack (from this Github repository) so it can be referenced in your own Maven project (for when you want to use the Processing library outside of the Processing IDE).

This mirror is not necessarily up to date with the latest Processing 4 release; it is currently based on Processing 4.3.


Usage in your Maven project

Step 1. Add the JitPack repository to your pom.xml

<repositories>
  <repository>
  	<id>jitpack.io</id>
  	<url>https://jitpack.io</url>
  </repository>
</repositories>

Step 2. Add the processing-core dependency

<dependency>
  <groupId>com.github.micycle1</groupId>
  <artifactId>processing-core-4</artifactId>
  <version>4.3</version>
</dependency>

That's it!

Now you don't have to worry about adding core.jar, the JavaFX and JOGL & Gluegen dependencies to your project — this does it all!

Note: core version 4.1.1 and onwards require Java 17+; prior versions require Java 11+.

processing-core-4's People

Contributors

micycle1 avatar tidensbarn 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

Watchers

 avatar  avatar  avatar  avatar  avatar

processing-core-4's Issues

Identify core version and update / release plan in README

Given that Processing4 is in alpha, and core is in active development, it might be nice to identify what snapshot date / commit / version of core each release is based on, and say something in the README about if there is a plan to periodically update.

This seems very useful -- my only concern is that it may lead people to use a very old early alpha version without realizing that is what they are using.

4.2 after adding JOGAMP repositories Load ok, but has runtime exception.

Following i have used the code TAG, but still messes all together.
**

java.lang.NullPointerException: Cannot invoke "java.net.URL.openStream()" because "url" is null
	at processing.opengl.PJOGL.loadVertexShader(PJOGL.java:576)
	at processing.opengl.PJOGL.loadVertexShader(PJOGL.java:537)
	at processing.opengl.PGraphicsOpenGL.getPolyShader(PGraphicsOpenGL.java:7054)
	at processing.opengl.PGraphicsOpenGL.flushPolys(PGraphicsOpenGL.java:2343)
	at processing.opengl.PGraphicsOpenGL.flush(PGraphicsOpenGL.java:2280)
	at processing.opengl.PGraphicsOpenGL.frustum(PGraphicsOpenGL.java:4538)
	at processing.opengl.PGraphicsOpenGL.perspective(PGraphicsOpenGL.java:4524)
	at processing.opengl.PGraphicsOpenGL.perspective(PGraphicsOpenGL.java:4511)
	at processing.core.PApplet.perspective(PApplet.java:13353)
	at tw.decade.God.draw(God.java:74)

**

  • same project w/4.1.1 work great!
  • same project w/4.2. has start exception!

same project 4.1.1 -> 4.2 has start error above that show libDifferent.jnilib cant found.
If I implementation local p4.app lib is ok.( like follow gradle setup which i commoned)
this is my build.gradle

Following i have used the code TAG, but still messes all together.
'

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
    maven { url 'https://jogamp.org/deployment/maven' }
}
dependencies {
//    implementation fileTree(dir: '/Applications/Processing.app/Contents/Java/core/library', include: ['*.jar'])
//    implementation fileTree(dir: '/Applications/ProcessingIntel.app/Contents/Java/core/library', include: ['*.jar'])
    implementation 'com.github.micycle1:processing-core-4:4.2'
}
application {
    mainClass = 'tw.MainWindow'
//    applicationDefaultJvmArgs = ["-Djava.library.path=" + file("${buildDir}/libs/hello/shared").absolutePath]
    applicationDefaultJvmArgs = ["-Djava.library.path=" + file("/Applications/ProcessingIntel.app/Contents/Java/core/library/macos-x86_64").absolutePath]
//    applicationDefaultJvmArgs = ["-Djava.library.path=" + file("/Applications/ProcessingIntel.app/Contents/Java/core/library/macos-aarch64").absolutePath]
}

'

P3D render lead to NPE on start

Given

A maven project for java 17 with following attributes:

  • groupId: org.example;

  • artifactId: my-project.

Project structure:

├── pom.xml
└── src
    ├── main
    │   ├── java
    │   │   └── org
    │   │       └── example
    │   │           └── Main.java
    │   └── resources
    └── test
        └── java

pom.xml content:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>my-project</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.github.micycle1</groupId>
            <artifactId>processing-core-4</artifactId>
            <version>4.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Main-Class>org.example.Main</Main-Class>
                                        <Build-Number>1.0</Build-Number>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>
</project>-

The creation of an uber-jar is here to ease the tests.

Content of org.example.Main.java

package org.example;

import processing.core.PApplet;

public class Main extends PApplet {

    public void settings(){

        size(500,500, P3D);

    }

    public void draw(){
        translate(width/2,height/2,-100);
        rotateY(PI/3);
        box(75);
    }

    public static void main(String[] args) {

        PApplet.runSketch(new String[]{"test"}, new Main());

    }
}

When

compile and run

cd $PROJECT_HOME
mvn clean install
java -jar target/my-project-1.0-SNAPSHOT.jar

Should

have a drawing of a cube and no error in the console

But

get a blank canvas and the following stack:

java.lang.NullPointerException: Cannot invoke "java.net.URL.openStream()" because "url" is null
    at processing.opengl.PJOGL.loadVertexShader(PJOGL.java:576)
    at processing.opengl.PJOGL.loadVertexShader(PJOGL.java:537)
    at processing.opengl.PGraphicsOpenGL.getPolyShader(PGraphicsOpenGL.java:7054)
    at processing.opengl.PGraphicsOpenGL.flushPolys(PGraphicsOpenGL.java:2343)
    at processing.opengl.PGraphicsOpenGL.flush(PGraphicsOpenGL.java:2280)
    at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:1447)
    at processing.core.PApplet.handleDraw(PApplet.java:2111)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:840)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:692)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:674)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:443)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1293)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1147)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:787)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:81)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:453)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
    at java.base/java.util.TimerThread.run(Timer.java:516)

Workaround to create 3D scene despite this problem.

Create the following folders in the src/main/resource folder :

cd $PROJECT_HOME
cd src/main/resources
mkdir -p processing/opengl/shaders

Extract in this folder the glsl files located at the root of the
compiled uber-jar :

cd $PROJECT_HOME
cd src/main/resources/processing/opengl/shaders
jar_path=$PROJECT_HOME/target/my-project-1.0-SNAPSHOT.jar
jar -xf "$jar_path" $(jar -tf "$jar_path" | grep -E "^\w+\.glsl")

Now recompile and run the project

cd $PROJECT_HOME
mvn clean install
java -jar target/my-project-1.0-SNAPSHOT.jar

Now a cube is drawn on the canvas without any error in the console.

Hope this help.

4.0 beta 1 is out!

If you would like to update this repo to point at the latest core, 4.0 beta 1 is out.

Even if not, please consider updating this repo to identify "4.0a3" -- not 4.0.3, which appears to come after the beta, when it really comes 9 months before.

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.