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/javax/media/opengl/GLCapabilities.java | |
parent | 727c697f6808caec2fcbcc35d155552590d4f869 (diff) |
Generalize sample extension in GLCapabilities*, currently NV_coverage_sample is respected in EGL
Diffstat (limited to 'src/jogl/classes/javax/media/opengl/GLCapabilities.java')
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLCapabilities.java | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 4d9d08827..9022c7df5 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -69,6 +69,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil // are unlikely to be supported on Windows anyway // Support for full-scene antialiasing (FSAA) + private String sampleExtension = DEFAULT_SAMPLE_EXTENSION; private boolean sampleBuffers = false; private int numSamples = 2; @@ -111,6 +112,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil hash = ((hash << 5) - hash) + this.accumAlphaBits; hash = ((hash << 5) - hash) + ( this.sampleBuffers ? 1 : 0 ); hash = ((hash << 5) - hash) + this.numSamples; + hash = ((hash << 5) - hash) + this.sampleExtension.hashCode(); hash = ((hash << 5) - hash) + ( this.pbufferFloatingPointBuffers ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.pbufferRenderToTexture ? 1 : 0 ); hash = ((hash << 5) - hash) + ( this.pbufferRenderToTextureRectangle ? 1 : 0 ); @@ -139,7 +141,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil other.getPbufferRenderToTexture()==pbufferRenderToTexture && other.getPbufferRenderToTextureRectangle()==pbufferRenderToTextureRectangle; if(sampleBuffers) { - res = res && other.getNumSamples()==numSamples; + res = res && + other.getNumSamples()==numSamples && + other.getSampleExtension().equals(sampleExtension) ; } return res; } @@ -147,7 +151,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil /** comparing hw/sw, stereo, multisample, stencil, RGBA and depth only */ public int compareTo(Object o) { if ( ! ( o instanceof GLCapabilities ) ) { - Class c = (null != o) ? o.getClass() : null ; + Class<?> c = (null != o) ? o.getClass() : null ; throw new ClassCastException("Not a GLCapabilities object: " + c); } @@ -173,6 +177,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } else if( ms < xms ) { return -1; } + // ignore the sample extension if(stencilBits > caps.stencilBits) { return 1; @@ -194,7 +199,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil return 0; // they are equal: hw/sw, stereo, multisample, stencil, RGBA and depth } - /** Returns the GL profile you desire or used by the drawable. */ public GLProfile getGLProfile() { return glProfile; } @@ -204,7 +208,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil glProfile=profile; } - /** Indicates whether pbuffer is used/requested. */ public boolean isPBuffer() { return pbuffer; } @@ -233,7 +236,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil super.setOnscreen(onscreen); } - /** Indicates whether double-buffering is enabled. */ public boolean getDoubleBuffered() { return doubleBuffered; } @@ -243,7 +245,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil doubleBuffered = enable; } - /** Indicates whether stereo is enabled. */ public boolean getStereo() { return stereo; } @@ -253,7 +254,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil stereo = enable; } - /** Indicates whether hardware acceleration is enabled. */ public boolean getHardwareAccelerated() { return hardwareAccelerated; } @@ -263,7 +263,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil hardwareAccelerated = enable; } - /** Returns the number of bits requested for the depth buffer. */ public int getDepthBits() { return depthBits; } @@ -273,7 +272,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.depthBits = depthBits; } - /** Returns the number of bits requested for the stencil buffer. */ public int getStencilBits() { return stencilBits; } @@ -283,10 +281,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.stencilBits = stencilBits; } - /** Returns the number of bits requested for the accumulation - buffer's red component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ public int getAccumRedBits() { return accumRedBits; } @@ -299,10 +293,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumRedBits = accumRedBits; } - /** Returns the number of bits requested for the accumulation - buffer's green component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ public int getAccumGreenBits() { return accumGreenBits; } @@ -315,10 +305,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumGreenBits = accumGreenBits; } - /** Returns the number of bits requested for the accumulation - buffer's blue component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ public int getAccumBlueBits() { return accumBlueBits; } @@ -331,10 +317,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.accumBlueBits = accumBlueBits; } - /** Returns the number of bits requested for the accumulation - buffer's alpha component. On some systems only the accumulation - buffer depth, which is the sum of the red, green, and blue bits, - is considered. */ public int getAccumAlphaBits() { return accumAlphaBits; } @@ -348,6 +330,18 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** + * Sets the desired extension for full-scene antialiasing + * (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}. + */ + public void setSampleExtension(String se) { + sampleExtension = se; + } + + public String getSampleExtension() { + return sampleExtension; + } + + /** * Defaults to false.<br> * Indicates whether sample buffers for full-scene antialiasing * (FSAA) should be allocated for this drawable.<br> @@ -362,9 +356,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } } - /** Returns whether sample buffers for full-scene antialiasing - (FSAA) should be allocated for this drawable. Defaults to - false. */ public boolean getSampleBuffers() { return sampleBuffers; } @@ -375,8 +366,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil this.numSamples = numSamples; } - /** Returns the number of sample buffers to be allocated if sample - buffers are enabled. Defaults to 2. */ public int getNumSamples() { return numSamples; } @@ -387,8 +376,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferFloatingPointBuffers = enable; } - /** For pbuffers only, returns whether floating-point buffers should - be used if available. Defaults to false. */ public boolean getPbufferFloatingPointBuffers() { return pbufferFloatingPointBuffers; } @@ -399,8 +386,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferRenderToTexture = enable; } - /** For pbuffers only, returns whether the render-to-texture - extension should be used if available. Defaults to false. */ public boolean getPbufferRenderToTexture() { return pbufferRenderToTexture; } @@ -412,8 +397,6 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil pbufferRenderToTextureRectangle = enable; } - /** For pbuffers only, returns whether the render-to-texture - extension should be used. Defaults to false. */ public boolean getPbufferRenderToTextureRectangle() { return pbufferRenderToTextureRectangle; } @@ -429,6 +412,9 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil sink.append(", accum-rgba ").append(accumRedBits).append("/").append(accumGreenBits).append("/").append(accumBlueBits).append("/").append(accumAlphaBits); sink.append(", dp/st/ms: ").append(depthBits).append("/").append(stencilBits).append("/").append(samples); + if(samples>0) { + sink.append(", sample-ext ").append(sampleExtension); + } if(doubleBuffered) { sink.append(", dbl"); } else { |