Developer Documentation
stipple_alpha.cc
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 
51 //=============================================================================
52 //
53 // Stipple Polygon Transparency - IMPLEMENTATION
54 //
55 //=============================================================================
56 
57 //== INCLUDES =================================================================
58 
59 
60 #include "stipple_alpha.hh"
61 #include "gl.hh"
62 #include <GL/GLState.hh>
63 
64 
65 //== NAMESPACES ===============================================================
66 namespace ACG {
67 //== IMPLEMENTATION ==========================================================
68 
69 
70 const GLubyte stippleMask[17][128] =
71 {
72  /* NOTE: 0% opaqueness is faster to set and probably faster to render with:
73  ACG::GLState::disable(GL_POLYGON_STIPPLE);
74  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); */
75  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
79  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
80  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
81  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
82  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
87  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
91 
92  {0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
93  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
95  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
96  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
97  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
98  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
99  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
100  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
101  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
103  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
104  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
105  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
106  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
107  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
108 
109  {0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
110  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
111  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
112  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
113  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
114  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
115  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
116  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
117  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
118  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
119  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
120  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
121  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
122  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
123  0x88, 0x88, 0x88, 0x88, 0x00, 0x00, 0x00, 0x00,
124  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00},
125 
126  {0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
127  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
128  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
129  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
130  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
131  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
132  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
133  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
134  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
135  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
136  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
137  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
138  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
139  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00,
140  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
141  0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00},
142 
143  {0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
144  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
145  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
146  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
147  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
148  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
149  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
150  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
151  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
152  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
153  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
154  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
155  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
156  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
157  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
158  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00},
159 
160  {0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
161  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
162  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
163  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
164  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
165  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
166  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
167  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
168  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
169  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
170  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
171  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
172  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
173  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00,
174  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
175  0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00},
176 
177  {0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
178  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
179  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
180  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
181  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
182  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
183  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
184  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
185  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
186  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
187  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
188  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
189  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
190  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
191  0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44,
192  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11},
193 
194  {0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
195  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
196  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
197  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
198  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
199  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
200  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
201  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
202  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
203  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
204  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
205  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
206  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
207  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11,
208  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
209  0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11},
210 
211  {0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
212  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
213  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
214  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
215  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
216  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
217  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
218  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
219  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
220  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
221  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
222  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
223  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
224  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
225  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
226  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55},
227 
228  {0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
229  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
230  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
231  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
232  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
233  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
234  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
235  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
236  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
237  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
238  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
239  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
240  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
241  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55,
242  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
243  0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, 0x55, 0x55},
244 
245  {0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
246  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
247  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
248  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
249  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
250  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
251  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
252  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
253  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
254  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
255  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
256  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
257  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
258  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
259  0xee, 0xee, 0xee, 0xee, 0x55, 0x55, 0x55, 0x55,
260  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55},
261 
262  {0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
263  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
264  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
265  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
266  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
267  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
268  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
269  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
270  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
271  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
272  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
273  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
274  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
275  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55,
276  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
277  0xbb, 0xbb, 0xbb, 0xbb, 0x55, 0x55, 0x55, 0x55},
278 
279  {0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
280  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
281  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
282  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
283  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
284  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
285  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
286  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
287  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
288  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
289  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
290  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
291  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
292  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
293  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
294  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55},
295 
296  {0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
297  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
298  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
299  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
300  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
301  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
302  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
303  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
304  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
305  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
306  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
307  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
308  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
309  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55,
310  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
311  0xff, 0xff, 0xff, 0xff, 0x55, 0x55, 0x55, 0x55},
312 
313  {0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
314  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
315  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
316  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
317  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
318  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
319  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
320  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
321  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
322  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
323  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
324  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
325  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
326  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
327  0xff, 0xff, 0xff, 0xff, 0xdd, 0xdd, 0xdd, 0xdd,
328  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77},
329 
330  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
331  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
332  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
333  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
334  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
335  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
336  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
337  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
338  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
339  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
340  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
341  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
342  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
343  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77,
344  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
345  0xff, 0xff, 0xff, 0xff, 0x77, 0x77, 0x77, 0x77},
346 
347  /* NOTE: 100% opaqueness is faster to set and probably faster to render with:
348  ACG::GLState::disable(GL_POLYGON_STIPPLE); */
349  {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
350  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
351  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
352  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
353  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
354  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
355  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
356  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
357  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
358  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
359  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
360  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
361  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
362  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
363  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
364  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
365 };
366 
367 
368 //-----------------------------------------------------------------------------
369 
370 
371 void stipple_alpha(float _alpha)
372 {
373  // transparent
374  if (_alpha < 1.0)
375  {
376  if (_alpha < 0.0) _alpha = 0.0;
377 
378  ACG::GLState::enable(GL_POLYGON_STIPPLE);
379  glPolygonStipple(stippleMask[ (unsigned int)(_alpha * 16.0 + 0.5)]);
380  }
381 
382  // opaque
383  else
384  {
385  ACG::GLState::disable(GL_POLYGON_STIPPLE);
386  }
387 }
388 
389 
390 //=============================================================================
391 } // namespace ACG
392 //=============================================================================
static void enable(GLenum _cap)
replaces glEnable, but supports locking
Definition: GLState.cc:1490
Namespace providing different geometric functions concerning angles.
Definition: DBSCANT.cc:51
static void disable(GLenum _cap)
replaces glDisable, but supports locking
Definition: GLState.cc:1504