don't disable multisampling if smooth is 1

This commit is contained in:
codeanticode
2015-06-09 11:39:00 -04:00
parent 766066bc89
commit dee0e73d12
3 changed files with 19 additions and 15 deletions
+10
View File
@@ -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);
+1 -7
View File
@@ -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);