picrate 2.0.0.pre-java → 2.2.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.mvn/wrapper/MavenWrapperDownloader.java +1 -1
  4. data/.mvn/wrapper/maven-wrapper.properties +2 -2
  5. data/CHANGELOG.md +10 -0
  6. data/README.md +11 -9
  7. data/Rakefile +9 -8
  8. data/docs/_config.yml +1 -1
  9. data/docs/_editors/geany.md +1 -0
  10. data/docs/_gems/gems/gems.md +1 -1
  11. data/docs/_methods/alternative_methods.md +2 -1
  12. data/docs/_posts/2018-05-06-getting_started.md +4 -4
  13. data/docs/_posts/2018-05-06-install_jruby.md +5 -11
  14. data/docs/_posts/2018-05-11-arch-linux-arm.md +1 -11
  15. data/docs/_posts/2018-11-18-building-gem.md +4 -2
  16. data/docs/_posts/2018-11-27-getting_started_geany.md +1 -1
  17. data/docs/_posts/2019-11-11-getting_started_buster.md +4 -7
  18. data/docs/_posts/{2018-06-26-auto_install_picrate.md → 2020-03-09-auto_install_picrate.md} +9 -6
  19. data/docs/_posts/2020-05-11-getting_started_manjaro.md +106 -0
  20. data/docs/about.md +1 -1
  21. data/lib/picrate.rb +2 -1
  22. data/lib/picrate/app.rb +1 -0
  23. data/lib/picrate/helper_methods.rb +1 -1
  24. data/lib/picrate/native_folder.rb +6 -7
  25. data/lib/picrate/runner.rb +4 -4
  26. data/lib/picrate/version.rb +1 -1
  27. data/library/jcomplex/jcomplex.rb +1 -0
  28. data/mvnw +2 -2
  29. data/mvnw.cmd +2 -2
  30. data/picrate.gemspec +3 -5
  31. data/pom.rb +18 -15
  32. data/pom.xml +20 -8
  33. data/src/main/java/monkstone/complex/JComplex.java +252 -0
  34. data/src/main/java/processing/awt/PGraphicsJava2D.java +22 -23
  35. data/src/main/java/processing/awt/PImageAWT.java +377 -0
  36. data/src/main/java/processing/awt/ShimAWT.java +545 -0
  37. data/src/main/java/processing/core/PApplet.java +2030 -2556
  38. data/src/main/java/processing/core/PGraphics.java +138 -124
  39. data/src/main/java/processing/core/PImage.java +1517 -1702
  40. data/src/main/java/processing/core/PSurface.java +105 -139
  41. data/src/main/java/processing/core/PSurfaceNone.java +29 -0
  42. data/src/main/java/processing/opengl/PGL.java +649 -3699
  43. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +223 -184
  44. data/src/main/java/processing/opengl/PJOGL.java +374 -1526
  45. data/src/main/java/processing/opengl/PShapeOpenGL.java +5 -6
  46. data/src/main/java/processing/opengl/PSurfaceJOGL.java +220 -86
  47. data/vendors/Rakefile +33 -21
  48. data/vendors/{picrate_sketches.geany → geany.rb} +32 -7
  49. metadata +17 -48
  50. data/src/main/java/processing/opengl/shaders/LightVert-brcm.glsl +0 -154
  51. data/src/main/java/processing/opengl/shaders/LightVert-vc4.glsl +0 -154
  52. data/src/main/java/processing/opengl/shaders/TexLightVert-brcm.glsl +0 -160
  53. data/src/main/java/processing/opengl/shaders/TexLightVert-vc4.glsl +0 -160
@@ -47,13 +47,17 @@ public class PGraphicsOpenGL extends PGraphics {
47
47
  /** Font cache for texture objects. */
48
48
  protected WeakHashMap<PFont, FontTexture> fontMap;
49
49
 
50
+ // Blocking save
51
+ protected volatile Object saveBlocker;
52
+ private volatile Optional<String> saveTargetMaybe;
53
+
50
54
  // ........................................................
51
55
 
52
56
  // Disposal of native resources
53
57
  // Using the technique alternative to finalization described in:
54
58
  // http://www.oracle.com/technetwork/articles/java/finalization-137655.html
55
59
  private static final ReferenceQueue<Object> refQueue = new ReferenceQueue<>();
56
- private static final List<Disposable<? extends Object>> reachableWeakReferences =
60
+ private static final List<Disposable<?>> reachableWeakReferences =
57
61
  new LinkedList<>();
58
62
 
59
63
  static final private int MAX_DRAIN_GLRES_ITERATIONS = 10;
@@ -61,8 +65,8 @@ public class PGraphicsOpenGL extends PGraphics {
61
65
  static void drainRefQueueBounded() {
62
66
  int iterations = 0;
63
67
  while (iterations < MAX_DRAIN_GLRES_ITERATIONS) {
64
- Disposable<? extends Object> res =
65
- (Disposable<? extends Object>) refQueue.poll();
68
+ Disposable<?> res =
69
+ (Disposable<?>) refQueue.poll();
66
70
  if (res == null) {
67
71
  break;
68
72
  }
@@ -568,6 +572,9 @@ public class PGraphicsOpenGL extends PGraphics {
568
572
  public PGraphicsOpenGL() {
569
573
  pgl = createPGL(this);
570
574
 
575
+ saveTargetMaybe = Optional.empty();
576
+ saveBlocker = new Object();
577
+
571
578
  if (intBuffer == null) {
572
579
  intBuffer = PGL.allocateIntBuffer(2);
573
580
  floatBuffer = PGL.allocateFloatBuffer(2);
@@ -709,7 +716,7 @@ public class PGraphicsOpenGL extends PGraphics {
709
716
 
710
717
  // Factory method
711
718
  protected PGL createPGL(PGraphicsOpenGL pg) {
712
- return new PJOGL(pg);
719
+ return new PJOGL(pg, () -> { onRender(); });
713
720
  // return new PGLES(pg);
714
721
  }
715
722
 
@@ -751,22 +758,35 @@ public class PGraphicsOpenGL extends PGraphics {
751
758
  }
752
759
 
753
760
 
761
+ @Override
754
762
  public boolean saveImpl(String filename) {
755
763
  // return super.save(filename); // ASYNC save frame using PBOs not yet available on Android
756
764
 
757
765
  if (getHint(DISABLE_ASYNC_SAVEFRAME)) {
758
- // Act as an opaque surface for the purposes of saving.
759
- if (primaryGraphics) {
760
- int prevFormat = format;
761
- format = RGB;
762
- boolean result = super.save(filename);
763
- format = prevFormat;
764
- return result;
766
+ saveTargetMaybe = Optional.of(filename);
767
+
768
+ if (!drawing) {
769
+ beginDraw();
765
770
  }
771
+ flush();
772
+ updatePixelSize();
773
+ endDraw(); // Briefly stop drawing
766
774
 
767
- return super.save(filename);
775
+ synchronized(saveBlocker) {
776
+ try {
777
+ while (saveTargetMaybe.isPresent()) {
778
+ saveBlocker.wait();
779
+ }
780
+ beginDraw(); // Resume drawing
781
+ return true;
782
+ } catch (InterruptedException e) {
783
+ return false;
784
+ }
785
+ }
768
786
  }
769
787
 
788
+ boolean needEndDraw = false;
789
+
770
790
  if (asyncImageSaver == null) {
771
791
  asyncImageSaver = new AsyncImageSaver();
772
792
  }
@@ -780,7 +800,6 @@ public class PGraphicsOpenGL extends PGraphics {
780
800
  }
781
801
 
782
802
  if (asyncPixelReader != null && !loaded) {
783
- boolean needEndDraw = false;
784
803
  if (!drawing) {
785
804
  beginDraw();
786
805
  needEndDraw = true;
@@ -809,6 +828,21 @@ public class PGraphicsOpenGL extends PGraphics {
809
828
  }
810
829
 
811
830
 
831
+ private void onRender() {
832
+ if (saveTargetMaybe.isEmpty()) {
833
+ return; // Nothing to save
834
+ }
835
+
836
+ PImage outputImage = pgl.screenshot();
837
+ outputImage.save(saveTargetMaybe.get());
838
+ saveTargetMaybe = Optional.empty();
839
+
840
+ synchronized(saveBlocker) {
841
+ saveBlocker.notify();
842
+ }
843
+ }
844
+
845
+
812
846
  //////////////////////////////////////////////////////////////
813
847
 
814
848
  // IMAGE METADATA FOR THIS RENDERER
@@ -919,7 +953,7 @@ public class PGraphicsOpenGL extends PGraphics {
919
953
  int glId;
920
954
 
921
955
  private PGL pgl;
922
- private int context;
956
+ private final int context;
923
957
 
924
958
  public GLResourceVertexBuffer(VertexBuffer vbo) {
925
959
  super(vbo);
@@ -970,7 +1004,7 @@ public class PGraphicsOpenGL extends PGraphics {
970
1004
  int glFragment;
971
1005
 
972
1006
  private PGL pgl;
973
- private int context;
1007
+ private final int context;
974
1008
 
975
1009
  public GLResourceShader(PShader sh) {
976
1010
  super(sh);
@@ -1190,7 +1224,7 @@ public class PGraphicsOpenGL extends PGraphics {
1190
1224
  if (!polyBuffersCreated || polyBuffersContextIsOutdated()) {
1191
1225
  polyBuffersContext = pgl.getCurrentContext();
1192
1226
 
1193
- bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT);
1227
+ bufPolyVertex = new VertexBuffer(this, PGL.ARRAY_BUFFER, 4, PGL.SIZEOF_FLOAT);
1194
1228
  bufPolyColor = new VertexBuffer(this, PGL.ARRAY_BUFFER, 1, PGL.SIZEOF_INT);
1195
1229
  bufPolyNormal = new VertexBuffer(this, PGL.ARRAY_BUFFER, 3, PGL.SIZEOF_FLOAT);
1196
1230
  bufPolyTexcoord = new VertexBuffer(this, PGL.ARRAY_BUFFER, 2, PGL.SIZEOF_FLOAT);
@@ -2390,8 +2424,8 @@ public class PGraphicsOpenGL extends PGraphics {
2390
2424
 
2391
2425
  protected void flushPolys() {
2392
2426
  boolean customShader = polyShader != null;
2393
- boolean needNormals = customShader ? polyShader.accessNormals() : false;
2394
- boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false;
2427
+ boolean needNormals = customShader && polyShader.accessNormals();
2428
+ boolean needTexCoords = customShader && polyShader.accessTexCoords();
2395
2429
 
2396
2430
  updatePolyBuffers(lights, texCache.hasTextures, needNormals, needTexCoords);
2397
2431
 
@@ -2464,8 +2498,8 @@ public class PGraphicsOpenGL extends PGraphics {
2464
2498
 
2465
2499
  protected void flushSortedPolys() {
2466
2500
  boolean customShader = polyShader != null;
2467
- boolean needNormals = customShader ? polyShader.accessNormals() : false;
2468
- boolean needTexCoords = customShader ? polyShader.accessTexCoords() : false;
2501
+ boolean needNormals = customShader && polyShader.accessNormals();
2502
+ boolean needTexCoords = customShader && polyShader.accessTexCoords();
2469
2503
 
2470
2504
  sorter.sort(tessGeo);
2471
2505
 
@@ -3516,7 +3550,7 @@ public class PGraphicsOpenGL extends PGraphics {
3516
3550
 
3517
3551
 
3518
3552
  @Override
3519
- protected float textWidthImpl(char buffer[], int start, int stop) {
3553
+ protected float textWidthImpl(char[] buffer, int start, int stop) {
3520
3554
  if (textFont == null) defaultFontOrDeath("textWidth");
3521
3555
  Object font = textFont.getNative();
3522
3556
  float twidth = 0;
@@ -3541,7 +3575,7 @@ public class PGraphicsOpenGL extends PGraphics {
3541
3575
  * Implementation of actual drawing for a line of text.
3542
3576
  */
3543
3577
  @Override
3544
- protected void textLineImpl(char buffer[], int start, int stop,
3578
+ protected void textLineImpl(char[] buffer, int start, int stop,
3545
3579
  float x, float y) {
3546
3580
 
3547
3581
  if (textMode == SHAPE && textFont.getNative() == null) {
@@ -3685,7 +3719,7 @@ public class PGraphicsOpenGL extends PGraphics {
3685
3719
  PGL.FontOutline outline = pgl.createFontOutline(ch, textFont.getNative());
3686
3720
 
3687
3721
  // six element array received from the Java2D path iterator
3688
- float textPoints[] = new float[6];
3722
+ float[] textPoints = new float[6];
3689
3723
  float lastX = 0;
3690
3724
  float lastY = 0;
3691
3725
 
@@ -3803,6 +3837,13 @@ public class PGraphicsOpenGL extends PGraphics {
3803
3837
  }
3804
3838
 
3805
3839
 
3840
+ static protected void invTranslate(PMatrix2D matrix,
3841
+ float tx, float ty) {
3842
+ matrix.preApply(1, 0, -tx,
3843
+ 0, 1, -ty);
3844
+ }
3845
+
3846
+
3806
3847
  static protected float matrixScale(PMatrix matrix) {
3807
3848
  // Volumetric scaling factor that is associated to the given
3808
3849
  // transformation matrix, which is given by the absolute value of its
@@ -3888,8 +3929,8 @@ public class PGraphicsOpenGL extends PGraphics {
3888
3929
  }
3889
3930
 
3890
3931
 
3891
- static private void invRotate(PMatrix3D matrix, float angle,
3892
- float v0, float v1, float v2) {
3932
+ static protected void invRotate(PMatrix3D matrix, float angle,
3933
+ float v0, float v1, float v2) {
3893
3934
  float c = PApplet.cos(-angle);
3894
3935
  float s = PApplet.sin(-angle);
3895
3936
  float t = 1.0f - c;
@@ -3901,6 +3942,11 @@ public class PGraphicsOpenGL extends PGraphics {
3901
3942
  }
3902
3943
 
3903
3944
 
3945
+ static protected void invRotate(PMatrix2D matrix, float angle) {
3946
+ matrix.rotate(-angle);
3947
+ }
3948
+
3949
+
3904
3950
  /**
3905
3951
  * Same as scale(s, s, s).
3906
3952
  */
@@ -3942,6 +3988,11 @@ public class PGraphicsOpenGL extends PGraphics {
3942
3988
  }
3943
3989
 
3944
3990
 
3991
+ static protected void invScale(PMatrix2D matrix, float x, float y) {
3992
+ matrix.preApply(1/x, 0, 0, 1/y, 0, 0);
3993
+ }
3994
+
3995
+
3945
3996
  @Override
3946
3997
  public void shearX(float angle) {
3947
3998
  float t = (float) Math.tan(angle);
@@ -4580,6 +4631,8 @@ public class PGraphicsOpenGL extends PGraphics {
4580
4631
  * against) the current perspective matrix.
4581
4632
  * <P>
4582
4633
  * Implementation based on the explanation in the OpenGL blue book.
4634
+ * @param znear
4635
+ * @param zfar
4583
4636
  */
4584
4637
  @Override
4585
4638
  public void frustum(float left, float right, float bottom, float top,
@@ -5352,9 +5405,9 @@ public class PGraphicsOpenGL extends PGraphics {
5352
5405
  // showWarning() and showException() available from PGraphics.
5353
5406
 
5354
5407
  /**
5355
- * Report on anything from glError().Don't use this inside glBegin/glEnd
5356
- * otherwise it'll throw an GL_INVALID_OPERATION error.
5357
- * @param where
5408
+ * Report on anything from glError().
5409
+ * Don't use this inside glBegin/glEnd otherwise it'll
5410
+ * throw an GL_INVALID_OPERATION error.
5358
5411
  */
5359
5412
  protected void report(String where) {
5360
5413
  if (!hints[DISABLE_OPENGL_ERRORS]) {
@@ -6366,11 +6419,10 @@ public class PGraphicsOpenGL extends PGraphics {
6366
6419
 
6367
6420
 
6368
6421
  /**
6369
- * Not an approved function, this will change or be removed in the future.This
6370
- * utility method returns the texture associated to the renderer's. drawing
6371
- * surface, making sure is updated to reflect the current contents off the
6372
- * screen (or offscreen drawing surface).
6373
- * @return
6422
+ * Not an approved function, this will change or be removed in the future.
6423
+ * This utility method returns the texture associated to the renderer's.
6424
+ * drawing surface, making sure is updated to reflect the current contents
6425
+ * off the screen (or offscreen drawing surface).
6374
6426
  */
6375
6427
  public Texture getTexture() {
6376
6428
  return getTexture(true);
@@ -6379,8 +6431,6 @@ public class PGraphicsOpenGL extends PGraphics {
6379
6431
 
6380
6432
  /**
6381
6433
  * Not an approved function either, don't use it.
6382
- * @param load
6383
- * @return
6384
6434
  */
6385
6435
  public Texture getTexture(boolean load) {
6386
6436
  if (load) loadTexture();
@@ -6389,11 +6439,11 @@ public class PGraphicsOpenGL extends PGraphics {
6389
6439
 
6390
6440
 
6391
6441
  /**
6392
- * Not an approved function, this will change or be removed in the future.This utility method returns the texture associated to the image.
6442
+ * Not an approved function, this will change or be removed in the future.
6443
+ * This utility method returns the texture associated to the image.
6393
6444
  * creating and/or updating it if needed.
6394
6445
  *
6395
6446
  * @param img the image to have a texture metadata associated to it
6396
- * @return
6397
6447
  */
6398
6448
  public Texture getTexture(PImage img) {
6399
6449
  Texture tex = (Texture)initCache(img);
@@ -6419,7 +6469,6 @@ public class PGraphicsOpenGL extends PGraphics {
6419
6469
  /**
6420
6470
  * Not an approved function, test its use in libraries to grab the FB objects
6421
6471
  * for offscreen PGraphics.
6422
- * @return
6423
6472
  */
6424
6473
  public FrameBuffer getFrameBuffer() {
6425
6474
  return getFrameBuffer(false);
@@ -6444,9 +6493,16 @@ public class PGraphicsOpenGL extends PGraphics {
6444
6493
  if (tex == null || tex.contextIsOutdated()) {
6445
6494
  tex = addTexture(img);
6446
6495
  if (tex != null) {
6496
+ boolean dispose = img.pixels == null;
6447
6497
  img.loadPixels();
6448
6498
  tex.set(img.pixels, img.format);
6449
6499
  img.setModified();
6500
+ if (dispose) {
6501
+ // We only used the pixels to load the image into the texture and the user did not request
6502
+ // to load the pixels, so we should dispose the pixels array to avoid wasting memory
6503
+ img.pixels = null;
6504
+ img.loaded = false;
6505
+ }
6450
6506
  }
6451
6507
  }
6452
6508
  return tex;
@@ -6478,7 +6534,6 @@ public class PGraphicsOpenGL extends PGraphics {
6478
6534
  * This utility method creates a texture for the provided image, and adds it
6479
6535
  * to the metadata cache of the image.
6480
6536
  * @param img the image to have a texture metadata associated to it
6481
- * @return
6482
6537
  */
6483
6538
  protected Texture addTexture(PImage img) {
6484
6539
  Texture.Parameters params =
@@ -6830,6 +6885,9 @@ public class PGraphicsOpenGL extends PGraphics {
6830
6885
  } else {
6831
6886
  // offscreen surfaces are transparent by default.
6832
6887
  background((backgroundColor & 0xFFFFFF));
6888
+
6889
+ // Recreate offscreen FBOs
6890
+ restartPGL();
6833
6891
  }
6834
6892
 
6835
6893
  // Sets the default projection and camera (initializes modelview).
@@ -6915,30 +6973,16 @@ public class PGraphicsOpenGL extends PGraphics {
6915
6973
  maxTextureSize = intBuffer.get(0);
6916
6974
 
6917
6975
  // work around runtime exceptions in Broadcom's VC IV driver
6918
- if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) {
6919
- pgl.getIntegerv(PGL.MAX_SAMPLES, intBuffer);
6920
- maxSamples = intBuffer.get(0);
6921
- }
6976
+ // if (false == OPENGL_RENDERER.equals("VideoCore IV HW")) {
6977
+ pgl.getIntegerv(PGL.MAX_SAMPLES, intBuffer);
6978
+ maxSamples = intBuffer.get(0);
6979
+ // }
6922
6980
 
6923
6981
  if (anisoSamplingSupported) {
6924
6982
  pgl.getFloatv(PGL.MAX_TEXTURE_MAX_ANISOTROPY, floatBuffer);
6925
6983
  maxAnisoAmount = floatBuffer.get(0);
6926
6984
  }
6927
6985
 
6928
- // overwrite the default shaders with vendor specific versions
6929
- // if needed
6930
- if (OPENGL_RENDERER.equals("VideoCore IV HW")) { // Broadcom's binary driver for Raspberry Pi
6931
- defLightShaderVertURL =
6932
- PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-brcm.glsl");
6933
- defTexlightShaderVertURL =
6934
- PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/TexLightVert-brcm.glsl");
6935
- } else if (OPENGL_RENDERER.contains("VC4")) { // Mesa driver for same hardware
6936
- defLightShaderVertURL =
6937
- PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/LightVert-vc4.glsl");
6938
- defTexlightShaderVertURL =
6939
- PGraphicsOpenGL.class.getResource("/processing/opengl/shaders/TexLightVert-vc4.glsl");
6940
- }
6941
-
6942
6986
  glParamsRead = true;
6943
6987
  }
6944
6988
 
@@ -7943,61 +7987,61 @@ public class PGraphicsOpenGL extends PGraphics {
7943
7987
  // Expand arrays
7944
7988
 
7945
7989
  void expandVertices(int n) {
7946
- float temp[] = new float[3 * n];
7990
+ float[] temp = new float[3 * n];
7947
7991
  PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
7948
7992
  vertices = temp;
7949
7993
  }
7950
7994
 
7951
7995
  void expandColors(int n) {
7952
- int temp[] = new int[n];
7996
+ int[] temp = new int[n];
7953
7997
  PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
7954
7998
  colors = temp;
7955
7999
  }
7956
8000
 
7957
8001
  void expandNormals(int n) {
7958
- float temp[] = new float[3 * n];
8002
+ float[] temp = new float[3 * n];
7959
8003
  PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
7960
8004
  normals = temp;
7961
8005
  }
7962
8006
 
7963
8007
  void expandTexCoords(int n) {
7964
- float temp[] = new float[2 * n];
8008
+ float[] temp = new float[2 * n];
7965
8009
  PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
7966
8010
  texcoords = temp;
7967
8011
  }
7968
8012
 
7969
8013
  void expandStrokeColors(int n) {
7970
- int temp[] = new int[n];
8014
+ int[] temp = new int[n];
7971
8015
  PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
7972
8016
  strokeColors = temp;
7973
8017
  }
7974
8018
 
7975
8019
  void expandStrokeWeights(int n) {
7976
- float temp[] = new float[n];
8020
+ float[] temp = new float[n];
7977
8021
  PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
7978
8022
  strokeWeights = temp;
7979
8023
  }
7980
8024
 
7981
8025
  void expandAmbient(int n) {
7982
- int temp[] = new int[n];
8026
+ int[] temp = new int[n];
7983
8027
  PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
7984
8028
  ambient = temp;
7985
8029
  }
7986
8030
 
7987
8031
  void expandSpecular(int n) {
7988
- int temp[] = new int[n];
8032
+ int[] temp = new int[n];
7989
8033
  PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
7990
8034
  specular = temp;
7991
8035
  }
7992
8036
 
7993
8037
  void expandEmissive(int n) {
7994
- int temp[] = new int[n];
8038
+ int[] temp = new int[n];
7995
8039
  PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
7996
8040
  emissive = temp;
7997
8041
  }
7998
8042
 
7999
8043
  void expandShininess(int n) {
8000
- float temp[] = new float[n];
8044
+ float[] temp = new float[n];
8001
8045
  PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
8002
8046
  shininess = temp;
8003
8047
  }
@@ -8016,33 +8060,33 @@ public class PGraphicsOpenGL extends PGraphics {
8016
8060
 
8017
8061
  void expandFloatAttrib(VertexAttribute attrib, int n) {
8018
8062
  float[] values = fattribs.get(attrib.name);
8019
- float temp[] = new float[attrib.size * n];
8063
+ float[] temp = new float[attrib.size * n];
8020
8064
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8021
8065
  fattribs.put(attrib.name, temp);
8022
8066
  }
8023
8067
 
8024
8068
  void expandIntAttrib(VertexAttribute attrib, int n) {
8025
8069
  int[] values = iattribs.get(attrib.name);
8026
- int temp[] = new int[attrib.size * n];
8070
+ int[] temp = new int[attrib.size * n];
8027
8071
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8028
8072
  iattribs.put(attrib.name, temp);
8029
8073
  }
8030
8074
 
8031
8075
  void expandBoolAttrib(VertexAttribute attrib, int n) {
8032
8076
  byte[] values = battribs.get(attrib.name);
8033
- byte temp[] = new byte[attrib.size * n];
8077
+ byte[] temp = new byte[attrib.size * n];
8034
8078
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8035
8079
  battribs.put(attrib.name, temp);
8036
8080
  }
8037
8081
 
8038
8082
  void expandCodes(int n) {
8039
- int temp[] = new int[n];
8083
+ int[] temp = new int[n];
8040
8084
  PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
8041
8085
  codes = temp;
8042
8086
  }
8043
8087
 
8044
8088
  void expandEdges(int n) {
8045
- int temp[][] = new int[n][3];
8089
+ int[][] temp = new int[n][3];
8046
8090
  PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
8047
8091
  edges = temp;
8048
8092
  }
@@ -8076,73 +8120,73 @@ public class PGraphicsOpenGL extends PGraphics {
8076
8120
  }
8077
8121
 
8078
8122
  void trimVertices() {
8079
- float temp[] = new float[3 * vertexCount];
8123
+ float[] temp = new float[3 * vertexCount];
8080
8124
  PApplet.arrayCopy(vertices, 0, temp, 0, 3 * vertexCount);
8081
8125
  vertices = temp;
8082
8126
  }
8083
8127
 
8084
8128
  void trimColors() {
8085
- int temp[] = new int[vertexCount];
8129
+ int[] temp = new int[vertexCount];
8086
8130
  PApplet.arrayCopy(colors, 0, temp, 0, vertexCount);
8087
8131
  colors = temp;
8088
8132
  }
8089
8133
 
8090
8134
  void trimNormals() {
8091
- float temp[] = new float[3 * vertexCount];
8135
+ float[] temp = new float[3 * vertexCount];
8092
8136
  PApplet.arrayCopy(normals, 0, temp, 0, 3 * vertexCount);
8093
8137
  normals = temp;
8094
8138
  }
8095
8139
 
8096
8140
  void trimTexCoords() {
8097
- float temp[] = new float[2 * vertexCount];
8141
+ float[] temp = new float[2 * vertexCount];
8098
8142
  PApplet.arrayCopy(texcoords, 0, temp, 0, 2 * vertexCount);
8099
8143
  texcoords = temp;
8100
8144
  }
8101
8145
 
8102
8146
  void trimStrokeColors() {
8103
- int temp[] = new int[vertexCount];
8147
+ int[] temp = new int[vertexCount];
8104
8148
  PApplet.arrayCopy(strokeColors, 0, temp, 0, vertexCount);
8105
8149
  strokeColors = temp;
8106
8150
  }
8107
8151
 
8108
8152
  void trimStrokeWeights() {
8109
- float temp[] = new float[vertexCount];
8153
+ float[] temp = new float[vertexCount];
8110
8154
  PApplet.arrayCopy(strokeWeights, 0, temp, 0, vertexCount);
8111
8155
  strokeWeights = temp;
8112
8156
  }
8113
8157
 
8114
8158
  void trimAmbient() {
8115
- int temp[] = new int[vertexCount];
8159
+ int[] temp = new int[vertexCount];
8116
8160
  PApplet.arrayCopy(ambient, 0, temp, 0, vertexCount);
8117
8161
  ambient = temp;
8118
8162
  }
8119
8163
 
8120
8164
  void trimSpecular() {
8121
- int temp[] = new int[vertexCount];
8165
+ int[] temp = new int[vertexCount];
8122
8166
  PApplet.arrayCopy(specular, 0, temp, 0, vertexCount);
8123
8167
  specular = temp;
8124
8168
  }
8125
8169
 
8126
8170
  void trimEmissive() {
8127
- int temp[] = new int[vertexCount];
8171
+ int[] temp = new int[vertexCount];
8128
8172
  PApplet.arrayCopy(emissive, 0, temp, 0, vertexCount);
8129
8173
  emissive = temp;
8130
8174
  }
8131
8175
 
8132
8176
  void trimShininess() {
8133
- float temp[] = new float[vertexCount];
8177
+ float[] temp = new float[vertexCount];
8134
8178
  PApplet.arrayCopy(shininess, 0, temp, 0, vertexCount);
8135
8179
  shininess = temp;
8136
8180
  }
8137
8181
 
8138
8182
  void trimCodes() {
8139
- int temp[] = new int[codeCount];
8183
+ int[] temp = new int[codeCount];
8140
8184
  PApplet.arrayCopy(codes, 0, temp, 0, codeCount);
8141
8185
  codes = temp;
8142
8186
  }
8143
8187
 
8144
8188
  void trimEdges() {
8145
- int temp[][] = new int[edgeCount][3];
8189
+ int[][] temp = new int[edgeCount][3];
8146
8190
  PApplet.arrayCopy(edges, 0, temp, 0, edgeCount);
8147
8191
  edges = temp;
8148
8192
  }
@@ -8161,21 +8205,21 @@ public class PGraphicsOpenGL extends PGraphics {
8161
8205
 
8162
8206
  void trimFloatAttrib(VertexAttribute attrib) {
8163
8207
  float[] values = fattribs.get(attrib.name);
8164
- float temp[] = new float[attrib.size * vertexCount];
8208
+ float[] temp = new float[attrib.size * vertexCount];
8165
8209
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8166
8210
  fattribs.put(attrib.name, temp);
8167
8211
  }
8168
8212
 
8169
8213
  void trimIntAttrib(VertexAttribute attrib) {
8170
8214
  int[] values = iattribs.get(attrib.name);
8171
- int temp[] = new int[attrib.size * vertexCount];
8215
+ int[] temp = new int[attrib.size * vertexCount];
8172
8216
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8173
8217
  iattribs.put(attrib.name, temp);
8174
8218
  }
8175
8219
 
8176
8220
  void trimBoolAttrib(VertexAttribute attrib) {
8177
8221
  byte[] values = battribs.get(attrib.name);
8178
- byte temp[] = new byte[attrib.size * vertexCount];
8222
+ byte[] temp = new byte[attrib.size * vertexCount];
8179
8223
  PApplet.arrayCopy(values, 0, temp, 0, attrib.size * vertexCount);
8180
8224
  battribs.put(attrib.name, temp);
8181
8225
  }
@@ -8394,7 +8438,7 @@ public class PGraphicsOpenGL extends PGraphics {
8394
8438
 
8395
8439
  vert[SR] = ((strokeColors[i] >> 16) & 0xFF) / 255.0f;
8396
8440
  vert[SG] = ((strokeColors[i] >> 8) & 0xFF) / 255.0f;
8397
- vert[SB] = ((strokeColors[i]) & 0xFF) / 255.0f;
8441
+ vert[SB] = ((strokeColors[i] >> 0) & 0xFF) / 255.0f;
8398
8442
  vert[SA] = ((strokeColors[i] >> 24) & 0xFF) / 255.0f;
8399
8443
 
8400
8444
  vert[SW] = strokeWeights[i];
@@ -8797,8 +8841,8 @@ public class PGraphicsOpenGL extends PGraphics {
8797
8841
  idx0 = pidx = idx = 0;
8798
8842
  float val = 0;
8799
8843
  for (int i = 0; i < accuracy; i++) {
8800
- idx = addVertex(centerX + COS_LUT[(int) val] * radiusH,
8801
- centerY + SIN_LUT[(int) val] * radiusV,
8844
+ idx = addVertex(centerX + cosLUT[(int) val] * radiusH,
8845
+ centerY + sinLUT[(int) val] * radiusV,
8802
8846
  VERTEX, i == 0 && !fill);
8803
8847
  val = (val + inc) % SINCOS_LENGTH;
8804
8848
 
@@ -8811,8 +8855,8 @@ public class PGraphicsOpenGL extends PGraphics {
8811
8855
  pidx = idx;
8812
8856
  }
8813
8857
  // Back to the beginning
8814
- addVertex(centerX + COS_LUT[0] * radiusH,
8815
- centerY + SIN_LUT[0] * radiusV,
8858
+ addVertex(centerX + cosLUT[0] * radiusH,
8859
+ centerY + sinLUT[0] * radiusV,
8816
8860
  VERTEX, false);
8817
8861
  if (stroke) {
8818
8862
  addEdge(idx, idx0, false, false);
@@ -8857,8 +8901,8 @@ public class PGraphicsOpenGL extends PGraphics {
8857
8901
  if (arcMode == CHORD || arcMode == OPEN) {
8858
8902
  // move center to the middle of flat side
8859
8903
  // to properly display arcs smaller than PI
8860
- float relX = (COS_LUT[startLUT] + COS_LUT[stopLUT]) * 0.5f * hr;
8861
- float relY = (SIN_LUT[startLUT] + SIN_LUT[stopLUT]) * 0.5f * vr;
8904
+ float relX = (cosLUT[startLUT] + cosLUT[stopLUT]) * 0.5f * hr;
8905
+ float relY = (sinLUT[startLUT] + sinLUT[stopLUT]) * 0.5f * vr;
8862
8906
  idx0 = addVertex(centerX + relX, centerY + relY, VERTEX, true);
8863
8907
  } else {
8864
8908
  idx0 = addVertex(centerX, centerY, VERTEX, true);
@@ -8895,8 +8939,8 @@ public class PGraphicsOpenGL extends PGraphics {
8895
8939
  if (ii >= SINCOS_LENGTH) ii -= SINCOS_LENGTH;
8896
8940
 
8897
8941
  pidx = idx;
8898
- idx = addVertex(centerX + COS_LUT[ii] * hr,
8899
- centerY + SIN_LUT[ii] * vr,
8942
+ idx = addVertex(centerX + cosLUT[ii] * hr,
8943
+ centerY + sinLUT[ii] * vr,
8900
8944
  VERTEX, i == 0 && !fill);
8901
8945
 
8902
8946
  if (stroke) {
@@ -9250,7 +9294,7 @@ public class PGraphicsOpenGL extends PGraphics {
9250
9294
  //
9251
9295
  // Allocate/dispose
9252
9296
 
9253
- final void allocate() {
9297
+ void allocate() {
9254
9298
  polyVertices = new float[4 * PGL.DEFAULT_TESS_VERTICES];
9255
9299
  polyColors = new int[PGL.DEFAULT_TESS_VERTICES];
9256
9300
  polyNormals = new float[3 * PGL.DEFAULT_TESS_VERTICES];
@@ -9717,56 +9761,56 @@ public class PGraphicsOpenGL extends PGraphics {
9717
9761
  // Expand arrays
9718
9762
 
9719
9763
  void expandPolyVertices(int n) {
9720
- float temp[] = new float[4 * n];
9764
+ float[] temp = new float[4 * n];
9721
9765
  PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
9722
9766
  polyVertices = temp;
9723
9767
  polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
9724
9768
  }
9725
9769
 
9726
9770
  void expandPolyColors(int n) {
9727
- int temp[] = new int[n];
9771
+ int[] temp = new int[n];
9728
9772
  PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
9729
9773
  polyColors = temp;
9730
9774
  polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
9731
9775
  }
9732
9776
 
9733
9777
  void expandPolyNormals(int n) {
9734
- float temp[] = new float[3 * n];
9778
+ float[] temp = new float[3 * n];
9735
9779
  PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
9736
9780
  polyNormals = temp;
9737
9781
  polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
9738
9782
  }
9739
9783
 
9740
9784
  void expandPolyTexCoords(int n) {
9741
- float temp[] = new float[2 * n];
9785
+ float[] temp = new float[2 * n];
9742
9786
  PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
9743
9787
  polyTexCoords = temp;
9744
9788
  polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
9745
9789
  }
9746
9790
 
9747
9791
  void expandPolyAmbient(int n) {
9748
- int temp[] = new int[n];
9792
+ int[] temp = new int[n];
9749
9793
  PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
9750
9794
  polyAmbient = temp;
9751
9795
  polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
9752
9796
  }
9753
9797
 
9754
9798
  void expandPolySpecular(int n) {
9755
- int temp[] = new int[n];
9799
+ int[] temp = new int[n];
9756
9800
  PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
9757
9801
  polySpecular = temp;
9758
9802
  polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
9759
9803
  }
9760
9804
 
9761
9805
  void expandPolyEmissive(int n) {
9762
- int temp[] = new int[n];
9806
+ int[] temp = new int[n];
9763
9807
  PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
9764
9808
  polyEmissive = temp;
9765
9809
  polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
9766
9810
  }
9767
9811
 
9768
9812
  void expandPolyShininess(int n) {
9769
- float temp[] = new float[n];
9813
+ float[] temp = new float[n];
9770
9814
  PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
9771
9815
  polyShininess = temp;
9772
9816
  polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
@@ -9786,7 +9830,7 @@ public class PGraphicsOpenGL extends PGraphics {
9786
9830
 
9787
9831
  void expandFloatAttribute(VertexAttribute attrib, int n) {
9788
9832
  float[] array = fpolyAttribs.get(attrib.name);
9789
- float temp[] = new float[attrib.tessSize * n];
9833
+ float[] temp = new float[attrib.tessSize * n];
9790
9834
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
9791
9835
  fpolyAttribs.put(attrib.name, temp);
9792
9836
  polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
@@ -9794,7 +9838,7 @@ public class PGraphicsOpenGL extends PGraphics {
9794
9838
 
9795
9839
  void expandIntAttribute(VertexAttribute attrib, int n) {
9796
9840
  int[] array = ipolyAttribs.get(attrib.name);
9797
- int temp[] = new int[attrib.tessSize * n];
9841
+ int[] temp = new int[attrib.tessSize * n];
9798
9842
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
9799
9843
  ipolyAttribs.put(attrib.name, temp);
9800
9844
  polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
@@ -9802,70 +9846,70 @@ public class PGraphicsOpenGL extends PGraphics {
9802
9846
 
9803
9847
  void expandBoolAttribute(VertexAttribute attrib, int n) {
9804
9848
  byte[] array = bpolyAttribs.get(attrib.name);
9805
- byte temp[] = new byte[attrib.tessSize * n];
9849
+ byte[] temp = new byte[attrib.tessSize * n];
9806
9850
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
9807
9851
  bpolyAttribs.put(attrib.name, temp);
9808
9852
  polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
9809
9853
  }
9810
9854
 
9811
9855
  void expandPolyIndices(int n) {
9812
- short temp[] = new short[n];
9856
+ short[] temp = new short[n];
9813
9857
  PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
9814
9858
  polyIndices = temp;
9815
9859
  polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
9816
9860
  }
9817
9861
 
9818
9862
  void expandLineVertices(int n) {
9819
- float temp[] = new float[4 * n];
9863
+ float[] temp = new float[4 * n];
9820
9864
  PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
9821
9865
  lineVertices = temp;
9822
9866
  lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
9823
9867
  }
9824
9868
 
9825
9869
  void expandLineColors(int n) {
9826
- int temp[] = new int[n];
9870
+ int[] temp = new int[n];
9827
9871
  PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
9828
9872
  lineColors = temp;
9829
9873
  lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
9830
9874
  }
9831
9875
 
9832
9876
  void expandLineDirections(int n) {
9833
- float temp[] = new float[4 * n];
9877
+ float[] temp = new float[4 * n];
9834
9878
  PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
9835
9879
  lineDirections = temp;
9836
9880
  lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
9837
9881
  }
9838
9882
 
9839
9883
  void expandLineIndices(int n) {
9840
- short temp[] = new short[n];
9884
+ short[] temp = new short[n];
9841
9885
  PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
9842
9886
  lineIndices = temp;
9843
9887
  lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
9844
9888
  }
9845
9889
 
9846
9890
  void expandPointVertices(int n) {
9847
- float temp[] = new float[4 * n];
9891
+ float[] temp = new float[4 * n];
9848
9892
  PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
9849
9893
  pointVertices = temp;
9850
9894
  pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
9851
9895
  }
9852
9896
 
9853
9897
  void expandPointColors(int n) {
9854
- int temp[] = new int[n];
9898
+ int[] temp = new int[n];
9855
9899
  PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
9856
9900
  pointColors = temp;
9857
9901
  pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
9858
9902
  }
9859
9903
 
9860
9904
  void expandPointOffsets(int n) {
9861
- float temp[] = new float[2 * n];
9905
+ float[] temp = new float[2 * n];
9862
9906
  PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
9863
9907
  pointOffsets = temp;
9864
9908
  pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
9865
9909
  }
9866
9910
 
9867
9911
  void expandPointIndices(int n) {
9868
- short temp[] = new short[n];
9912
+ short[] temp = new short[n];
9869
9913
  PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
9870
9914
  pointIndices = temp;
9871
9915
  pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
@@ -9914,56 +9958,56 @@ public class PGraphicsOpenGL extends PGraphics {
9914
9958
  }
9915
9959
 
9916
9960
  void trimPolyVertices() {
9917
- float temp[] = new float[4 * polyVertexCount];
9961
+ float[] temp = new float[4 * polyVertexCount];
9918
9962
  PApplet.arrayCopy(polyVertices, 0, temp, 0, 4 * polyVertexCount);
9919
9963
  polyVertices = temp;
9920
9964
  polyVerticesBuffer = PGL.allocateFloatBuffer(polyVertices);
9921
9965
  }
9922
9966
 
9923
9967
  void trimPolyColors() {
9924
- int temp[] = new int[polyVertexCount];
9968
+ int[] temp = new int[polyVertexCount];
9925
9969
  PApplet.arrayCopy(polyColors, 0, temp, 0, polyVertexCount);
9926
9970
  polyColors = temp;
9927
9971
  polyColorsBuffer = PGL.allocateIntBuffer(polyColors);
9928
9972
  }
9929
9973
 
9930
9974
  void trimPolyNormals() {
9931
- float temp[] = new float[3 * polyVertexCount];
9975
+ float[] temp = new float[3 * polyVertexCount];
9932
9976
  PApplet.arrayCopy(polyNormals, 0, temp, 0, 3 * polyVertexCount);
9933
9977
  polyNormals = temp;
9934
9978
  polyNormalsBuffer = PGL.allocateFloatBuffer(polyNormals);
9935
9979
  }
9936
9980
 
9937
9981
  void trimPolyTexCoords() {
9938
- float temp[] = new float[2 * polyVertexCount];
9982
+ float[] temp = new float[2 * polyVertexCount];
9939
9983
  PApplet.arrayCopy(polyTexCoords, 0, temp, 0, 2 * polyVertexCount);
9940
9984
  polyTexCoords = temp;
9941
9985
  polyTexCoordsBuffer = PGL.allocateFloatBuffer(polyTexCoords);
9942
9986
  }
9943
9987
 
9944
9988
  void trimPolyAmbient() {
9945
- int temp[] = new int[polyVertexCount];
9989
+ int[] temp = new int[polyVertexCount];
9946
9990
  PApplet.arrayCopy(polyAmbient, 0, temp, 0, polyVertexCount);
9947
9991
  polyAmbient = temp;
9948
9992
  polyAmbientBuffer = PGL.allocateIntBuffer(polyAmbient);
9949
9993
  }
9950
9994
 
9951
9995
  void trimPolySpecular() {
9952
- int temp[] = new int[polyVertexCount];
9996
+ int[] temp = new int[polyVertexCount];
9953
9997
  PApplet.arrayCopy(polySpecular, 0, temp, 0, polyVertexCount);
9954
9998
  polySpecular = temp;
9955
9999
  polySpecularBuffer = PGL.allocateIntBuffer(polySpecular);
9956
10000
  }
9957
10001
 
9958
10002
  void trimPolyEmissive() {
9959
- int temp[] = new int[polyVertexCount];
10003
+ int[] temp = new int[polyVertexCount];
9960
10004
  PApplet.arrayCopy(polyEmissive, 0, temp, 0, polyVertexCount);
9961
10005
  polyEmissive = temp;
9962
10006
  polyEmissiveBuffer = PGL.allocateIntBuffer(polyEmissive);
9963
10007
  }
9964
10008
 
9965
10009
  void trimPolyShininess() {
9966
- float temp[] = new float[polyVertexCount];
10010
+ float[] temp = new float[polyVertexCount];
9967
10011
  PApplet.arrayCopy(polyShininess, 0, temp, 0, polyVertexCount);
9968
10012
  polyShininess = temp;
9969
10013
  polyShininessBuffer = PGL.allocateFloatBuffer(polyShininess);
@@ -9983,7 +10027,7 @@ public class PGraphicsOpenGL extends PGraphics {
9983
10027
 
9984
10028
  void trimFloatAttribute(VertexAttribute attrib) {
9985
10029
  float[] array = fpolyAttribs.get(attrib.name);
9986
- float temp[] = new float[attrib.tessSize * polyVertexCount];
10030
+ float[] temp = new float[attrib.tessSize * polyVertexCount];
9987
10031
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
9988
10032
  fpolyAttribs.put(attrib.name, temp);
9989
10033
  polyAttribBuffers.put(attrib.name, PGL.allocateFloatBuffer(temp));
@@ -9991,7 +10035,7 @@ public class PGraphicsOpenGL extends PGraphics {
9991
10035
 
9992
10036
  void trimIntAttribute(VertexAttribute attrib) {
9993
10037
  int[] array = ipolyAttribs.get(attrib.name);
9994
- int temp[] = new int[attrib.tessSize * polyVertexCount];
10038
+ int[] temp = new int[attrib.tessSize * polyVertexCount];
9995
10039
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
9996
10040
  ipolyAttribs.put(attrib.name, temp);
9997
10041
  polyAttribBuffers.put(attrib.name, PGL.allocateIntBuffer(temp));
@@ -9999,70 +10043,70 @@ public class PGraphicsOpenGL extends PGraphics {
9999
10043
 
10000
10044
  void trimBoolAttribute(VertexAttribute attrib) {
10001
10045
  byte[] array = bpolyAttribs.get(attrib.name);
10002
- byte temp[] = new byte[attrib.tessSize * polyVertexCount];
10046
+ byte[] temp = new byte[attrib.tessSize * polyVertexCount];
10003
10047
  PApplet.arrayCopy(array, 0, temp, 0, attrib.tessSize * polyVertexCount);
10004
10048
  bpolyAttribs.put(attrib.name, temp);
10005
10049
  polyAttribBuffers.put(attrib.name, PGL.allocateByteBuffer(temp));
10006
10050
  }
10007
10051
 
10008
10052
  void trimPolyIndices() {
10009
- short temp[] = new short[polyIndexCount];
10053
+ short[] temp = new short[polyIndexCount];
10010
10054
  PApplet.arrayCopy(polyIndices, 0, temp, 0, polyIndexCount);
10011
10055
  polyIndices = temp;
10012
10056
  polyIndicesBuffer = PGL.allocateShortBuffer(polyIndices);
10013
10057
  }
10014
10058
 
10015
10059
  void trimLineVertices() {
10016
- float temp[] = new float[4 * lineVertexCount];
10060
+ float[] temp = new float[4 * lineVertexCount];
10017
10061
  PApplet.arrayCopy(lineVertices, 0, temp, 0, 4 * lineVertexCount);
10018
10062
  lineVertices = temp;
10019
10063
  lineVerticesBuffer = PGL.allocateFloatBuffer(lineVertices);
10020
10064
  }
10021
10065
 
10022
10066
  void trimLineColors() {
10023
- int temp[] = new int[lineVertexCount];
10067
+ int[] temp = new int[lineVertexCount];
10024
10068
  PApplet.arrayCopy(lineColors, 0, temp, 0, lineVertexCount);
10025
10069
  lineColors = temp;
10026
10070
  lineColorsBuffer = PGL.allocateIntBuffer(lineColors);
10027
10071
  }
10028
10072
 
10029
10073
  void trimLineDirections() {
10030
- float temp[] = new float[4 * lineVertexCount];
10074
+ float[] temp = new float[4 * lineVertexCount];
10031
10075
  PApplet.arrayCopy(lineDirections, 0, temp, 0, 4 * lineVertexCount);
10032
10076
  lineDirections = temp;
10033
10077
  lineDirectionsBuffer = PGL.allocateFloatBuffer(lineDirections);
10034
10078
  }
10035
10079
 
10036
10080
  void trimLineIndices() {
10037
- short temp[] = new short[lineIndexCount];
10081
+ short[] temp = new short[lineIndexCount];
10038
10082
  PApplet.arrayCopy(lineIndices, 0, temp, 0, lineIndexCount);
10039
10083
  lineIndices = temp;
10040
10084
  lineIndicesBuffer = PGL.allocateShortBuffer(lineIndices);
10041
10085
  }
10042
10086
 
10043
10087
  void trimPointVertices() {
10044
- float temp[] = new float[4 * pointVertexCount];
10088
+ float[] temp = new float[4 * pointVertexCount];
10045
10089
  PApplet.arrayCopy(pointVertices, 0, temp, 0, 4 * pointVertexCount);
10046
10090
  pointVertices = temp;
10047
10091
  pointVerticesBuffer = PGL.allocateFloatBuffer(pointVertices);
10048
10092
  }
10049
10093
 
10050
10094
  void trimPointColors() {
10051
- int temp[] = new int[pointVertexCount];
10095
+ int[] temp = new int[pointVertexCount];
10052
10096
  PApplet.arrayCopy(pointColors, 0, temp, 0, pointVertexCount);
10053
10097
  pointColors = temp;
10054
10098
  pointColorsBuffer = PGL.allocateIntBuffer(pointColors);
10055
10099
  }
10056
10100
 
10057
10101
  void trimPointOffsets() {
10058
- float temp[] = new float[2 * pointVertexCount];
10102
+ float[] temp = new float[2 * pointVertexCount];
10059
10103
  PApplet.arrayCopy(pointOffsets, 0, temp, 0, 2 * pointVertexCount);
10060
10104
  pointOffsets = temp;
10061
10105
  pointOffsetsBuffer = PGL.allocateFloatBuffer(pointOffsets);
10062
10106
  }
10063
10107
 
10064
10108
  void trimPointIndices() {
10065
- short temp[] = new short[pointIndexCount];
10109
+ short[] temp = new short[pointIndexCount];
10066
10110
  PApplet.arrayCopy(pointIndices, 0, temp, 0, pointIndexCount);
10067
10111
  pointIndices = temp;
10068
10112
  pointIndicesBuffer = PGL.allocateShortBuffer(pointIndices);
@@ -10616,28 +10660,26 @@ public class PGraphicsOpenGL extends PGraphics {
10616
10660
  polyVertices, 4 * tessIdx, 3);
10617
10661
  polyVertices[4 * tessIdx + 3] = 1;
10618
10662
 
10619
- polyAttribs.keySet().forEach((name) -> {
10663
+ for (String name: polyAttribs.keySet()) {
10620
10664
  VertexAttribute attrib = polyAttribs.get(name);
10621
- if (!(!attrib.isPosition())) {
10622
- float[] inValues = in.fattribs.get(name);
10623
- float[] tessValues = fpolyAttribs.get(name);
10624
- PApplet.arrayCopy(inValues, 3 * inIdx,
10625
- tessValues, 4 * tessIdx, 3);
10626
- tessValues[4 * tessIdx + 3] = 1;
10627
- }
10628
- });
10665
+ if (!attrib.isPosition()) continue;
10666
+ float[] inValues = in.fattribs.get(name);
10667
+ float[] tessValues = fpolyAttribs.get(name);
10668
+ PApplet.arrayCopy(inValues, 3 * inIdx,
10669
+ tessValues, 4 * tessIdx, 3);
10670
+ tessValues[4 * tessIdx + 3] = 1;
10671
+ }
10629
10672
  }
10630
10673
  PApplet.arrayCopy(in.normals, 3 * i0,
10631
10674
  polyNormals, 3 * firstPolyVertex, 3 * nvert);
10632
- polyAttribs.keySet().forEach((name) -> {
10675
+ for (String name: polyAttribs.keySet()) {
10633
10676
  VertexAttribute attrib = polyAttribs.get(name);
10634
- if (!(!attrib.isNormal())) {
10635
- float[] inValues = in.fattribs.get(name);
10636
- float[] tessValues = fpolyAttribs.get(name);
10637
- PApplet.arrayCopy(inValues, 3 * i0,
10638
- tessValues, 3 * firstPolyVertex, 3 * nvert);
10639
- }
10640
- });
10677
+ if (!attrib.isNormal()) continue;
10678
+ float[] inValues = in.fattribs.get(name);
10679
+ float[] tessValues = fpolyAttribs.get(name);
10680
+ PApplet.arrayCopy(inValues, 3 * i0,
10681
+ tessValues, 3 * firstPolyVertex, 3 * nvert);
10682
+ }
10641
10683
  }
10642
10684
 
10643
10685
  // Just copy attributes one by one.
@@ -11176,9 +11218,9 @@ public class PGraphicsOpenGL extends PGraphics {
11176
11218
  float inc = (float) SINCOS_LENGTH / perim;
11177
11219
  for (int k = 0; k < perim; k++) {
11178
11220
  tess.pointOffsets[2 * attribIdx + 0] =
11179
- 0.5f * COS_LUT[(int) val] * transformScale() * strokeWeight;
11221
+ 0.5f * cosLUT[(int) val] * transformScale() * strokeWeight;
11180
11222
  tess.pointOffsets[2 * attribIdx + 1] =
11181
- 0.5f * SIN_LUT[(int) val] * transformScale() * strokeWeight;
11223
+ 0.5f * sinLUT[(int) val] * transformScale() * strokeWeight;
11182
11224
  val = (val + inc) % SINCOS_LENGTH;
11183
11225
  attribIdx++;
11184
11226
  }
@@ -11228,8 +11270,8 @@ public class PGraphicsOpenGL extends PGraphics {
11228
11270
  vertIdx++;
11229
11271
  for (int k = 0; k < perim; k++) {
11230
11272
  tess.setPolyVertex(vertIdx,
11231
- x0 + 0.5f * COS_LUT[(int) val] * strokeWeight,
11232
- y0 + 0.5f * SIN_LUT[(int) val] * strokeWeight,
11273
+ x0 + 0.5f * cosLUT[(int) val] * strokeWeight,
11274
+ y0 + 0.5f * sinLUT[(int) val] * strokeWeight,
11233
11275
  0, rgba, false);
11234
11276
  vertIdx++;
11235
11277
  val = (val + inc) % SINCOS_LENGTH;
@@ -12492,7 +12534,7 @@ public class PGraphicsOpenGL extends PGraphics {
12492
12534
  if (dupIndices.length == dupCount) {
12493
12535
  int n = dupCount << 1;
12494
12536
 
12495
- int temp[] = new int[n];
12537
+ int[] temp = new int[n];
12496
12538
  PApplet.arrayCopy(dupIndices, 0, temp, 0, dupCount);
12497
12539
  dupIndices = temp;
12498
12540
  }
@@ -12539,7 +12581,7 @@ public class PGraphicsOpenGL extends PGraphics {
12539
12581
  }
12540
12582
 
12541
12583
  void expandRawIndices(int n) {
12542
- int temp[] = new int[n];
12584
+ int[] temp = new int[n];
12543
12585
  PApplet.arrayCopy(rawIndices, 0, temp, 0, rawSize);
12544
12586
  rawIndices = temp;
12545
12587
  }
@@ -12642,23 +12684,18 @@ public class PGraphicsOpenGL extends PGraphics {
12642
12684
  }
12643
12685
  }
12644
12686
 
12645
- switch (code) {
12646
- case BEZIER_VERTEX:
12647
- addBezierVertex(i);
12648
- i += 3;
12649
- break;
12650
- case QUADRATIC_VERTEX:
12651
- addQuadraticVertex(i);
12652
- i += 2;
12653
- break;
12654
- case CURVE_VERTEX:
12655
- addCurveVertex(i);
12656
- i++;
12657
- break;
12658
- default:
12659
- addVertex(i);
12660
- i++;
12661
- break;
12687
+ if (code == BEZIER_VERTEX) {
12688
+ addBezierVertex(i);
12689
+ i += 3;
12690
+ } else if (code == QUADRATIC_VERTEX) {
12691
+ addQuadraticVertex(i);
12692
+ i += 2;
12693
+ } else if (code == CURVE_VERTEX) {
12694
+ addCurveVertex(i);
12695
+ i++;
12696
+ } else {
12697
+ addVertex(i);
12698
+ i++;
12662
12699
  }
12663
12700
  }
12664
12701
  if (stroke) {
@@ -12916,7 +12953,7 @@ public class PGraphicsOpenGL extends PGraphics {
12916
12953
  r[j++] = (fcol >> 24) & 0xFF; // fa
12917
12954
  r[j++] = (fcol >> 16) & 0xFF; // fr
12918
12955
  r[j++] = (fcol >> 8) & 0xFF; // fg
12919
- r[j++] = (fcol >> 0) & 0xFF; // fb
12956
+ r[j++] = (fcol) & 0xFF; // fb
12920
12957
 
12921
12958
  r[j++] = in.normals[3*i + 0]; // nx
12922
12959
  r[j++] = in.normals[3*i + 1]; // ny
@@ -12929,19 +12966,19 @@ public class PGraphicsOpenGL extends PGraphics {
12929
12966
  r[j++] = (acol >> 24) & 0xFF; // aa
12930
12967
  r[j++] = (acol >> 16) & 0xFF; // ar
12931
12968
  r[j++] = (acol >> 8) & 0xFF; // ag
12932
- r[j++] = (acol >> 0) & 0xFF; // ab
12969
+ r[j++] = (acol) & 0xFF; // ab
12933
12970
 
12934
12971
  int scol = in.specular[i];
12935
12972
  r[j++] = (scol >> 24) & 0xFF; // sa
12936
12973
  r[j++] = (scol >> 16) & 0xFF; // sr
12937
12974
  r[j++] = (scol >> 8) & 0xFF; // sg
12938
- r[j++] = (scol >> 0) & 0xFF; // sb
12975
+ r[j++] = (scol) & 0xFF; // sb
12939
12976
 
12940
12977
  int ecol = in.emissive[i];
12941
12978
  r[j++] = (ecol >> 24) & 0xFF; // ea
12942
12979
  r[j++] = (ecol >> 16) & 0xFF; // er
12943
12980
  r[j++] = (ecol >> 8) & 0xFF; // eg
12944
- r[j++] = (ecol >> 0) & 0xFF; // eb
12981
+ r[j++] = (ecol) & 0xFF; // eb
12945
12982
 
12946
12983
  r[j++] = in.shininess[i]; // sh
12947
12984
 
@@ -12989,15 +13026,15 @@ public class PGraphicsOpenGL extends PGraphics {
12989
13026
  if (pathVertexCount == pathVertices.length / 3) {
12990
13027
  int newSize = pathVertexCount << 1;
12991
13028
 
12992
- float vtemp[] = new float[3 * newSize];
13029
+ float[] vtemp = new float[3 * newSize];
12993
13030
  PApplet.arrayCopy(pathVertices, 0, vtemp, 0, 3 * pathVertexCount);
12994
13031
  pathVertices = vtemp;
12995
13032
 
12996
- int ctemp[] = new int[newSize];
13033
+ int[] ctemp = new int[newSize];
12997
13034
  PApplet.arrayCopy(pathColors, 0, ctemp, 0, pathVertexCount);
12998
13035
  pathColors = ctemp;
12999
13036
 
13000
- float wtemp[] = new float[newSize];
13037
+ float[] wtemp = new float[newSize];
13001
13038
  PApplet.arrayCopy(pathWeights, 0, wtemp, 0, pathVertexCount);
13002
13039
  pathWeights = wtemp;
13003
13040
  }
@@ -13160,6 +13197,7 @@ public class PGraphicsOpenGL extends PGraphics {
13160
13197
  else if (type == PGL.TRIANGLES) primitive = TRIANGLES;
13161
13198
  }
13162
13199
 
13200
+ @Override
13163
13201
  public void end() {
13164
13202
  if (PGL.MAX_VERTEX_INDEX1 <= vertFirst + vertCount) {
13165
13203
  // We need a new index block for the new batch of
@@ -13235,6 +13273,7 @@ public class PGraphicsOpenGL extends PGraphics {
13235
13273
  vertFirst + vertOffset + tessIdx2);
13236
13274
  }
13237
13275
 
13276
+ @Override
13238
13277
  public void vertex(Object data) {
13239
13278
  if (data instanceof double[]) {
13240
13279
  double[] d = (double[]) data;