41package com.jogamp.opengl;
43import com.jogamp.nativewindow.Capabilities;
44import com.jogamp.nativewindow.CapabilitiesImmutable;
60 private boolean isPBuffer =
false;
61 private boolean isFBO =
false;
62 private boolean doubleBuffered =
true;
63 private boolean stereo =
false;
64 private boolean hardwareAccelerated =
true;
65 private int depthBits = 16;
66 private int stencilBits = 0;
67 private int accumRedBits = 0;
68 private int accumGreenBits = 0;
69 private int accumBlueBits = 0;
70 private int accumAlphaBits = 0;
76 private boolean sampleBuffers =
false;
77 private int numSamples = 2;
96 }
catch (
final RuntimeException e) {
120 isFBO = source.
isFBO();
139 int hash = super.hashCode();
140 hash = ((hash << 5) - hash) + this.glProfile.
hashCode() ;
141 hash = ((hash << 5) - hash) + ( this.hardwareAccelerated ? 1 : 0 );
142 hash = ((hash << 5) - hash) + ( this.stereo ? 1 : 0 );
143 hash = ((hash << 5) - hash) + ( this.isFBO ? 1 : 0 );
144 hash = ((hash << 5) - hash) + ( this.isPBuffer ? 1 : 0 );
145 hash = ((hash << 5) - hash) + ( this.sampleBuffers ? 1 : 0 );
147 hash = ((hash << 5) - hash) + this.sampleExtension.hashCode();
148 hash = ((hash << 5) - hash) + this.depthBits;
149 hash = ((hash << 5) - hash) + this.stencilBits;
150 hash = ((hash << 5) - hash) + this.accumRedBits;
151 hash = ((hash << 5) - hash) + this.accumGreenBits;
152 hash = ((hash << 5) - hash) + this.accumBlueBits;
153 hash = ((hash << 5) - hash) + this.accumAlphaBits;
158 public boolean equals(
final Object obj) {
159 if(
this == obj) {
return true; }
164 boolean res = super.
equals(obj) &&
167 other.
isFBO()==isFBO &&
178 if(res && sampleBuffers) {
189 final Class<?> c = (
null != o) ? o.getClass() : null ;
190 throw new ClassCastException(
"Not a GLCapabilitiesImmutable object, but " + c);
217 }
else if( ms < xms ) {
228 final int sc = super.compareTo(caps);
293 public void setFBO(
final boolean enable) {
302 return doubleBuffered;
307 doubleBuffered = enable;
322 return hardwareAccelerated;
327 hardwareAccelerated = enable;
337 this.depthBits = depthBits;
347 this.stencilBits = stencilBits;
360 this.accumRedBits = accumRedBits;
365 return accumGreenBits;
373 this.accumGreenBits = accumGreenBits;
378 return accumBlueBits;
386 this.accumBlueBits = accumBlueBits;
391 return accumAlphaBits;
399 this.accumAlphaBits = accumAlphaBits;
407 sampleExtension = se;
412 return sampleExtension;
424 sampleBuffers = enable;
432 return sampleBuffers;
441 this.numSamples = numSamples;
446 return sampleBuffers ? numSamples : 0;
450 public StringBuilder
toString(StringBuilder sink) {
452 sink =
new StringBuilder();
455 final int samples = sampleBuffers ? numSamples : 0 ;
457 super.toString(sink,
false);
459 sink.append(
", accum-rgba ").append(accumRedBits).append(
ESEP).append(accumGreenBits).append(
ESEP).append(accumBlueBits).append(
ESEP).append(accumAlphaBits);
460 sink.append(
", dp/st/ms ").append(depthBits).append(
ESEP).append(stencilBits).append(
ESEP).append(samples);
462 sink.append(
", sample-ext ").append(sampleExtension);
465 sink.append(
", dbl");
467 sink.append(
", one");
470 sink.append(
", stereo");
472 sink.append(
", mono ");
474 if(hardwareAccelerated) {
475 sink.append(
", hw, ");
477 sink.append(
", sw, ");
479 sink.append(glProfile);
481 sink.append(
", on-scr[");
483 sink.append(
", offscr[");
491 if(ns) { sink.append(
CSEP); }
492 sink.append(
"pbuffer");
496 if(ns) { sink.append(
CSEP); }
497 sink.append(
"bitmap");
504 sink.append(
"auto-cfg");
516 final StringBuilder msg =
new StringBuilder();
517 msg.append(
"GLCaps[");
520 return msg.toString();
Specifies a set of capabilities that a window's rendering context must support, such as color depth p...
static final String CSEP
Component separator.
final int getAlphaBits()
Returns the number of bits for the color buffer's alpha component.
final boolean isOnscreen()
Returns whether an on- or offscreen surface is requested, available or chosen.
boolean isBitmap()
Returns whether bitmap offscreen mode is requested, available or chosen.
static final String ESEP
Element separator.
void setAlphaBits(final int alphaBits)
Sets the number of bits requested for the color buffer's alpha component.
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
Specifies a set of OpenGL capabilities.
GLCapabilities copyFrom(final GLCapabilitiesImmutable source)
Copies all GLCapabilitiesImmutable values from source into this instance.
final boolean isPBuffer()
Returns whether pbuffer offscreen mode is requested, available or chosen.
void setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
final boolean getDoubleBuffered()
Returns whether double-buffering is requested, available or chosen.
boolean equals(final Object obj)
Equality over the immutable attributes of both objects.
final boolean isFBO()
Returns whether FBO offscreen mode is requested, available or chosen.
void setAccumRedBits(final int accumRedBits)
Sets the number of bits requested for the accumulation buffer's red component.
final boolean getSampleBuffers()
Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawab...
GLCapabilities(final GLProfile glp)
Creates a GLCapabilities object.
void setStencilBits(final int stencilBits)
Sets the number of bits requested for the stencil buffer.
void setDoubleBuffered(final boolean enable)
Enables or disables double buffering.
final boolean getHardwareAccelerated()
Returns whether hardware acceleration is requested, available or chosen.
void setHardwareAccelerated(final boolean enable)
Enables or disables hardware acceleration.
void setAccumGreenBits(final int accumGreenBits)
Sets the number of bits requested for the accumulation buffer's green component.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
int hashCode()
Hash code over the immutable attributes.
void setNumSamples(final int numSamples)
If sample buffers are enabled, indicates the number of buffers to be allocated.
final int getNumSamples()
Returns the number of sample buffers to be allocated if sample buffers are enabled,...
void setGLProfile(final GLProfile profile)
Sets the GL profile you desire.
final boolean getStereo()
Returns whether stereo is requested, available or chosen.
final int getAccumGreenBits()
Returns the number of bits for the accumulation buffer's green component.
final int getAccumRedBits()
Returns the number of bits for the accumulation buffer's red component.
StringBuilder toString(StringBuilder sink)
Return a textual representation of this object.
String toString()
Returns a textual representation of this GLCapabilities object.
void setAccumBlueBits(final int accumBlueBits)
Sets the number of bits requested for the accumulation buffer's blue component.
void setStereo(final boolean enable)
Enables or disables stereo viewing.
void setSampleExtension(final String se)
Sets the desired extension for full-scene antialiasing (FSAA), default is DEFAULT_SAMPLE_EXTENSION.
final int getAccumBlueBits()
Returns the number of bits for the accumulation buffer's blue component.
int compareTo(final CapabilitiesImmutable o)
comparing hw/sw, stereo, multisample, stencil, RGBA and depth only
final int getDepthBits()
Returns the number of depth buffer bits.
void setAccumAlphaBits(final int accumAlphaBits)
Sets number of bits requested for accumulation buffer's alpha component.
final String getSampleExtension()
Returns the extension for full-scene antialiasing (FSAA).
GLCapabilities copyFrom(final CapabilitiesImmutable source)
Copies all CapabilitiesImmutable values from source into this instance.
final GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
void setSampleBuffers(final boolean enable)
Defaults to false.
void setDepthBits(final int depthBits)
Sets the number of bits requested for the depth buffer.
final int getAccumAlphaBits()
Returns the number of bits for the accumulation buffer's alpha component.
final int getStencilBits()
Returns the number of stencil buffer bits.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
static AbstractGraphicsDevice getDefaultDevice()
Specifies an immutable set of capabilities that a window's rendering context must support,...
Specifies an immutable set of OpenGL capabilities.
boolean getSampleBuffers()
Returns whether sample buffers for full-scene antialiasing (FSAA) should be allocated for this drawab...
int getAccumGreenBits()
Returns the number of bits for the accumulation buffer's green component.
String getSampleExtension()
Returns the extension for full-scene antialiasing (FSAA).
int getNumSamples()
Returns the number of sample buffers to be allocated if sample buffers are enabled,...
boolean getHardwareAccelerated()
Returns whether hardware acceleration is requested, available or chosen.
int getDepthBits()
Returns the number of depth buffer bits.
boolean isPBuffer()
Returns whether pbuffer offscreen mode is requested, available or chosen.
GLProfile getGLProfile()
Returns the GL profile you desire or used by the drawable.
int getAccumRedBits()
Returns the number of bits for the accumulation buffer's red component.
int getAccumAlphaBits()
Returns the number of bits for the accumulation buffer's alpha component.
boolean equals(Object obj)
Equality over the immutable attributes of both objects.
boolean getDoubleBuffered()
Returns whether double-buffering is requested, available or chosen.
int getAccumBlueBits()
Returns the number of bits for the accumulation buffer's blue component.
boolean isFBO()
Returns whether FBO offscreen mode is requested, available or chosen.
int getStencilBits()
Returns the number of stencil buffer bits.
static final String DEFAULT_SAMPLE_EXTENSION
One of the platform's default sample extension EGL.EGL_SAMPLES, GLX.GLX_SAMPLES, WGLExt....
boolean getStereo()
Returns whether stereo is requested, available or chosen.