25
|
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
|
|
14 module org.eclipse.swt.opengl.GLData;
|
|
15
|
|
16 import java.lang.all;
|
|
17
|
48
|
18 version(Tango){
|
51
|
19 import tango.text.Util;
|
|
20 import tango.util.Convert;
|
48
|
21 } else { // Phobos
|
51
|
22 import std.conv;
|
48
|
23 }
|
25
|
24
|
|
25 /**
|
|
26 * The GLData class is a device-independent description
|
|
27 * of the pixel format attributes of a GL drawable.
|
|
28 *
|
|
29 * @see GLCanvas
|
|
30 * @see <a href="http://www.eclipse.org/swt/snippets/#opengl">OpenGL snippets</a>
|
|
31 * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>
|
|
32 *
|
|
33 * @since 3.2
|
|
34 */
|
|
35
|
|
36 public class GLData {
|
|
37 /**
|
|
38 * Specifies a double-buffered surface. During context
|
|
39 * creation, only double-buffered formats are considered
|
|
40 * when set to true.
|
|
41 */
|
|
42 public bool doubleBuffer;
|
|
43
|
|
44 /**
|
|
45 * Specifies a stereo surface. During context creation,
|
|
46 * only stereo formats are considered when set to true.
|
|
47 */
|
|
48 public bool stereo;
|
|
49
|
|
50 /**
|
|
51 * The size in bits of the color buffer's red channel.
|
|
52 * During context creation, this specifies the minimum
|
|
53 * required red bits.
|
|
54 */
|
|
55 public int redSize;
|
|
56
|
|
57 /**
|
|
58 * The size in bits of the color buffer's green channel.
|
|
59 * During context creation, this specifies the minimum
|
|
60 * required green bits.
|
|
61 */
|
|
62 public int greenSize;
|
|
63
|
|
64 /**
|
|
65 * The size in bits of the color buffer's blue channel.
|
|
66 * During context creation, this specifies the minimum
|
|
67 * required blue bits.
|
|
68 */
|
|
69 public int blueSize;
|
|
70
|
|
71 /**
|
|
72 * The size in bits of the color buffer's alpha channel.
|
|
73 * During context creation, this specifies the minimum
|
|
74 * required alpha bits.
|
|
75 */
|
|
76 public int alphaSize;
|
|
77
|
|
78 /**
|
|
79 * The size in bits of the depth buffer. During context
|
|
80 * creation, the smallest depth buffer of at least the
|
|
81 * specified value is preferred, or zero for no depth
|
|
82 * buffer.
|
|
83 */
|
|
84 public int depthSize;
|
|
85
|
|
86 /**
|
|
87 * The desired number of stencil bitplanes. During
|
|
88 * context creation, the smallest stencil buffer of at
|
|
89 * least the specified value is preferred, or zero for
|
|
90 * no stencil buffer.
|
|
91 */
|
|
92 public int stencilSize;
|
|
93
|
|
94 /**
|
|
95 * The size in bits of the accumulation buffer's red
|
|
96 * channel. During context creation, this specifies the
|
|
97 * minimum required red bits.
|
|
98 */
|
|
99 public int accumRedSize;
|
|
100
|
|
101 /**
|
|
102 * The size in bits of the accumulation buffer's green
|
|
103 * channel. During context creation, this specifies the
|
|
104 * minimum required green bits.
|
|
105 */
|
|
106 public int accumGreenSize;
|
|
107
|
|
108 /**
|
|
109 * The size in bits of the accumulation buffer's blue
|
|
110 * channel. During context creation, this specifies the
|
|
111 * minimum required blue bits.
|
|
112 */
|
|
113 public int accumBlueSize;
|
|
114
|
|
115 /**
|
|
116 * The size in bits of the accumulation buffer's alpha
|
|
117 * channel. During context creation, this specifies the
|
|
118 * minimum required alpha bits.
|
|
119 */
|
|
120 public int accumAlphaSize;
|
|
121
|
|
122 /**
|
|
123 * The number of multisample buffers used by this context.
|
|
124 * During context creation, this specifies the minimum
|
|
125 * number of multisample buffers requested.
|
|
126 */
|
|
127 public int sampleBuffers;
|
|
128
|
|
129 /**
|
|
130 * The number of samples accepted in the multisample buffer.
|
|
131 * During creation, pixel formats with the smallest number of
|
|
132 * samples that meets or exceeds the specified minimum number
|
|
133 * are preferred.
|
|
134 */
|
|
135 public int samples;
|
|
136
|
|
137 /**
|
|
138 * Returns a string containing a concise, human-readable
|
|
139 * description of the receiver.
|
|
140 *
|
|
141 * @return a string representation of the data
|
|
142 */
|
|
143
|
|
144 override public String toString() {
|
|
145 String string = doubleBuffer ? "doubleBuffer," : "";
|
|
146 string ~= stereo ? "stereo," : "";
|
|
147 string ~= "r:" ~ to!(String)(redSize) ~ " g:" ~ to!(String)(greenSize) ~
|
|
148 " b:" ~ to!(String)(blueSize) ~ " a:" ~ to!(String)(alphaSize) ~ "," ~
|
|
149 "depth:" ~ to!(String)(depthSize) ~ ",stencil:" ~ to!(String)(stencilSize) ~
|
|
150 ",accum r:" ~ to!(String)(accumRedSize) ~ "g:" ~ to!(String)(accumGreenSize) ~
|
|
151 "b:" ~ to!(String)(accumBlueSize) ~ "a:" ~ to!(String)(accumAlphaSize) ~
|
|
152 ",sampleBuffers:" ~ to!(String)(sampleBuffers) ~ ",samples:" ~ to!(String)(samples);
|
|
153 return string;
|
|
154 }
|
|
155 }
|