JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
MultisampleChooser01.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright (c) 2010 JogAmp Community. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * - Redistribution of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * - Redistribution in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of Sun Microsystems, Inc. or the names of
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * This software is provided "AS IS," without a warranty of any kind. ALL
21 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
22 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
23 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
24 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
25 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
26 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
27 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
28 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
29 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
30 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
31 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 *
33 * You acknowledge that this software is not designed or intended for use
34 * in the design, construction, operation or maintenance of any nuclear
35 * facility.
36 *
37 * Sun gratefully acknowledges that this software was originally authored
38 * and developed by Kenneth Bradley Russell and Christopher John Kline.
39 */
40package com.jogamp.opengl.test.junit.jogl.caps;
41
42import java.util.List;
43
44import com.jogamp.nativewindow.CapabilitiesImmutable;
45import com.jogamp.opengl.DefaultGLCapabilitiesChooser;
46import com.jogamp.opengl.GLCapabilitiesImmutable;
47
48class MultisampleChooser01 extends DefaultGLCapabilitiesChooser {
49
50 @Override
51 public int chooseCapabilities(final CapabilitiesImmutable desired,
52 final List<? extends CapabilitiesImmutable> available,
53 final int windowSystemRecommendedChoice) {
54 boolean anyHaveSampleBuffers = false;
55 for (int i = 0; i < available.size(); i++) {
56 final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) available.get(i);
57 if ( caps.getSampleBuffers() ) {
58 anyHaveSampleBuffers = true;
59 break;
60 }
61 }
62 final int selection = super.chooseCapabilities(desired, available, windowSystemRecommendedChoice);
63 if (!anyHaveSampleBuffers) {
64 System.err.println("WARNING: antialiasing will be disabled because none of the available pixel formats had it to offer");
65 } else {
66 final GLCapabilitiesImmutable selected = (GLCapabilitiesImmutable) available.get(selection);
67 if (!selected.getSampleBuffers()) {
68 System.err.println("WARNING: antialiasing will be disabled because the DefaultGLCapabilitiesChooser didn't supply it");
69 }
70 }
71 return selection;
72 }
73}
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...