Commit 60d835f3 authored by Matthias Betz's avatar Matthias Betz
Browse files

Enable 4x MSAA anti-aliasing for the GL viewport



Request a multisampled framebuffer via the openglfx GLCanvas msaa parameter
and enable GL_MULTISAMPLE, smoothing jagged polygon/line/point edges. The
picking framebuffer stays single-sample so picked ids remain exact.

Co-Authored-By: default avatarClaude Opus 4.8 <noreply@anthropic.com>
parent 1ef9f132
......@@ -55,7 +55,8 @@ public class GLViewport {
private double lastY;
public GLViewport() {
canvas = new GLCanvas(new JOGLExecutor(), GLProfile.CORE);
// args: executor, profile, flipY=false, msaa=4 -> request a 4x multisampled framebuffer for AA
canvas = new GLCanvas(new JOGLExecutor(), GLProfile.CORE, false, 4);
canvas.addOnInitEvent(ev -> {
// GL context (re)created: shaders/buffers from any previous context are gone. Drop our
// handles and re-queue the current scene so it is re-uploaded into the new context.
......@@ -115,6 +116,7 @@ public class GLViewport {
pickProgram = new ShaderProgram(gl, "pick.vert", "pick.frag");
overlay.init(gl);
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_MULTISAMPLE); // anti-aliasing for the multisampled framebuffer
initialized = true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment