File: index.html

package info (click to toggle)
opencsg 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 8,980 kB
  • sloc: ansic: 54,939; cpp: 5,252; sh: 1,531; perl: 876; makefile: 595; python: 135
file content (620 lines) | stat: -rw-r--r-- 28,676 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <meta http-equiv="Content-Style-Type" content="text/css">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Florian Kirsch">
  <meta name="KeyWords" content="OpenCSG, CSG, image-based, image-based CSG, rendering, SCS, Goldfeather, OpenGL">

  <title>OpenCSG - The CSG rendering library</title>
</head>

<body style="font-family: verdana,arial,sans-serif; background-color: white;">

<table cellpadding="10" cellspacing="0" border="0">
 <tbody>
  <tr><td><img src="img/logo.gif" alt="OpenCSG logo"></td>
   <td style="text-align: center;">
     <h1> OpenCSG </h1>
     <h3> The CSG rendering library </h3>

     <b>
     <a href="news.html">News</a> &nbsp;&nbsp;
     <a href="#introduction">Introduction</a> &nbsp;&nbsp;
     <a href="#benefits">Benefits</a> &nbsp;&nbsp;
     <a href="#prerequisites">Prerequisites</a> &nbsp;&nbsp;
     <a href="#usage">Usage</a> &nbsp;&nbsp;
     <a href="#download">Download</a> &nbsp;&nbsp;
     <a href="#references">References</a> &nbsp;&nbsp;
     <a href="#background">Background</a> &nbsp;&nbsp;
     <a href="publications.html">Publications</a> &nbsp;&nbsp;
     <a href="#FAQ">FAQ</a> &nbsp;&nbsp;
     <a href="#license">License</a> &nbsp;&nbsp;
     </b>
   </td>
   <td><img src="img/ogl.gif" alt="OpenGL logo"></td>
  </tr>
 </tbody>
</table>

<hr>

<h3> <a href="news.html">Latest release: OpenCSG 1.5.0 (10-Apr-2022)</a></h3>

<hr>

<h3> <a name="introduction">Introduction</a> </h3>

<p>
OpenCSG is a library that does image-based CSG rendering using OpenGL.
OpenCSG is written in C++ and supports most modern graphics hardware using
Microsoft Windows or the Linux operating system. 
<a href="http://www.opencsg.org/OpenCSG-1.5.0.tar.gz">OpenCSG-1.5.0</a> is the current version.
</p>

<p>
What is CSG, anyway? CSG is short for <b>Constructive Solid Geometry</b>
and denotes an approach to model complex 3D-shapes using simpler ones. I.e.,
two shapes can be combined by taking the union of them, by intersecting
them, or by subtracting one shape of the other. The
most basic shapes, which are not result of such a CSG operation,
are called <b>primitives</b>. Primitives must be <b>solid</b>, i.e.,
they must have a clearly defined interior and exterior. By construction,
a CSG shape is also solid then. 
</p>

<p>
Image-based CSG rendering (also z-buffer CSG rendering) is a term
for algorithms that render CSG shapes without an explicit calculation
of the geometric boundary of a CSG shape. Such algorithms use
frame-buffer settings of the graphics hardware, e.g., the depth and stencil
buffer, to compose CSG shapes. <b>OpenCSG</b> implements a variety of 
those algorithms, namely the <b>Goldfeather</b> algorithm and the <b>SCS</b> 
algorithm, both of them in several variants.
</p>

<center><a href="http://www.opencsg.org/img/grid.jpg"><img src="img/grid.gif" border="0" alt="CSG grid"></a></center>

<hr>

<h3> <a name="benefits">Benefits</a> </h3>

<p>
CSG is often used as fundamental modeling technique in CAD/CAM applications.
Here, image-based CSG rendering is the key to interactively manipulate CSG 
shapes. Since OpenCSG renders even complex CSG shapes fast, it can 
be advantageously used in such applications. 
</p>

<p>
Raytracers such as <a href="http://www.povray.org">PovRay</a> have 
used CSG for shape modeling since long ago. Interactive modeling
toolkits for such raytracers normally just ignore CSG commands, though. 
OpenCSG represents a valuable addition for such applications.
</p>

<p>
Before OpenCSG, CSG rendering has been hardly used in interactive 
applications, since the necessary algorithms are complicated and error-prone.
By providing a free library that is easy to use, fast, and portable,
OpenCSG has helped making CSG rendering more mainstream than it was
in the past. 
</p>

<center><a href="http://www.opencsg.org/img/columns.jpg"><img src="img/columns.gif" border="0" alt="CSG columns"></a></center>

<hr>

<h3> <a name="prerequisites">Prerequisites</a> </h3>

<p>
The OpenCSG library requires OpenGL and graphics hardware that runs
OpenGL well. Note that OpenGL ES is currently not supported. The OpenGL
implementation must either provide <b>frame buffer objects</b> or
<b>PBuffers</b>.
</p>

<p>
Frame buffer objects are a more recent extension for OpenGL. They are
easy to develop for, and can be nowadays considered mature.
They are also part of OpenGL 3.0. Beginning with OpenCSG 1.2.0, they
are used by default.
</p>

<p>
In older versions, PBuffers were required to run OpenCSG.
PBuffers have been widely supported since a long time now. NVidia supports them
since the Riva TNT, and ATI at least since the Radeon series. Graphics
hardware from other hardware vendors, however, likely does not support
PBuffers. Therefore, if you have obscure graphics hardware that also does
not support frame buffer objects, you are probably out of luck and you cannot
run programs using OpenCSG. With Linux, you have the option to use 
<a href="http://www.mesa3d.org/">Mesa 3D</a>, which implements OpenGL software
rendering and provides a solid frame buffer object implementation.
</p>

<p>
The PBuffer in OpenCSG is actually implemented via the (patched)
<a href="http://sourceforge.net/project/showfiles.php?group_id=104004&amp;package_id=115053">
RenderTexture class</a>. For OpenGL extension checking, OpenCSG uses the OpenGL Extension Wrangler
Library <a href="http://glew.sourceforge.net">GLEW</a>. Both these libraries are included
in the OpenCSG download.
</p>

<p>
OpenCSG is written in C++, uses namespaces and requires the STL. 
It compiles with all reasonable C++ compilers such as gcc, Clang, or 
Microsoft Visual Studio. Workspaces for Visual Studio 2019, Visual C++ 6.
and <a href="http://www.bloodshed.net/devcpp.html">Dev-C++ 5 beta</a> are
provided. Under Linux, any gcc compiler starting from version 3.0 or newer will work.
</p>

<p>
OpenCSG has been sucessfully run on Intel and AMD CPUs. Generally,
NVidia and AMD graphics hardware is well supported, and hardware
where OpenCSG successfully has been run on includes everything
starting from the TNT2 (but admittedly, on the latter, it crawls ...).
</p>

<p>
On a Radeon 9000, OpenCSG was once known to produce rendering errors
in all but the standard Goldfeather rendering path. It is unclear if
this was possibly a driver issue.
</p>

<p>
On graphics hardware from Intel, OpenCSG did not work so well in the past.
Recent OpenCSG versions contain fixes and workarounds for some bugs
reported for Intel hardware. It still remains to be seen if all known issues
are fixed now. Generally, use the most recent graphics drivers, in particular
for HD 3000 or HD 4000 hardware. Furthermore, the (non-default) Goldfeather
rendering path generally appears to produce more robust rendering results
compared to the SCS rendering path.
</p>

<center><a href="http://www.opencsg.org/img/conc.jpg"><img src="img/conc.gif" border="0" alt="CSG convace shape"></a></center>

<hr>

<h3> <a name="usage">Usage</a> </h3>

<p>
<a name="primitive"></a>
The interface of OpenCSG is very easy to use. There
is only a single abstract class called <code><b>OpenCSG::Primitive</b></code>.
<a name="interfaceoperation"></a>
A <code>Primitive</code> object has an attribute <code><b>Operation</b></code>
that denotes whether the primitive is intersected or subtracted. 
To use OpenCSG, create a derived concrete primitive class by 
implementing the <code>render()</code> method. 
</p>

<p>
<a name="rendershape"></a>
To actually do the CSG rendering, there is the function <code><b>OpenCSG::render()</b></code> 
that takes a <code>std::vector&lt;Primitive*&gt;</code> as argument. 
The render function evaluates the CSG expression given by the array of primitives
and initializes the z-buffer with the proper values for the CSG expression.
The color buffer remains unchanged, so afterwards, you must shade
the primitives in the array using a <code>GL_EQUAL</code> depth function.
</p>

<p>
Note that the render function does not evaluate a generic CSG tree that
also would contain unions of CSG shapes. It has been shown that a
generic CSG tree can be converted into an equivalent set of CSG expressions
that the render function can handle. OpenCSG does not contain the 
functionality for this conversion since, after all, it is a rendering
library. 
</p>

<p>
Here is the complete interface of OpenCSG:
</p>
<p>
<code>
namespace OpenCSG { <br>
<br>
&nbsp; enum <b><a href="#interfaceoperation">Operation</a></b> { <b>Intersection</b>, <b>Subtraction</b> }; <br>
<br>
&nbsp; <b><a href="#primitive">class Primitive</a></b> { <br>
&nbsp; public: <br>
&nbsp;&nbsp; <b><a href="#primitive">Primitive</a></b>(Operation, unsigned int convexity); <br>
&nbsp;&nbsp; virtual <b><a href="#primitive">~Primitive</a></b>(); <br>
<br>
&nbsp;&nbsp; void <b><a href="#interfaceoperation">setOperation</a></b>(Operation); <br>
&nbsp;&nbsp; Operation <b><a href="#interfaceoperation">getOperation</a></b>() const; <br>
<br>
&nbsp;&nbsp; void <b><a href="#interfaceconvexity">setConvexity</a></b>(unsigned int); <br>
&nbsp;&nbsp; unsigned int <b><a href="#interfaceconvexity">getConvexity</a></b>() const; <br>
<br>
&nbsp;&nbsp; void <b><a href="#interfacebounds">setBoundingBox</a></b>(float  minx, float  miny, float  minz, <br>
&nbsp;&nbsp;&nbsp;&nbsp; float  maxx, float  maxy, float  maxz); <br>
&nbsp;&nbsp; void <b><a href="#interfacebounds">getBoundingBox</a></b>(float&amp; minx, float&amp; miny, float&amp; minz, <br>
&nbsp;&nbsp;&nbsp;&nbsp; float&amp; maxx, float&amp; maxy, float&amp; maxz) const; <br>
<br>
&nbsp;&nbsp; <b><a href="#interfacerenderprimitive">virtual void render</a></b>() = 0; <br>
&nbsp; }; <br>
<br>
&nbsp; enum <b><a href="#options">OptionType</a></b> { <br>
&nbsp;&nbsp; <b><a href="#algorithm">AlgorithmSetting</a></b>, <br>
&nbsp;&nbsp; <b><a href="#depthalgorithm">DepthComplexitySetting</a></b>, <br>
&nbsp;&nbsp; <b><a href="#offscreentype">OffscreenSetting</a></b>, <br>
&nbsp;&nbsp; <b><a href="#depthboundsoptimization">DepthBoundsOptimization</a></b>, <br>
&nbsp; }; <br>
<br>
&nbsp; void <b><a href="#options">setOption</a></b>(OptionType option, int newSetting);<br>
&nbsp; int <b><a href="#options">getOption</a></b>(OptionType option); <br>
<br>
&nbsp; enum <b><a href="#algorithm">Algorithm</a></b> { <b>Automatic</b>, <b>Goldfeather</b>, <b>SCS</b> }; <br>
&nbsp; enum <b><a href="#depthalgorithm">DepthComplexityAlgorithm</a></b> { <b>NoDepthComplexitySampling</b>, <b>OcclusionQuery</b>, <b>DepthComplexitySampling</b> }; <br>
&nbsp; enum <b><a href="#offscreentype">OffscreenType</a></b> { <b>AutomaticOffscreenType</b>, <b>FrameBufferObject</b>, <b>PBuffer</b>, <b>FrameBufferObjectARB</b>, <b>FrameBufferObjectEXT</b> }; <br>
&nbsp; enum <b><a href="#optimization">Optimization</a></b> { <b>OptimizationDefault</b>, <b>OptimizationDefault</b>, <b>OptimizationOn</b>, <b>OptimizationOff</b> }; <br>
<br>
&nbsp; void <b><a href="#rendershape">render</a></b>(const std::vector&lt;Primitive*&gt;&amp; primitives); <br>
<br>
&nbsp; void <b><a href="#context">setContext</a></b>(int context); <br>
&nbsp; int <b><a href="#context">getContext</a></b>(); <br>
&nbsp; void <b><a href="#context">freeResources</a></b>(); <br>
} <br>
</code>
</p>

<p>
<a name="interfaceconvexity"></a>
The <b>convexity</b> of a primitive is the maximum number of front (or back) 
faces of the primitive at a single position. For example, the convexity
of a sphere is one and the convexity of a torus is two. Actually 
the convexity attribute is currently only used in the standard Goldfeather
algorithm. For this algorithm, a convexity too low may result in
rendering errors, a convexity too high will reduce rendering 
performance. The other Goldfeather variants render primitives of any
convexity correctly without analyzing the convexity attribute. 
The SCS algorithms, on the other hand, can only handle primitives 
that have a convexity of one, else they produce rendering errors. 
Hence, SCS algorithms do not check this attribute. 
</p>

<p>
<a name="interfacebounds"></a>
The <b>bounding box</b> of the primitive can be provided using normal device
coordinates, i.e., after transforming the primitive with modelview and 
projection transformation. It is not necessary to set the bounding
box, but it allows for various performance optimizations.
</p>

<p>
<a name="interfacerenderprimitive"></a>
The abstract <b><code>render</code> method</b> of the primitive is implemented in a
derived class. Your implementation must not alter the modelview or projection 
matrix (use <code>glPushMatrix</code> / <code>glPopMatrix</code> if in doubt).
Also you must not change the primary color in your implementation, since 
OpenCSG uses it internally (in all rendering algorithms). For best performance, 
you should only transmit vertex positions; no normals, texture coordinates, or 
whatever else.
</p>

<p>
The <b><code>render</code> function</b> performs, as said above, z-shading of
a CSG expression. The content of the stencil buffer is destroyed when
handling concave primitives or when using the <code>DepthComplexitySampling</code> 
strategy.
</p>

<p>
<a name="options"></a>
Using the functions <b><code>setOption() / getOption()</code></b> you can control
and ask for certain settings used when rendering a CSG expression. You can
specify the 
<a href="#algorithm"> Algorithm</a>, the method of 
<a href="#depthalgorithm">depth
complexity usage</a> and the <a href="#offscreentype">type of offscreen
buffer</a>.
</p>

<p>
<a name="algorithm"></a>
The <b><code>Algorithm</code></b> parameter specifies the method used for CSG rendering.
Besides <code>Goldfeather</code> and <code>SCS</code>, you can also choose
<b><code>Automatic</code></b>: This setting chooses the Goldfeather algorithm if 
the primitive array contains concave primitives, else it chooses SCS. 
The automatic setting also sets the <code>DepthComplexityAlgorithm</code> 
(<code>NoDepthComplexitySampling</code> for arrays with few primitives, 
else <code>OcclusionQuery</code> or at the last resort <code>DepthComplexitySampling</code>).
</p>

<p>
Aforesaid means that it is, currently, not possible to do CSG
rendering of concave primitives and preserving the stencil buffer. I am
looking for ways to change this situation (The ARB_buffer_region extension 
appears to be a possible way for this). 
</p>

<p>
<a name="depthalgorithm"></a>
If the <code>Automatic</code> setting is not used,
the <b><code>DepthComplexityAlgorithm</code></b> parameter specifies the strategy 
for profiting from depth complexity.
</p>
<ul>
<li><code>NoDepthComplexitySampling</code>: Does not employ the depth complexity.
  This essentially makes the algorithm O(n), but with low constant costs.</li>
<li><code>DepthComplexitySampling</code>: Calculates the depth complexity k using
  the stencil buffer. This makes the algorithm O(n*k), but with high constant costs. 
  In case of the Goldfeather algorithm, the literature denotes this as 
  layered Goldfeather algorithm.</li>
<li><code>OcclusionQuery</code>: Uses occlusion queries to profit implicitly from
  depth complexity without calculating it. This is especially useful for 
  the SCS algorithm where this strategy is applied at shape level, resulting in a 
  O(n*k') algorithm (where k' <= k), without significant constant overhead. 
  This strategy requires hardware occlusion queries, i.E., the OpenGL extensions
  <code>GL_ARB_occlusion_query</code>, eventually <code>GL_ARB_occlusion_query2</code>,
  or <code>GL_NV_occlusion_query</code>.</li>
</ul>

<p>
<a name="offscreentype"></a>
The offscreen type specifies what kind of offscreen buffer OpenCSG uses for
internal CSG calculations. The default <code>AutomaticOffscreenType</code>
preferably uses, if the required OpenGL extensions are available,
<code>FrameBufferObjectARB</code>, then <code>FrameBufferObjectEXT</code>, then <code>PBuffer</code>.
The <code>FrameBufferObject</code> uses preferably <code>FrameBufferObjectARB</code>,
then <code>FrameBufferObjectEXT</code>. These priorities are subject to change
between different releases based on experiences with compatibility of OpenCSG
with different extensions and graphics hardware. The remaining settings <code>PBuffer</code>,
<code>FrameBufferObjectARB</code>, and <code>FrameBufferObjectEXT</code> directly map
to the usage of the corresponding OpenGL extension. Overall, using
frame buffer objects is potentially faster, because they do not impose
a separate rendering context for the offscreen buffer and hence require
no context switching. In typical scenarios, there is no difference though.
</p>

<p>
<a name="depthboundsoptimization"></a>
The depth bounds optimization improves the rendering performance by using
the OpenGL extension <code>GL_EXT_depth_bounds_test</code> to restrict
rendering to only the depth range indicated by the bounding box of a 
primitive. This optimization is, by default, turned off. If you enable
it, ensure that the z-ranges of the bounding boxes are large enough,
otherwise they will not be correctly rendered. The gains you will get
from this optimization is probably only small. 
</p>

<p>
<a name="context"></a>
OpenCSG creates, and reuses between different <code>render()</code> calls,
various OpenGL resources such as PBuffers or frame buffer objects. This
may be a problem in MDI applications with several OpenGL windows, of which
the OpenGL contexts are not shared. In this case, OpenGL resources allocated
in one OpenGL context cannot be reused with another context, so OpenCSG
would produce rendering errors. To solve this, the OpenCSG context
can be set to some unique integer identifier of the OpenGL window.
OpenCSG then creates/uses OpenGL resources in the <code>render()</code>
function per context. The function <code>freeResources()</code> frees
OpenGL resources for the currently active OpenCSG context. 
</p>

<center><a href="http://www.opencsg.org/img/grid.jpg"><img src="img/grid.gif" border="0" alt="CSG grid"></a></center>

<hr>

<h3> <a name="download">Download</a> </h3>

<p>
Download <a href="http://www.opencsg.org/OpenCSG-1.5.0.tar.gz">OpenCSG-1.5.0.tar.gz</a>.
The archive contains all required helper libraries, i.e., also RenderTexture and GLEW.
It comes with makefiles for Linux and with project files for Visual Studio 2019,
Visual C++ 6, and Dev-C++ 5. It is released with GPL version 2 or newer.
</p>

<p>
Older versions were GPL version 2 only. They are still available for download:<br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.4.2.tar.gz">OpenCSG-1.4.2</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.4.1.tar.gz">OpenCSG-1.4.1</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.4.0.tar.gz">OpenCSG-1.4.0</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.3.3.tar.gz">OpenCSG-1.3.3</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.3.2.tar.gz">OpenCSG-1.3.2</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.3.1.tar.gz">OpenCSG-1.3.1</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.3.0.tar.gz">OpenCSG-1.3.0</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.2.0.tar.gz">OpenCSG-1.2.0</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.1.1.tar.gz">OpenCSG-1.1.1</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.1.0.tar.gz">OpenCSG-1.1.0</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.0.2.zip">OpenCSG-1.0.2</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.0.1.zip">OpenCSG-1.0.1</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-1.0.0.zip">OpenCSG-1.0.0</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-0.9.2.zip">OpenCSG-0.9.2</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-0.9.1.zip">OpenCSG-0.9.1</a> <br>
&nbsp;&nbsp; <a href="http://www.opencsg.org/OpenCSG-0.9.zip">OpenCSG-0.9</a> <br>
</p>

<p>
Development snapshots may be pulled from <a href="https://github.com/floriankirsch/OpenCSG">github</a>. These do not include GLEW.
</p>

<center><a href="http://www.opencsg.org/img/columns.jpg"><img src="img/columns.gif" border="0" alt="CSG columns"></a></center>

<hr>

<h3> <a name="references">References</a> </h3>

<p>
Currently, I know of the following applications making use of OpenCSG:
</p>

<table cellpadding="10" cellspacing="0" border="0" style="text-align: left;">
<tbody>
<tr>
<td valign="top" style="text-align: center;"><a href="http://openscad.org/"><img src="img/openscad.png" alt="Icon for OpenSCAD" /></a></td>
<td>
	<a href="http://openscad.org/">OpenSCAD</a> is a software
	for creating solid 3D CAD objects by means of a scripting language.
	It supports interactive preview of the CSG geometry as well as
	exporting the final geometry as 3D model. There are precompiled
	binaries for Linux, Windows, and MacOS X. 
</td>
</tr>
<tr>
<td valign="top" style="text-align: center;"><a href="http://ayam.sourceforge.net">Ayam</a></td>
<td>
	<a href="http://ayam.sourceforge.net">Ayam</a> is a 3D modelling environment for the RenderMan interface, 
	running on Unix, Win32, and Mac OS X. Since version 1.8, Ayam provides the plugin aycsg for real-time CSG preview of complex CSG hierarchies using OpenCSG as rendering library. 
</td>
</tr>
<tr>
<td valign="top" style="text-align: center;"><a href="http://vision.kuee.kyoto-u.ac.jp/~nob/proj/ibvfi/"><img src="img/ibvfi.png" alt="Image-based View Frustum Application Screenshot" /></a></td>
<td>
	<a href="http://vision.kuee.kyoto-u.ac.jp/~nob/proj/ibvfi/">
        Image-based Visual Frustum Intersection</a>. A scientific project
        to reconstruct and visualize the 3D shape of an object, based on
        some projections of the object gathered by camera's around.
        The algorithm is capable of dealing with refractive
        distortions when the object is inside a water bowl.
</td>
</tr>
<tr>
<td valign="top" style="text-align: center;"><a href="http://neuron-ai.tuke.sk/~wagner/projects-csg.php">KoraX CSG-Editor</a></td>
<td>
	<a href="http://neuron-ai.tuke.sk/~wagner/projects-csg.php">koraX's CSG Editor</a>. This editor for
	MS Windows allows to compose textured CSG shapes from a set of predefined primitives. The application
	contains a very good online help that depicts nicely what CSG is about, and that furthermore
	contains some tutorial how to create 1) a graphical widget and 2) a pipe.
</td>
</tr>
</tbody>
</table>

<center><a href="http://www.opencsg.org/img/conc.jpg"><img src="img/conc.gif" border="0" alt="CSG concave shape"></a></center>

<hr>

<h3> <a name="background">Background</a> </h3>

<p>
I have developed the algorithms for OpenCSG in my time as research assistent
at HPI at the University Potsdam. In this time the following publications 
about OpenCSG and about image-based CSG rendering have been written:
</p>

<table cellpadding="10" cellspacing="0" border="0" style="text-align: left;">
<tbody>
<tr>
<td valign="top" style="text-align: center;"><a href="http://www.opencsg.org/publications.html#wscg"><img src="img/drivetrain.gif" alt="WSCG04-Icon" /></a></td>
<td>
<p><b>F. Kirsch, J. Dllner: 
      <a href="http://www.opencsg.org/publications.html#wscg">Rendering Techniques for Hardware-Accelerated Image-Based CSG</a>.
</b> Journal of WSCG, 12(2):221-228, 2004. </p>
<p> This paper gives an introduction to image-based CSG rendering and describes
    the two techniques that are used in OpenCSG to accelerate rendering compared
    to older implementations: Visibility transfer using textures and occlusion
    queries for the SCS algorithm. </p>
</td>
</tr>
<tr>
<td valign="top" style="text-align: center;"><a href="http://www.opencsg.org/publications.html#freenix"><img src="img/opencsglogo.gif" alt="OpenCSG-Icon" /></a></td>
<td>
<p><b>F. Kirsch, J. Dllner:
      <a href="http://www.opencsg.org/publications.html#freenix">OpenCSG: A Library for Image-Based CSG Rendering</a>.
</b> Proceedings of the FREENIX / Open Source Track, 2005 USENIX Annual Technical Conference, 129-140, 2005. </p>
<p> This paper describes OpenCSG itself. It concentrates on the API, explaining
    internal implementation details only as shortly as possible. It also outlines
    possible non-obvious uses of OpenCSG. </p>
</td>
</tr>
<tr>
<td valign="top" style="text-align: center;"><a href="http://www.opencsg.org/publications.html#diss"><img src="img/diss.gif" alt="Dissertation-Icon" /></a></td>
<td>
<p><b>F. Kirsch:
      <a href="http://www.opencsg.org/publications.html#diss">Entwurf und Implementierung eines computergraphischen Systems zur Integration komplexer, echtzeitfhiger 3D-Renderingverfahren</a>.
</b>Published online, URN: <a href="http://opus.kobv.de/ubp/volltexte/2005/607/">urn:nbn:de:kobv:517-opus-6079</a>, 2005. </p>
<p> My doctoral dissertation (in german) describes an approach for integration
    and combination of several rendering techniques using a scene graph system. 
    As such, it contains a long chapter covering CSG rendering. </p>
</td>
</tr>
</tbody>
</table>

<center><a href="http://www.opencsg.org/img/grid.jpg"><img src="img/grid.gif" border="0" alt="CSG columns"></a></center>

<hr>

<h3> <a name="FAQ">FAQ</a> </h3>

<ol>
  <li>
    <p><b>Can I render a shape with
    different colors? The documentation says I must not change the primary
    color in the function of my class for primitives, since
    OpenCSG uses the color for internal purposes.</b> </p>
    <p> You can shade your shapes with whatever color you want.
      While your primitive objects for use in OpenCSG must not use
    the primary color, after calculating z-values with OpenCSG you are free
    to render the same geometry with primary colors. </p>
  </li>
  <li>
    <p><b>Does OpenCSG require a stencil buffer?</b> </p>
    <p>You must setup a stencil buffer in your application when rendering
        concave primitives or when using <code>DepthComplexitySampling</code>.
        Internally, the stencil buffer is always needed in OpenCSG
        when rendering into the offscreen frame buffer object resp. PBuffer.</p>
  </li>
  <li>
    <p><b>Can OpenCSG calculate the geometry of a CSG expression?</b> </p>
    <p> No, unfortunately this is not possible using image-based CSG algorithms
        (at least not in a trivial way). If you require this, have a look
        at other libraries such as the
        <a href="http://gts.sourceforge.net">GTS library</a>. </p>
  </li>
  <li>
    <p><b>What are the dependencies of the example program?</b> </p>
    <p> The OpenCSG example requires <a href="http://www.opengl.org/resources/libraries/glut.html">GLUT</a> or <a href="http://freeglut.sourceforge.net">
        FreeGLUT</a>. One of these libraries is likely pre-installed with your
        favorite linux installation. Visual Studio users should compile or
	download FreeGLUT, or with older versions of Visual Studio they may install
        <a href="http://www.xmission.com/~nate/glut.html">GLUT for Windows</a>.
        Dev-C++ users can install the <a href="http://mywebpage.netscape.com/PtrPck/glut.htm">precompiled GLUT for Mingw32</a>. </p>
  </li>
</ol>

<center><a href="http://www.opencsg.org/img/columns.jpg"><img src="img/columns.gif" border="0" alt="CSG columns"></a></center>

<hr>

<h3> <a name="license">License</a> </h3>

<p>
OpenCSG is copyrighted by Florian Kirsch and by the Hasso-Plattner-Institute
at the University of Potsdam (HPI), Germany.
</p>

<p>
Since version 1.5.0, you can license OpenCSG by terms of the
<a href="http://www.gnu.org/copyleft/gpl.html">GNU GPL</a>,
version 2 or later. This means that you may release applications or libraries
that use (parts of) OpenCSG 
(a) only if you release the complete source code of your application or library
and (b) only if you release it under the GPL license. Versions before 1.5.0
could be licensed under the GPL version 2 only.
</p>

<p>
Note that OpenCSG comes with code that is not under copyright
of the HPI or Florian Kirsch. These are <a href="http://glew.sourceforge.net/">GLEW</a>
and <a href="http://sourceforge.net/project/showfiles.php?group_id=104004&amp;package_id=115053">
RenderTexture</a>. These libraries are licensed under the terms of
their respective authors.
</p>

<center><a href="http://www.opencsg.org/img/grid.jpg"><img src="img/grid.gif" border="0" alt="CSG columns"></a></center>

<hr>

<center><p>
&copy; 2002-2022, Florian Kirsch, e-mail: <b>mail at opencsg dot org</b>, <br>
2002-2005 Hasso-Plattner-Institute Potsdam.<br>
Last change: 10-Apr-2022
</p></center>

</body>
</html>