diff --git a/android/core/src/processing/core/PGL.java b/android/core/src/processing/core/PGL.java index afadfcdfd..84fe4c97b 100644 --- a/android/core/src/processing/core/PGL.java +++ b/android/core/src/processing/core/PGL.java @@ -230,9 +230,9 @@ public class PGL { public static final int GL_LINK_STATUS = GLES20.GL_LINK_STATUS; public static final int GL_VALIDATE_STATUS = GLES20.GL_VALIDATE_STATUS; - public static final int GL_MULTISAMPLE = 0x809D; - public static final int GL_POINT_SMOOTH = 0x0B10; - public static final int GL_LINE_SMOOTH = 0x0B20; + public static final int GL_MULTISAMPLE = -1; + public static final int GL_POINT_SMOOTH = -1; + public static final int GL_LINE_SMOOTH = -1; public static final int GL_POLYGON_SMOOTH = -1; // Some EGL constants needed to initialize an GLES2 context. @@ -411,10 +411,10 @@ public class PGL { GLES20.glClearColor(0, 0, 0, 0); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); PGraphicsAndroid3D.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); - validateFramebuffer(); + } else { + GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo[0]); + GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, textures[frontTex], 0); + validateFramebuffer(); // We need to save the color buffer after finishing with the rendering of this frame, // to use is as the background for the next frame ("incremental drawing"). @@ -441,9 +441,9 @@ public class PGL { // We are in the primary surface, and no clear mode, this means that the current // contents of the front buffer needs to be used in the next frame as the background. GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); - + GLES20.glClearColor(0, 0, 0, 0); - GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); + GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Render current front texture to screen. drawTexture(GLES20.GL_TEXTURE_2D, textures[frontTex], texWidth, texHeight, 0, 0, pg.width, pg.height, 0, 0, pg.width, pg.height); @@ -1152,7 +1152,6 @@ public class PGL { public void drawTexture(int target, int id, int width, int height, int texX0, int texY0, int texX1, int texY1, int scrX0, int scrY0, int scrX1, int scrY1) { - if (!loadedTexShader) { texVertShader = createShader(GL_VERTEX_SHADER, texVertShaderSource); texFragShader = createShader(GL_FRAGMENT_SHADER, texFragShaderSource); @@ -1172,9 +1171,9 @@ public class PGL { // depth mask, so the texture remains in the background // and can be occluded by anything drawn later, even if // if it is behind it. - boolean[] val = new boolean[1]; - glGetBooleanv(GL_DEPTH_WRITEMASK, val, 0); - boolean writeMask = val[0]; + boolean[] val = new boolean[1]; + glGetBooleanv(GL_DEPTH_WRITEMASK, val, 0); + boolean writeMask = val[0]; glDepthMask(false); glUseProgram(texShaderProgram); @@ -1213,7 +1212,7 @@ public class PGL { texData.put(texCoords); enableTexturing(target); - glActiveTexture(target); + glActiveTexture(GL_TEXTURE0); glBindTexture(target, id); texData.position(0); diff --git a/android/core/src/processing/core/PGraphicsAndroid3D.java b/android/core/src/processing/core/PGraphicsAndroid3D.java index f90b1d8cb..909e51bf3 100644 --- a/android/core/src/processing/core/PGraphicsAndroid3D.java +++ b/android/core/src/processing/core/PGraphicsAndroid3D.java @@ -1442,7 +1442,7 @@ public class PGraphicsAndroid3D extends PGraphics { pgl.glDisable(PGL.GL_MULTISAMPLE); pgl.glEnable(PGL.GL_POINT_SMOOTH); pgl.glEnable(PGL.GL_LINE_SMOOTH); - pgl.glEnable(PGL.GL_POLYGON_SMOOTH); + pgl.glEnable(PGL.GL_POLYGON_SMOOTH); } else { pgl.glEnable(PGL.GL_MULTISAMPLE); pgl.glDisable(PGL.GL_POINT_SMOOTH); @@ -1492,7 +1492,7 @@ public class PGraphicsAndroid3D extends PGraphics { noLights(); lightFalloff(1, 0, 0); lightSpecular(0, 0, 0); - + // because y is flipped pgl.glFrontFace(PGL.GL_CW); @@ -1549,8 +1549,8 @@ public class PGraphicsAndroid3D extends PGraphics { } if (primarySurface) { - pgl.endOnscreenDraw(clearColorBuffer0); - pgl.glFlush(); + pgl.endOnscreenDraw(clearColorBuffer0); + pgl.glFlush(); } else { if (offscreenMultisample) { offscreenFramebufferMultisample.copy(offscreenFramebuffer); @@ -2298,8 +2298,7 @@ public class PGraphicsAndroid3D extends PGraphics { shader.setVertexAttribute(glLineVertexBufferID, 3, PGL.GL_FLOAT, 0, 0); shader.setColorAttribute(glLineColorBufferID, 4, PGL.GL_UNSIGNED_BYTE, 0, 0); - shader.setDirWidthAttribute(glLineDirWidthBufferID, 4, PGL.GL_FLOAT, 0, 0); - report("renderLines: attribs set"); + shader.setDirWidthAttribute(glLineDirWidthBufferID, 4, PGL.GL_FLOAT, 0, 0); pgl.glDrawElements(PGL.GL_TRIANGLES, tessGeo.lineIndexCount, PGL.INDEX_TYPE, 0);