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 moduleorg.eclipse.swt.opengl.GLData;
14 15 importjava.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 publicclassGLData {
29 /**
30 * Specifies a double-buffered surface. During context
31 * creation, only double-buffered formats are considered
32 * when set to true.
33 */34 publicbooldoubleBuffer;
35 36 /**
37 * Specifies a stereo surface. During context creation,
38 * only stereo formats are considered when set to true.
39 */40 publicboolstereo;
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 publicintredSize;
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 publicintgreenSize;
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 publicintblueSize;
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 publicintalphaSize;
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 publicintdepthSize;
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 publicintstencilSize;
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 publicintaccumRedSize;
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 publicintaccumGreenSize;
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 publicintaccumBlueSize;
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 publicintaccumAlphaSize;
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 publicintsampleBuffers;
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 publicintsamples;
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 overridepublicStringtoString() {
136 Stringstring = 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 returnstring;
145 }
146 }