diff options
author | Sven Gothel <[email protected]> | 2011-10-08 03:19:41 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-08 03:19:41 +0200 |
commit | 0c138d5410ed32bdeef22052b57f1bcecf6b5d4f (patch) | |
tree | 55707ace5fa46d3c97f621e5bdcca1c380991b4b /src/jogl/classes/jogamp | |
parent | 727c697f6808caec2fcbcc35d155552590d4f869 (diff) |
Generalize sample extension in GLCapabilities*, currently NV_coverage_sample is respected in EGL
Diffstat (limited to 'src/jogl/classes/jogamp')
3 files changed, 21 insertions, 24 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java index cc7a578cd..318d00637 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java @@ -33,6 +33,7 @@ import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLCapabilitiesImmutable; public class GLGraphicsConfigurationUtil { + public static final String NV_coverage_sample = "NV_coverage_sample"; public static final int WINDOW_BIT = 1 << 0; public static final int BITMAP_BIT = 1 << 1; public static final int PBUFFER_BIT = 1 << 2; diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index 42d911610..bd5eb1b99 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -38,25 +38,13 @@ 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 { + public static class EglCfgIDComparator implements Comparator<EGLGLCapabilities> { - public int compare(Object o1, Object o2) { - if ( ! ( o1 instanceof EGLGLCapabilities ) ) { - Class c = (null != o1) ? o1.getClass() : null ; - throw new ClassCastException("arg1 not a EGLGLCapabilities object: " + c); - } - if ( ! ( o2 instanceof EGLGLCapabilities ) ) { - Class c = (null != o2) ? o2.getClass() : null ; - throw new ClassCastException("arg2 not a EGLGLCapabilities object: " + c); - } - - final EGLGLCapabilities caps1 = (EGLGLCapabilities) o1; + public int compare(EGLGLCapabilities caps1, EGLGLCapabilities caps2) { final long id1 = caps1.getEGLConfigID(); - final EGLGLCapabilities caps2 = (EGLGLCapabilities) o2; final long id2 = caps2.getEGLConfigID(); if(id1 > id2) { @@ -86,7 +74,6 @@ public class EGLGLCapabilities extends GLCapabilities { " with EGL-RenderableType["+renderableTypeToString(null, renderableType)+"]"); } this.renderableType = renderableType; - this.useNV_coverage_sample = false; } public Object cloneMutable() { @@ -106,8 +93,6 @@ 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) { @@ -165,7 +150,6 @@ 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 5f241a1d0..4fb3dca78 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -222,7 +222,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple 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.setSampleExtension(GLGraphicsConfigurationUtil.NV_coverage_sample); caps.setSampleBuffers(true); caps.setNumSamples(val.get(0)); } @@ -274,13 +274,25 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple attrs[idx++] = EGL.EGL_DEPTH_SIZE; attrs[idx++] = caps.getDepthBits(); - attrs[idx++] = EGL.EGL_SAMPLES; - attrs[idx++] = caps.getSampleBuffers() ? caps.getNumSamples() : 1; + if(caps.getSampleBuffers()) { + if(caps.getSampleExtension().equals(GLGraphicsConfigurationUtil.NV_coverage_sample)) { + attrs[idx++] = EGLExt.EGL_COVERAGE_BUFFERS_NV; + attrs[idx++] = 1; + attrs[idx++] = EGLExt.EGL_COVERAGE_SAMPLES_NV; + attrs[idx++] = caps.getNumSamples(); + } else { + // try default .. + attrs[idx++] = EGL.EGL_SAMPLE_BUFFERS; + attrs[idx++] = 1; + attrs[idx++] = EGL.EGL_SAMPLES; + attrs[idx++] = caps.getNumSamples(); + } + } attrs[idx++] = EGL.EGL_TRANSPARENT_TYPE; attrs[idx++] = caps.isBackgroundOpaque() ? EGL.EGL_NONE : EGL.EGL_TRANSPARENT_TYPE; - // 20 + // 22 if(!caps.isBackgroundOpaque()) { attrs[idx++] = EGL.EGL_TRANSPARENT_RED_VALUE; @@ -297,7 +309,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple attrs[idx++] = caps.getTransparentAlphaValue()>=0?caps.getTransparentAlphaValue():EGL.EGL_DONT_CARE; */ } - // 26 + // 28 attrs[idx++] = EGL.EGL_RENDERABLE_TYPE; if(caps.getGLProfile().usesNativeGLES1()) { attrs[idx++] = EGL.EGL_OPENGL_ES_BIT; @@ -307,7 +319,7 @@ public class EGLGraphicsConfiguration extends DefaultGraphicsConfiguration imple attrs[idx++] = EGL.EGL_OPENGL_BIT; } - // 28 + // 30 attrs[idx++] = EGL.EGL_NONE; |