diff --git a/core/src/processing/opengl/PGL.java b/core/src/processing/opengl/PGL.java index c834dead4..9bcd56ea7 100644 --- a/core/src/processing/opengl/PGL.java +++ b/core/src/processing/opengl/PGL.java @@ -357,6 +357,16 @@ public abstract class PGL { } + static protected int smoothToSamples(int smooth) { + if (smooth == 0) { + return 1; + } else if (smooth == 1) { + return 2; + } else { + return smooth; + } + } + // public abstract Object getCanvas(); // // diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index dc0f9e56f..dba2d6f9a 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -1852,7 +1852,7 @@ public class PGraphicsOpenGL extends PGraphics { } pgl.depthFunc(PGL.LEQUAL); - if (smooth < 2) { + if (smooth < 1) { pgl.disable(PGL.MULTISAMPLE); } else { pgl.enable(PGL.MULTISAMPLE); @@ -6545,9 +6545,9 @@ public class PGraphicsOpenGL extends PGraphics { boolean packed = depthBits == 24 && stencilBits == 8 && packedDepthStencilSupported; - if (PGraphicsOpenGL.fboMultisampleSupported && 1 < smooth) { + if (PGraphicsOpenGL.fboMultisampleSupported && 1 < PGL.smoothToSamples(smooth)) { multisampleFramebuffer = - new FrameBuffer(this, texture.glWidth, texture.glHeight, smooth, 0, + new FrameBuffer(this, texture.glWidth, texture.glHeight, PGL.smoothToSamples(smooth), 0, depthBits, stencilBits, packed, false); multisampleFramebuffer.clear(); @@ -6672,14 +6672,14 @@ public class PGraphicsOpenGL extends PGraphics { } if (primaryGraphics) { - pgl.getIntegerv(PGL.SAMPLES, intBuffer); - int temp = intBuffer.get(0); - if (smooth != temp && 1 < temp && 1 < smooth) { +// pgl.getIntegerv(PGL.SAMPLES, intBuffer); +// int temp = intBuffer.get(0); +// if (smooth != temp && 1 < temp && 1 < smooth) { // TODO check why the samples is higher that initialized smooth level. // quality = temp; - } +// } } - if (smooth < 2) { + if (smooth < 1) { pgl.disable(PGL.MULTISAMPLE); } else { pgl.enable(PGL.MULTISAMPLE); diff --git a/core/src/processing/opengl/PSurfaceJOGL.java b/core/src/processing/opengl/PSurfaceJOGL.java index e79c6149b..0b7db3fce 100644 --- a/core/src/processing/opengl/PSurfaceJOGL.java +++ b/core/src/processing/opengl/PSurfaceJOGL.java @@ -195,13 +195,7 @@ public class PSurfaceJOGL implements PSurface { // caps.setPBuffer(false); // caps.setFBO(false); - if (graphics.smooth == 0) { - pgl.reqNumSamples = 1; - } else if (graphics.smooth == 1) { - pgl.reqNumSamples = 2; - } else { - pgl.reqNumSamples = 2 * graphics.smooth; - } + pgl.reqNumSamples = PGL.smoothToSamples(graphics.smooth); caps.setSampleBuffers(true); caps.setNumSamples(pgl.reqNumSamples); caps.setBackgroundOpaque(true);