mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
don't disable multisampling if smooth is 1
This commit is contained in:
@@ -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();
|
||||
//
|
||||
//
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user