cansik / processing-postfx

A shader based postFX library for processing.
148 stars 13 forks source link

applying fx after 3d tint produces error #32

Open verybigelephants opened 6 years ago

verybigelephants commented 6 years ago

When trying to apply the pixelate filter at the end of the drawing loop like this fx.render().pixelate(i).compose(); on a scene with some 3d mesh with some tint() applied to it breaks the renderer and it throws this error https://github.com/cansik/processing-postfx/issues/1

btw great library for simpler quick hassle free post procesing!

cansik commented 6 years ago

Thank you, I will check it out. Do you have a simple example that shows the bug? And are you running it on a mac?

verybigelephants commented 6 years ago

i am running windows and the project i am working with uses kinect and a lot of dependencies, so making it run would probably be a real pain sorry :/

cansik commented 6 years ago

Usually it is really helpful to provide a mcve. Otherwise I have to guess what could be wrong, and how you implemented it. For example here,I don't know if you are going to apply the tint before or after applying the fx...

cansik commented 6 years ago

Just tested it out with a tint(100); in the Simple Effect, and it works. So please provide a mcve so I can investigate further.

verybigelephants commented 6 years ago

sorry i haven't replied in a while, i have a lot of work recently, i will try to provide a working example as soon as possible

Silenoid commented 6 years ago

Hi, I'm having the exact same problem. There is not truly a need for an mcve: i've just cut everything off and I'm still having the error (I was working on a complex android project, than tried this library in java mode).

Here is the code:

PostFX fx;

void setup(){
    size(360,640,P2D);
    fx = new PostFX(this);
}

void draw(){
  background(255);  
  fx.render().pixelate(100).compose();
}

this is the exception I get when in Android mode using P3D rendering:

java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance(Native Method)
    at ch.bildspur.postfx.builder.PostFXBuilder.getPass(PostFXBuilder.java:38)
    at ch.bildspur.postfx.builder.PostFXBuilder.pixelate(PostFXBuilder.java:187)
    at com.tesis.jupitermezziversarium.sketch_3D_Semplice.draw(sketch_3D_Semplice.java:101)
    at processing.core.PApplet.handleDraw(PApplet.java:1818)
    at processing.opengl.PSurfaceGLES$RendererGLES.onDrawFrame(PSurfaceGLES.java:264)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: java.lang.NoSuchMethodError: No virtual method sketchPath()Ljava/lang/String; in class Lprocessing/core/PApplet; or its super classes (declaration of 'processing.core.PApplet' appears in /data/app/com.tesis.jupitermezziversarium-1/base.apk)
    at ch.bildspur.postfx.pass.BasePass.getLibPath(BasePass.java:79)
    at ch.bildspur.postfx.pass.BasePass.<init>(BasePass.java:21)
    at ch.bildspur.postfx.pass.PixelatePass.<init>(PixelatePass.java:19)
    at ch.bildspur.postfx.pass.PixelatePass.<init>(PixelatePass.java:15)
    ... 8 more
FATAL EXCEPTION: GLThread 5531
Process: com.tesis.jupitermezziversarium, PID: 28947
java.lang.NullPointerException: Attempt to invoke virtual method 'void ch.bildspur.postfx.pass.PixelatePass.setAmount(float)' on a null object reference
    at ch.bildspur.postfx.builder.PostFXBuilder.pixelate(PostFXBuilder.java:189)
    at com.tesis.jupitermezziversarium.sketch_3D_Semplice.draw(sketch_3D_Semplice.java:101)
    at processing.core.PApplet.handleDraw(PApplet.java:1818)
    at processing.opengl.PSurfaceGLES$RendererGLES.onDrawFrame(PSurfaceGLES.java:264)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1535)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

Searching on the Internet I've got not so much infos, only that it could be related to shader compiling, but if not everyone is getting this error message I don't know what to think. Anyway the library is awesome, thanks a lot for your work <3