diff --git a/android/core/src/processing/core/PApplet.java b/android/core/src/processing/core/PApplet.java index b4cbd1cef..3026d6ae1 100644 --- a/android/core/src/processing/core/PApplet.java +++ b/android/core/src/processing/core/PApplet.java @@ -780,7 +780,7 @@ public class PApplet extends Activity implements PConstants, Runnable { public class SketchSurfaceView3D extends GLSurfaceView implements SketchSurfaceView { - PGraphicsAndroid3D g3; + PGraphicsOpenGL g3; SurfaceHolder surfaceHolder; @@ -805,7 +805,7 @@ public class PApplet extends Activity implements PConstants, Runnable { // null. This is required because PApplet.onResume events (which call // this.onResume() and thus require a valid renderer) are triggered // before surfaceChanged() is ever called. - g3 = new PGraphicsAndroid3D(); + g3 = new PGraphicsOpenGL(); g3.setParent(PApplet.this); g3.setPrimary(true); // Set semi-arbitrary size; will be set properly when surfaceChanged() called @@ -1542,7 +1542,7 @@ public class PApplet extends Activity implements PConstants, Runnable { if (irenderer.equals(P2D)) { pg = new PGraphicsAndroid2D(); } else if (irenderer.equals(P3D)) { - pg = new PGraphicsAndroid3D(); + pg = new PGraphicsOpenGL(); } else { Class rendererClass = null; Constructor constructor = null; diff --git a/android/core/src/processing/core/PConstants.java b/android/core/src/processing/core/PConstants.java index ad8fe193d..e2f38b8b9 100644 --- a/android/core/src/processing/core/PConstants.java +++ b/android/core/src/processing/core/PConstants.java @@ -133,7 +133,7 @@ public interface PConstants { static final String P2D = "processing.core.PGraphicsAndroid2D"; static final String JAVA2D = P2D; - static final String P3D = "processing.core.PGraphicsAndroid3D"; + static final String P3D = "processing.core.PGraphicsOpenGL"; static final String OPENGL = P3D; // The PDF and DXF renderers are not available for Android. diff --git a/android/core/src/processing/core/PFontTexture.java b/android/core/src/processing/core/PFontTexture.java index c874131d0..8995421e2 100644 --- a/android/core/src/processing/core/PFontTexture.java +++ b/android/core/src/processing/core/PFontTexture.java @@ -48,7 +48,7 @@ import processing.core.PFont; */ class PFontTexture implements PConstants { protected PApplet parent; - protected PGraphicsAndroid3D pg; + protected PGraphicsOpenGL pg; protected PGL pgl; protected PFont font; @@ -67,7 +67,7 @@ class PFontTexture implements PConstants { public PFontTexture(PApplet parent, PFont font, int maxw, int maxh) { this.parent = parent; this.font = font; - pg = (PGraphicsAndroid3D)parent.g; + pg = (PGraphicsOpenGL)parent.g; pgl = pg.pgl; initTexture(maxw, maxh); @@ -110,7 +110,7 @@ class PFontTexture implements PConstants { h = PApplet.min(2 * textures[currentTex].glHeight, maxTexHeight); resize = true; } else { - h = PApplet.min(PGraphicsAndroid3D.maxTextureSize, 512, maxTexHeight / 4); + h = PApplet.min(PGraphicsOpenGL.maxTextureSize, 512, maxTexHeight / 4); resize = false; } @@ -248,7 +248,7 @@ class PFontTexture implements PConstants { int[] rgba = new int[w * h]; int t = 0; int p = 0; - if (PGraphicsAndroid3D.BIG_ENDIAN) { + if (PGraphicsOpenGL.BIG_ENDIAN) { java.util.Arrays.fill(rgba, 0, w, 0xFFFFFF00); // Set the first row to blank pixels. t = w; for (int y = 0; y < glyph.height; y++) { diff --git a/android/core/src/processing/core/PFramebuffer.java b/android/core/src/processing/core/PFramebuffer.java index b2335f1be..d34c593e9 100644 --- a/android/core/src/processing/core/PFramebuffer.java +++ b/android/core/src/processing/core/PFramebuffer.java @@ -35,7 +35,7 @@ import java.nio.IntBuffer; */ public class PFramebuffer implements PConstants { protected PApplet parent; - protected PGraphicsAndroid3D pg; + protected PGraphicsOpenGL pg; protected PGL pgl; protected PGL.Context context; // The context that created this framebuffer. @@ -74,7 +74,7 @@ public class PFramebuffer implements PConstants { int depthBits, int stencilBits, boolean packedDepthStencil, boolean screen) { this.parent = parent; - pg = (PGraphicsAndroid3D)parent.g; + pg = (PGraphicsOpenGL)parent.g; pgl = pg.pgl; glFboID = 0; diff --git a/android/core/src/processing/core/PGL.java b/android/core/src/processing/core/PGL.java index 84fe4c97b..79364a76a 100644 --- a/android/core/src/processing/core/PGL.java +++ b/android/core/src/processing/core/PGL.java @@ -246,7 +246,7 @@ public class PGL { public PGLU glu; /** The PGraphics object using this interface */ - public PGraphicsAndroid3D pg; + public PGraphicsOpenGL pg; /** Whether OpenGL has been initialized or not */ public boolean initialized; @@ -308,7 +308,7 @@ public class PGL { // Intialization, finalization - public PGL(PGraphicsAndroid3D pg) { + public PGL(PGraphicsOpenGL pg) { this.pg = pg; renderer = new AndroidRenderer(); glu = new PGLU(); @@ -387,7 +387,7 @@ public class PGL { // to update the screenFramebuffer object so when the // framebuffer is popped back to the screen, the correct // id is set. - PGraphicsAndroid3D.screenFramebuffer.glFboID = fbo[0]; + PGraphicsOpenGL.screenFramebuffer.glFboID = fbo[0]; initialized = true; } @@ -410,7 +410,7 @@ public class PGL { // No need for saving front color buffer, etc. GLES20.glClearColor(0, 0, 0, 0); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); - PGraphicsAndroid3D.screenFramebuffer.glFboID = 0; + PGraphicsOpenGL.screenFramebuffer.glFboID = 0; } else { GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, textures[frontTex], 0); @@ -427,7 +427,7 @@ public class PGL { // Render previous draw texture as background. drawTexture(GLES20.GL_TEXTURE_2D, textures[backTex], texWidth, texHeight, 0, 0, pg.width, pg.height, 0, 0, pg.width, pg.height); } - PGraphicsAndroid3D.screenFramebuffer.glFboID = fbo[0]; + PGraphicsOpenGL.screenFramebuffer.glFboID = fbo[0]; } if (firstOnscreenFrame) { diff --git a/android/core/src/processing/core/PGraphicsAndroid3D.java b/android/core/src/processing/core/PGraphicsOpenGL.java similarity index 99% rename from android/core/src/processing/core/PGraphicsAndroid3D.java rename to android/core/src/processing/core/PGraphicsOpenGL.java index 909e51bf3..f18ba9411 100644 --- a/android/core/src/processing/core/PGraphicsAndroid3D.java +++ b/android/core/src/processing/core/PGraphicsOpenGL.java @@ -40,12 +40,12 @@ import java.util.Stack; * OpenGL renderer. * */ -public class PGraphicsAndroid3D extends PGraphics { +public class PGraphicsOpenGL extends PGraphics { /** Interface between Processing and OpenGL */ public PGL pgl; /** The PApplet renderer. For the primary surface, pg == this. */ - protected PGraphicsAndroid3D pg; + protected PGraphicsOpenGL pg; // ........................................................ @@ -124,16 +124,16 @@ public class PGraphicsAndroid3D extends PGraphics { // Shaders - static protected URL defFillShaderVertSimpleURL = PGraphicsAndroid3D.class.getResource("FillShaderVertSimple.glsl"); - static protected URL defFillShaderVertTexURL = PGraphicsAndroid3D.class.getResource("FillShaderVertTex.glsl"); - static protected URL defFillShaderVertLitURL = PGraphicsAndroid3D.class.getResource("FillShaderVertLit.glsl"); - static protected URL defFillShaderVertFullURL = PGraphicsAndroid3D.class.getResource("FillShaderVertFull.glsl"); - static protected URL defFillShaderFragNoTexURL = PGraphicsAndroid3D.class.getResource("FillShaderFragNoTex.glsl"); - static protected URL defFillShaderFragTexURL = PGraphicsAndroid3D.class.getResource("FillShaderFragTex.glsl"); - static protected URL defLineShaderVertURL = PGraphicsAndroid3D.class.getResource("LineShaderVert.glsl"); - static protected URL defLineShaderFragURL = PGraphicsAndroid3D.class.getResource("LineShaderFrag.glsl"); - static protected URL defPointShaderVertURL = PGraphicsAndroid3D.class.getResource("PointShaderVert.glsl"); - static protected URL defPointShaderFragURL = PGraphicsAndroid3D.class.getResource("PointShaderFrag.glsl"); + static protected URL defFillShaderVertSimpleURL = PGraphicsOpenGL.class.getResource("FillShaderVertSimple.glsl"); + static protected URL defFillShaderVertTexURL = PGraphicsOpenGL.class.getResource("FillShaderVertTex.glsl"); + static protected URL defFillShaderVertLitURL = PGraphicsOpenGL.class.getResource("FillShaderVertLit.glsl"); + static protected URL defFillShaderVertFullURL = PGraphicsOpenGL.class.getResource("FillShaderVertFull.glsl"); + static protected URL defFillShaderFragNoTexURL = PGraphicsOpenGL.class.getResource("FillShaderFragNoTex.glsl"); + static protected URL defFillShaderFragTexURL = PGraphicsOpenGL.class.getResource("FillShaderFragTex.glsl"); + static protected URL defLineShaderVertURL = PGraphicsOpenGL.class.getResource("LineShaderVert.glsl"); + static protected URL defLineShaderFragURL = PGraphicsOpenGL.class.getResource("LineShaderFrag.glsl"); + static protected URL defPointShaderVertURL = PGraphicsOpenGL.class.getResource("PointShaderVert.glsl"); + static protected URL defPointShaderFragURL = PGraphicsOpenGL.class.getResource("PointShaderFrag.glsl"); static protected FillShaderSimple defFillShaderSimple; static protected FillShaderTex defFillShaderTex; @@ -400,7 +400,7 @@ public class PGraphicsAndroid3D extends PGraphics { // INIT/ALLOCATE/FINISH - public PGraphicsAndroid3D() { + public PGraphicsOpenGL() { pgl = new PGL(this); pg = null; @@ -5586,7 +5586,7 @@ public class PGraphicsAndroid3D extends PGraphics { protected void initOffscreen() { // Getting the context and capabilities from the main renderer. - pg = (PGraphicsAndroid3D)parent.g; + pg = (PGraphicsOpenGL)parent.g; pgl.initOffscreenSurface(pg.pgl); pgl.updateOffscreen(pg.pgl); @@ -5602,7 +5602,7 @@ public class PGraphicsAndroid3D extends PGraphics { offscreenFramebufferMultisample.release(); } - if (PGraphicsAndroid3D.fboMultisampleSupported && 1 < antialias) { + if (PGraphicsOpenGL.fboMultisampleSupported && 1 < antialias) { offscreenFramebufferMultisample = new PFramebuffer(parent, texture.glWidth, texture.glHeight, antialias, 0, depthBits, stencilBits, depthBits == 24 && stencilBits == 8 && packedDepthStencilSupported, false); @@ -5860,7 +5860,7 @@ public class PGraphicsAndroid3D extends PGraphics { // be called by different renderers within a single application // (the one corresponding to the main surface, or other offscreen // renderers). - protected PGraphicsAndroid3D renderer; + protected PGraphicsOpenGL renderer; public FillShader(PApplet parent) { super(parent); @@ -5874,7 +5874,7 @@ public class PGraphicsAndroid3D extends PGraphics { super(parent, vertURL, fragURL); } - public void setRenderer(PGraphicsAndroid3D pg) { + public void setRenderer(PGraphicsOpenGL pg) { this.renderer = pg; } @@ -6268,7 +6268,7 @@ public class PGraphicsAndroid3D extends PGraphics { protected class LineShader extends PShader { - protected PGraphicsAndroid3D renderer; + protected PGraphicsOpenGL renderer; protected int projectionMatrixLoc; protected int modelviewMatrixLoc; @@ -6292,7 +6292,7 @@ public class PGraphicsAndroid3D extends PGraphics { super(parent, vertURL, fragURL); } - public void setRenderer(PGraphicsAndroid3D pg) { + public void setRenderer(PGraphicsOpenGL pg) { this.renderer = pg; } @@ -6364,7 +6364,7 @@ public class PGraphicsAndroid3D extends PGraphics { protected class PointShader extends PShader { - protected PGraphicsAndroid3D renderer; + protected PGraphicsOpenGL renderer; protected int projectionMatrixLoc; protected int modelviewMatrixLoc; @@ -6385,7 +6385,7 @@ public class PGraphicsAndroid3D extends PGraphics { super(parent, vertURL, fragURL); } - public void setRenderer(PGraphicsAndroid3D pg) { + public void setRenderer(PGraphicsOpenGL pg) { this.renderer = pg; } @@ -7268,7 +7268,7 @@ public class PGraphicsAndroid3D extends PGraphics { if (accuracy < 6) { accuracy = 6; } - float inc = (float) PGraphicsAndroid3D.SINCOS_LENGTH / accuracy; + float inc = (float) PGraphicsOpenGL.SINCOS_LENGTH / accuracy; if (fill) { addVertex(centerX, centerY, @@ -7280,12 +7280,12 @@ public class PGraphicsAndroid3D extends PGraphics { idx0 = pidx = idx = 0; float val = 0; for (int i = 0; i < accuracy; i++) { - idx = addVertex(centerX + PGraphicsAndroid3D.cosLUT[(int) val] * radiusH, - centerY + PGraphicsAndroid3D.sinLUT[(int) val] * radiusV, + idx = addVertex(centerX + PGraphicsOpenGL.cosLUT[(int) val] * radiusH, + centerY + PGraphicsOpenGL.sinLUT[(int) val] * radiusV, fillColor, strokeColor, strokeWeight, ambient, specular, emissive, shininess, VERTEX); - val = (val + inc) % PGraphicsAndroid3D.SINCOS_LENGTH; + val = (val + inc) % PGraphicsOpenGL.SINCOS_LENGTH; if (0 < i) { if (stroke) addEdge(pidx, idx, i == 1, false); @@ -7296,8 +7296,8 @@ public class PGraphicsAndroid3D extends PGraphics { pidx = idx; } // Back to the beginning - addVertex(centerX + PGraphicsAndroid3D.cosLUT[0] * radiusH, - centerY + PGraphicsAndroid3D.sinLUT[0] * radiusV, + addVertex(centerX + PGraphicsOpenGL.cosLUT[0] * radiusH, + centerY + PGraphicsOpenGL.sinLUT[0] * radiusV, fillColor, strokeColor, strokeWeight, ambient, specular, emissive, shininess, VERTEX); diff --git a/android/core/src/processing/core/PShader.java b/android/core/src/processing/core/PShader.java index 1660d7530..f5c113a36 100644 --- a/android/core/src/processing/core/PShader.java +++ b/android/core/src/processing/core/PShader.java @@ -34,7 +34,7 @@ import java.net.URL; */ public class PShader { protected PApplet parent; - protected PGraphicsAndroid3D pg; + protected PGraphicsOpenGL pg; protected PGL pgl; protected PGL.Context context; // The context that created this shader. @@ -69,7 +69,7 @@ public class PShader { public PShader(PApplet parent) { this(); this.parent = parent; - pg = (PGraphicsAndroid3D) parent.g; + pg = (PGraphicsOpenGL) parent.g; pgl = pg.pgl; } @@ -83,7 +83,7 @@ public class PShader { */ public PShader(PApplet parent, String vertFilename, String fragFilename) { this.parent = parent; - pg = (PGraphicsAndroid3D) parent.g; + pg = (PGraphicsOpenGL) parent.g; pgl = pg.pgl; this.vertexURL = null; @@ -98,7 +98,7 @@ public class PShader { public PShader(PApplet parent, URL vertURL, URL fragURL) { this.parent = parent; - pg = (PGraphicsAndroid3D) parent.g; + pg = (PGraphicsOpenGL) parent.g; pgl = pg.pgl; this.vertexURL = vertURL; diff --git a/android/core/src/processing/core/PShape3D.java b/android/core/src/processing/core/PShape3D.java index 75fb26231..776011894 100644 --- a/android/core/src/processing/core/PShape3D.java +++ b/android/core/src/processing/core/PShape3D.java @@ -22,12 +22,12 @@ package processing.core; -import processing.core.PGraphicsAndroid3D.FillShader; -import processing.core.PGraphicsAndroid3D.InGeometry; -import processing.core.PGraphicsAndroid3D.LineShader; -import processing.core.PGraphicsAndroid3D.PointShader; -import processing.core.PGraphicsAndroid3D.TessGeometry; -import processing.core.PGraphicsAndroid3D.Tessellator; +import processing.core.PGraphicsOpenGL.FillShader; +import processing.core.PGraphicsOpenGL.InGeometry; +import processing.core.PGraphicsOpenGL.LineShader; +import processing.core.PGraphicsOpenGL.PointShader; +import processing.core.PGraphicsOpenGL.TessGeometry; +import processing.core.PGraphicsOpenGL.Tessellator; import java.nio.FloatBuffer; import java.nio.ByteBuffer; @@ -67,7 +67,7 @@ import java.io.BufferedReader; */ public class PShape3D extends PShape { - protected PGraphicsAndroid3D pg; + protected PGraphicsOpenGL pg; protected PGL pgl; protected PGL.Context context; // The context that created this shape. @@ -239,7 +239,7 @@ public class PShape3D extends PShape { protected int imageMode; public PShape3D(PApplet parent, int family) { - pg = (PGraphicsAndroid3D)parent.g; + pg = (PGraphicsOpenGL)parent.g; pgl = pg.pgl; glMode = PGL.GL_STATIC_DRAW; @@ -3946,7 +3946,7 @@ public class PShape3D extends PShape { expand(newSize); } - if (dataSize <= PGraphicsAndroid3D.MIN_ARRAYCOPY_SIZE) { + if (dataSize <= PGraphicsOpenGL.MIN_ARRAYCOPY_SIZE) { // Copying elements one by one instead of using arrayCopy is more efficient for // few vertices... for (int i = 0; i < dataSize; i++) { @@ -3989,7 +3989,7 @@ public class PShape3D extends PShape { expand(newSize); } - if (dataSize <= PGraphicsAndroid3D.MIN_ARRAYCOPY_SIZE) { + if (dataSize <= PGraphicsOpenGL.MIN_ARRAYCOPY_SIZE) { // Copying elements one by one instead of using arrayCopy is more efficient for // few vertices... for (int i = 0; i < dataSize; i++) { diff --git a/android/core/src/processing/core/PTexture.java b/android/core/src/processing/core/PTexture.java index 9ec467705..bdd25a90c 100644 --- a/android/core/src/processing/core/PTexture.java +++ b/android/core/src/processing/core/PTexture.java @@ -38,7 +38,7 @@ public class PTexture implements PConstants { public int width, height; protected PApplet parent; // The Processing applet - protected PGraphicsAndroid3D pg; // The main renderer + protected PGraphicsOpenGL pg; // The main renderer protected PGL pgl; // The interface between Processing and OpenGL. protected PGL.Context context; // The context that created this texture. @@ -96,7 +96,7 @@ public class PTexture implements PConstants { public PTexture(PApplet parent, int width, int height, Object params) { this.parent = parent; - pg = (PGraphicsAndroid3D)parent.g; + pg = (PGraphicsOpenGL)parent.g; pgl = pg.pgl; glID = 0; @@ -244,7 +244,7 @@ public class PTexture implements PConstants { pgl.glBindTexture(glTarget, glID); if (usingMipmaps) { - if (PGraphicsAndroid3D.mipmapGeneration) { + if (PGraphicsOpenGL.mipmapGeneration) { // Automatic mipmap generation. int[] rgbaPixels = new int[w * h]; convertToRGBA(pixels, rgbaPixels, format, w, h); @@ -538,7 +538,7 @@ public class PTexture implements PConstants { * @param h int */ protected void convertToRGBA(int[] intArray, int[] tIntArray, int arrayFormat, int w, int h) { - if (PGraphicsAndroid3D.BIG_ENDIAN) { + if (PGraphicsOpenGL.BIG_ENDIAN) { switch (arrayFormat) { case ALPHA: @@ -678,7 +678,7 @@ public class PTexture implements PConstants { protected void convertToARGB(int[] intArray, int[] tIntArray) { int t = 0; int p = 0; - if (PGraphicsAndroid3D.BIG_ENDIAN) { + if (PGraphicsOpenGL.BIG_ENDIAN) { // RGBA to ARGB conversion: shifting RGB 8 bits to the right, // and placing A 24 bits to the left. @@ -718,7 +718,7 @@ public class PTexture implements PConstants { width = w; height = h; - if (PGraphicsAndroid3D.npotTexSupported) { + if (PGraphicsOpenGL.npotTexSupported) { glWidth = w; glHeight = h; } else { @@ -726,10 +726,10 @@ public class PTexture implements PConstants { glHeight = PGL.nextPowerOfTwo(h); } - if ((glWidth > PGraphicsAndroid3D.maxTextureSize) || (glHeight > PGraphicsAndroid3D.maxTextureSize)) { + if ((glWidth > PGraphicsOpenGL.maxTextureSize) || (glHeight > PGraphicsOpenGL.maxTextureSize)) { glWidth = glHeight = 0; throw new RuntimeException("Image width and height cannot be" + - " larger than " + PGraphicsAndroid3D.maxTextureSize + + " larger than " + PGraphicsOpenGL.maxTextureSize + " with this graphics card."); }