ArrayIndexOutOfBoundsException error when enabling depth sorting in P3D #3476

Closed
codeanticode opened this Issue Jul 17, 2015 · 0 comments

Comments

Projects
None yet
1 participant
@codeanticode
Member

codeanticode commented Jul 17, 2015

This code:

void setup() {
  size(400, 400, P3D); 
  fill(50, 100);
  noStroke();
  hint(ENABLE_DEPTH_SORT);
}

void draw() {
  background(170);
  translate(width/2, height/2);
  sphere(100);
}

gives the following error when adding the depth sort hint (tested on 3.0a11):

java.lang.ArrayIndexOutOfBoundsException: 256
    at processing.opengl.PGraphicsOpenGL$DepthSorter.sort(PGraphicsOpenGL.java:13631)
    at processing.opengl.PGraphicsOpenGL.flushSortedPolys(PGraphicsOpenGL.java:3017)
    at processing.opengl.PGraphicsOpenGL.flush(PGraphicsOpenGL.java:2912)
    at processing.opengl.PGraphicsOpenGL.endDraw(PGraphicsOpenGL.java:2064)
    at processing.core.PApplet.handleDraw(PApplet.java:2409)
    at processing.opengl.PSurfaceJOGL$DrawListener.display(PSurfaceJOGL.java:622)
    at jogamp.opengl.GLDrawableHelper.displayImpl(GLDrawableHelper.java:691)
    at jogamp.opengl.GLDrawableHelper.display(GLDrawableHelper.java:673)
    at jogamp.opengl.GLAutoDrawableBase$2.run(GLAutoDrawableBase.java:442)
    at jogamp.opengl.GLDrawableHelper.invokeGLImpl(GLDrawableHelper.java:1277)
    at jogamp.opengl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:1131)
    at com.jogamp.newt.opengl.GLWindow.display(GLWindow.java:680)
    at com.jogamp.opengl.util.AWTAnimatorImpl.display(AWTAnimatorImpl.java:77)
    at com.jogamp.opengl.util.AnimatorBase.display(AnimatorBase.java:451)
    at com.jogamp.opengl.util.FPSAnimator$MainTask.run(FPSAnimator.java:178)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

@codeanticode codeanticode added the opengl label Jul 17, 2015

@codeanticode codeanticode self-assigned this Jul 17, 2015

JakubValtar added a commit to JakubValtar/processing that referenced this issue Jul 17, 2015

Sorter: Fix out of bounds exceptions
Fixes #3476

1) Arrays were not resized
2) There was a wrong index when rotating right

@benfry benfry closed this in #3477 Jul 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment