From 727c697f6808caec2fcbcc35d155552590d4f869 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 8 Oct 2011 02:17:56 +0200 Subject: EGL: Fall back to NV_coverage_sample if EGL MSAA/FSAA is n/a --- src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java | 5 +++++ .../classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java | 11 +++++++++++ 2 files changed, 16 insertions(+) (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index 8a423c6a8..42d911610 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -38,6 +38,7 @@ public class EGLGLCapabilities extends GLCapabilities { final int eglcfgid; final int renderableType; int nativeVisualID; + boolean useNV_coverage_sample; /** Comparing EGLConfig ID only */ public static class EglCfgIDComparator implements Comparator { @@ -85,6 +86,7 @@ public class EGLGLCapabilities extends GLCapabilities { " with EGL-RenderableType["+renderableTypeToString(null, renderableType)+"]"); } this.renderableType = renderableType; + this.useNV_coverage_sample = false; } public Object cloneMutable() { @@ -104,6 +106,8 @@ public class EGLGLCapabilities extends GLCapabilities { final public int getRenderableType() { return renderableType; } final public void setNativeVisualID(int vid) { nativeVisualID=vid; } final public int getNativeVisualID() { return nativeVisualID; } + final public boolean getUseNV_coverage_sample() { return useNV_coverage_sample; } + final public void setUseNV_coverage_sample(boolean v) { useNV_coverage_sample=v; } public static boolean isCompatible(GLProfile glp, int renderableType) { if(null == glp) { @@ -161,6 +165,7 @@ public class EGLGLCapabilities extends GLCapabilities { sink.append("0x").append(Long.toHexString(eglcfgid)).append(": "); sink.append("vid 0x").append(Integer.toHexString(nativeVisualID)).append(", "); super.toString(sink); + sink.append(", nv-covrg ").append(getUseNV_coverage_sample()); sink.append(", ["); renderableTypeToString(sink, renderableType); return sink.append("]"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 14e67a2c1..5f241a1d0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -217,6 +217,17 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple caps.setSampleBuffers(val.get(0)>0?true:false); caps.setNumSamples(val.get(0)); } + if(!caps.getSampleBuffers()) { + // try NV_coverage_sample extension + if(EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_BUFFERS_NV, val)) { + if(val.get(0)>0 && + EGL.eglGetConfigAttrib(display, config, EGLExt.EGL_COVERAGE_SAMPLES_NV, val)) { + caps.setUseNV_coverage_sample(true); + caps.setSampleBuffers(true); + caps.setNumSamples(val.get(0)); + } + } + } if(EGL.eglGetConfigAttrib(display, config, EGL.EGL_TRANSPARENT_TYPE, val)) { caps.setBackgroundOpaque(val.get(0) != EGL.EGL_TRANSPARENT_RGB); } -- cgit v1.2.3