Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Can't use the method lights() or directionalLight() in my drawing.

$
0
0

All the time I try to use some light releted method like lights() or directionalLight() the console is returning to me the error FATAL EXCEPTION: GLThread 10295 java.lang.NullPointerException. Can someone tell me what could it be?

the drawing method:

void draw(){

    background(0);

    lights(); //because of the method the error happens...

    float tempOrientation = (float) ((int) (accelerometerY * 1000)) / 1000;

    camera(width/2.0 + tempOrientation * width/10, height/2.0, (height/2.0) / tan(PI*30.0 / 180.0), width/2.0, height/2.0, 0, 0, 1, 0);

    pointLight(200, 200, 200, width/2, height/2, 200);

    centerLine();
    drawBall();
    drawPlayer();
    drawEnemy();
    scoreText();

    println("-------");
    println("X: " + accelerometerX);
    println("Y: " + accelerometerY);
    println("Z: " + accelerometerZ);
    println("-------");
}

the error in console:

FATAL EXCEPTION: GLThread 10295
java.lang.NullPointerException
FATAL EXCEPTION: GLThread 10295
java.lang.NullPointerException
    at processing.opengl.PGL.loadVertexShader(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.getPolyShader(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.flushPolys(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.flush(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.endDraw(Unknown Source)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.opengl.PGLES$AndroidRenderer.onDrawFrame(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1524)
    at processing.opengl.PGL.loadVertexShader(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.getPolyShader(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.flushPolys(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.flush(Unknown Source)
    at processing.opengl.PGraphicsOpenGL.endDraw(Unknown Source)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.opengl.PGLES$AndroidRenderer.onDrawFrame(Unknown Source)
    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1524)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)

Viewing all articles
Browse latest Browse all 941

Trending Articles