JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
DefaultGraphicsConfiguration.java
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 Sun Microsystems, Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * - Redistribution of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * - Redistribution in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * Neither the name of Sun Microsystems, Inc. or the names of
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
18 *
19 * This software is provided "AS IS," without a warranty of any kind. ALL
20 * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
21 * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
22 * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
23 * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
24 * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
25 * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
26 * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
27 * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
28 * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
29 * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
30 * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
31 */
32
33package com.jogamp.nativewindow;
34
35import com.jogamp.nativewindow.VisualIDHolder.VIDType;
36
37import jogamp.nativewindow.Debug;
38
40 protected static final boolean DEBUG = Debug.debug("GraphicsConfiguration");
41
42 private AbstractGraphicsScreen screen;
45
47 final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested) {
48 if(null == screen) {
49 throw new IllegalArgumentException("Null screen");
50 }
51 if(null == capsChosen) {
52 throw new IllegalArgumentException("Null chosen caps");
53 }
54 if(null == capsRequested) {
55 throw new IllegalArgumentException("Null requested caps");
56 }
57 this.screen = screen;
58 this.capabilitiesChosen = capsChosen;
59 this.capabilitiesRequested = capsRequested;
60 }
61
62 @Override
63 public Object clone() {
64 try {
65 return super.clone();
66 } catch (final CloneNotSupportedException e) {
67 throw new NativeWindowException(e);
68 }
69 }
70
71 @Override
73 return screen;
74 }
75
76 @Override
78 return capabilitiesChosen;
79 }
80
81 @Override
84 }
85
86 @Override
88 return this;
89 }
90
91 @Override
92 final public int getVisualID(final VIDType type) throws NativeWindowException {
94 }
95
96 @Override
97 final public boolean isVisualIDSupported(final VIDType type) {
99 }
100
101 /**
102 * Set the capabilities to a new value.
103 *
104 * <p>
105 * The use case for setting the Capabilities at a later time is
106 * a change or re-validation of capabilities.
107 * </p>
108 * @see com.jogamp.nativewindow.GraphicsConfigurationFactory#chooseGraphicsConfiguration(Capabilities, CapabilitiesChooser, AbstractGraphicsScreen)
109 */
110 protected void setChosenCapabilities(final CapabilitiesImmutable capsChosen) {
111 this.capabilitiesChosen = capsChosen;
112 }
113
114 /**
115 * Set a new screen.
116 *
117 * <p>
118 * the use case for setting a new screen at a later time is
119 * a change of the graphics device in a multi-screen environment.
120 * </p>
121 */
122 protected void setScreen(final AbstractGraphicsScreen screen) {
123 this.screen = screen;
124 }
125
126 @Override
127 public String toString() {
128 return getClass().getSimpleName()+"[" + screen +
129 ",\n\tchosen " + capabilitiesChosen+
130 ",\n\trequested " + capabilitiesRequested+
131 "]";
132 }
133
134 public static String toHexString(final int val) {
135 return "0x"+Integer.toHexString(val);
136 }
137
138 public static String toHexString(final long val) {
139 return "0x"+Long.toHexString(val);
140 }
141}
void setScreen(final AbstractGraphicsScreen screen)
Set a new screen.
final CapabilitiesImmutable getRequestedCapabilities()
Return the capabilities used to choose this graphics configuration.
final int getVisualID(final VIDType type)
Returns the native visual ID of the given type if supported, or VID_UNDEFINED if not supported.
void setChosenCapabilities(final CapabilitiesImmutable capsChosen)
Set the capabilities to a new value.
final AbstractGraphicsScreen getScreen()
Return the screen this graphics configuration is valid for.
DefaultGraphicsConfiguration(final AbstractGraphicsScreen screen, final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested)
final boolean isVisualIDSupported(final VIDType type)
Returns true if the given VIDType is supported, otherwise false.
final CapabilitiesImmutable getChosenCapabilities()
Return the capabilities reflecting this graphics configuration, which may differ from the capabilitie...
AbstractGraphicsConfiguration getNativeGraphicsConfiguration()
In case the implementation utilizes a delegation pattern to wrap abstract toolkits,...
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
A marker interface describing a graphics configuration, visual, or pixel format in a toolkit-independ...
A interface describing a graphics screen in a toolkit-independent manner.
Specifies an immutable set of capabilities that a window's rendering context must support,...
int getVisualID(VIDType type)
Returns the native visual ID of the given type if supported, or VID_UNDEFINED if not supported.
boolean isVisualIDSupported(VIDType type)
Returns true if the given VIDType is supported, otherwise false.