1 /*******************************************************************************
2  * Copyright (c) 2005, 2008 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  * Port to the D Programming Language:
11  *     John Reimer <terminal.node@gmail.com>
12  *******************************************************************************/
13 module org.eclipse.swt.opengl.GLData;
14 
15 import java.lang.all;
16 
17 /**
18  * The GLData class is a device-independent description
19  * of the pixel format attributes of a GL drawable.
20  *
21  * @see GLCanvas
22  * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a>
23  * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
24  *
25  * @since 3.2
26  */
27 
28 public class GLData {
29     /**
30      * Specifies a double-buffered surface.  During context
31      * creation, only double-buffered formats are considered
32      * when set to true.
33      */
34     public bool doubleBuffer;
35 
36     /**
37      * Specifies a stereo surface.  During context creation,
38      * only stereo formats are considered when set to true.
39      */
40     public bool stereo;
41 
42     /**
43      * The size in bits of the color buffer's red channel.
44      * During context creation, this specifies the minimum
45      * required red bits.
46      */
47     public int redSize;
48 
49     /**
50      * The size in bits of the color buffer's green channel.
51      * During context creation, this specifies the minimum
52      * required green bits.
53      */
54     public int greenSize;
55 
56     /**
57      * The size in bits of the color buffer's blue channel.
58      * During context creation, this specifies the minimum
59      * required blue bits.
60      */
61     public int blueSize;
62 
63     /**
64      * The size in bits of the color buffer's alpha channel.
65      * During context creation, this specifies the minimum
66      * required alpha bits.
67      */
68     public int alphaSize;
69 
70     /**
71      * The size in bits of the depth buffer.  During context
72      * creation, the smallest depth buffer of at least the
73      * specified value is preferred, or zero for no depth
74      * buffer.
75      */
76     public int depthSize;
77 
78     /**
79      * The desired number of stencil bitplanes.  During
80      * context creation, the smallest stencil buffer of at
81      * least the specified value is preferred, or zero for
82      * no stencil buffer.
83      */
84     public int stencilSize;
85 
86     /**
87      * The size in bits of the accumulation buffer's red
88      * channel. During context creation, this specifies the
89      * minimum required red bits.
90      */
91     public int accumRedSize;
92 
93     /**
94      * The size in bits of the accumulation buffer's green
95      * channel. During context creation, this specifies the
96      * minimum required green bits.
97      */
98     public int accumGreenSize;
99 
100     /**
101      * The size in bits of the accumulation buffer's blue
102      * channel. During context creation, this specifies the
103      * minimum required blue bits.
104      */
105     public int accumBlueSize;
106 
107     /**
108      * The size in bits of the accumulation buffer's alpha
109      * channel. During context creation, this specifies the
110      * minimum required alpha bits.
111      */
112     public int accumAlphaSize;
113 
114     /**
115      * The number of multisample buffers used by this context.
116      * During context creation, this specifies the minimum
117      * number of multisample buffers requested.
118      */
119     public int sampleBuffers;
120 
121     /**
122      * The number of samples accepted in the multisample buffer.
123      * During creation, pixel formats with the smallest number of
124      * samples that meets or exceeds the specified minimum number
125      * are preferred.
126      */
127     public int samples;
128 
129 /**
130  * Returns a string containing a concise, human-readable
131  * description of the receiver.
132  *
133  * @return a string representation of the data
134  */
135 override public String toString() {
136     String string = doubleBuffer ? "doubleBuffer," : "";
137     string ~= stereo ? "stereo," : "";
138     string ~= "r:" ~     String_valueOf(redSize)  ~ " g:" ~ String_valueOf(greenSize) ~
139               " b:" ~    String_valueOf(blueSize) ~ " a:" ~ String_valueOf(alphaSize) ~ "," ~
140               "depth:" ~ String_valueOf(depthSize) ~ ",stencil:" ~ String_valueOf(stencilSize) ~
141               ",accum r:" ~ String_valueOf(accumRedSize) ~ "g:" ~ String_valueOf(accumGreenSize) ~
142               "b:" ~ String_valueOf(accumBlueSize) ~ "a:" ~ String_valueOf(accumAlphaSize) ~
143               ",sampleBuffers:" ~ String_valueOf(sampleBuffers) ~ ",samples:" ~ String_valueOf(samples);
144     return string;
145 }
146 }