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