| 1 |
|
| 2 |
Frequently Asked Questions for Coin |
| 3 |
=================================== |
| 4 |
|
| 5 |
Last Updated: |
| 6 |
$Date$ |
| 7 |
|
| 8 |
For answers to common Open Inventor programming issues not covered in this |
| 9 |
FAQ, take a look at the FAQs directory in the SoGuiExamples archive. |
| 10 |
|
| 11 |
For answers to common questions regarding the SoQt library, see the FAQ |
| 12 |
in the SoQt source archive. |
| 13 |
|
| 14 |
For answers to common questions regarding licensing, see the FAQ.legal |
| 15 |
file in the Coin source archive. |
| 16 |
|
| 17 |
The most up-to-date version of this file can always be found at |
| 18 |
http://source.coin3d.org/Coin/FAQ |
| 19 |
|
| 20 |
|
| 21 |
Index |
| 22 |
===== |
| 23 |
|
| 24 |
1: Extensions and Ports |
| 25 |
Q1: Are there plans for making Coin multi-thread safe? |
| 26 |
|
| 27 |
Q2: Can Coin do multi-pipe rendering? |
| 28 |
|
| 29 |
Q3: Can I do volume rendering with Coin? |
| 30 |
|
| 31 |
Q4: Does Coin support VRML97? |
| 32 |
|
| 33 |
Q5: Is there an MS Visual C++ project I can use to build Coin? |
| 34 |
|
| 35 |
Q6: Is there a Coin port for Mac OS X/Darwin? |
| 36 |
|
| 37 |
Q7: Is Coin compatible with .NET? |
| 38 |
|
| 39 |
2: Common Problems |
| 40 |
Q1: <Node>::classTypeId != SoType::badType() && "You forgot init()"? |
| 41 |
|
| 42 |
Q2: Why doesn't it work properly to render the same scene graph in two |
| 43 |
different windows? |
| 44 |
|
| 45 |
Q3: Why does my Visual C++ program using Coin work for debug builds but |
| 46 |
not for release builds? |
| 47 |
|
| 48 |
Q4: I try to change the SoText2/SoText3 font, but nothing happens. |
| 49 |
Why, oh why? |
| 50 |
|
| 51 |
Q5: Where does the SoGuiExamples module install the programs? |
| 52 |
|
| 53 |
Q6: Why can't any of the transparency modes be perfect? |
| 54 |
|
| 55 |
3: Other Hows and Whys |
| 56 |
Q1: Why is the .so-version 20 for Coin 1.0 and 40 for Coin 2.0? |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
Section 1. Extensions and Ports |
| 61 |
=============================== |
| 62 |
|
| 63 |
Q1.1: Are there plans for making Coin multi-thread safe? |
| 64 |
|
| 65 |
A: Coin will probably never be 100% thread safe, but in Coin 2.0 |
| 66 |
we've added support for thread safe rendering. This means that |
| 67 |
you can render a scene graph using many threads, at the same |
| 68 |
time. The application programmer is responsible for all thread |
| 69 |
synchronization though, but we've added many thread classes to |
| 70 |
make this easier for you (SbMutex, SbRWMutex, SbStorage, |
| 71 |
SbBarrier, ...). |
| 72 |
|
| 73 |
|
| 74 |
Q1.2: Can Coin do multi-pipe rendering? |
| 75 |
|
| 76 |
A: Yes, but you have to do some work. Coin can do thread-safe |
| 77 |
rendering traversals, but we haven't implemented a simple |
| 78 |
viewer that will set up the OpenGL contexts and handle the |
| 79 |
rendering for each context yet. We've done some internal |
| 80 |
testing with SGI's OpenGL Multipipe SDK, and we might release |
| 81 |
a viewer using that SDK. Please contact us if you're |
| 82 |
interested in multi-pipe rendering. |
| 83 |
|
| 84 |
|
| 85 |
Q1.3: Can I do volume rendering with Coin? |
| 86 |
|
| 87 |
A: Yes, SIM provide an add-on library called "SIM Voleon" for |
| 88 |
volume rendering. The library provides a set of scene graph |
| 89 |
nodes which lets developers set up and visualize volume data |
| 90 |
(in the form of voxels). |
| 91 |
|
| 92 |
SIM Voleon is available from the same channels as Coin itself, |
| 93 |
i.e. the same FTP site and directory, and the same CVS |
| 94 |
repository (the CVS module is named "SIMVoleon"). SIM Voleon |
| 95 |
requires Coin v2.0 or later, and has a licensing scheme similar |
| 96 |
to Coin. |
| 97 |
|
| 98 |
See also http://www.sim.no/products/SIM_Voleon/ |
| 99 |
|
| 100 |
|
| 101 |
Q1.4: Does Coin support VRML97? |
| 102 |
|
| 103 |
A: Coin 1.* does not support VRML97. Coin 2.0 and upwards supports it. |
| 104 |
We are not supporting 100% of the VRML97 standard yet, but most |
| 105 |
models will load and display correctly. The main missing features |
| 106 |
are URL loading (there are callbacks that makes it possible for the |
| 107 |
application programmer to fix this though), proper support for |
| 108 |
bindable nodes, and scripting (can also be supported through |
| 109 |
callbacks). |
| 110 |
|
| 111 |
VRML97 was amended in 2002 with amongst others GeoSpatial and NURBS |
| 112 |
nodes. You will not find these nodes in Coin 2 yet. |
| 113 |
|
| 114 |
|
| 115 |
Q1.5: Is there an MS Visual C++ project I can use to build Coin? |
| 116 |
|
| 117 |
A: Yes. We have now developed a system that uses the Autoconf/Automake |
| 118 |
build system to auto-generate a Microsoft Developer Studio project |
| 119 |
and workspace file for building the Coin library. This setup |
| 120 |
is included with the source code under the directory build/. |
| 121 |
You therefore do not need Cygwin to build Coin any longer. |
| 122 |
|
| 123 |
If you want to generate the .dsp file directly from the source |
| 124 |
repository yourself, see the file INSTALL about the --with-msvcdsp |
| 125 |
configure option. For this you need Cygwin installed. |
| 126 |
|
| 127 |
|
| 128 |
Q1.6: Is there a Coin port for Mac OS X/Darwin? |
| 129 |
|
| 130 |
A: Yes, there is full support for Coin, SoQt and SoXt on |
| 131 |
Mac OS X. You can also integrate Coin into Cocoa applications |
| 132 |
directly by using the Sc21 framework. See |
| 133 |
http://www.coin3d.org/mac/ for Mac-specific information, build |
| 134 |
instructions, download links and tutorials. |
| 135 |
|
| 136 |
|
| 137 |
Q1.7: Is Coin compatible with .NET? |
| 138 |
|
| 139 |
A: The Coin3D libraries are written in C and C++. The supported |
| 140 |
compilers in the Visual Studio family are VisualC++ v6, |
| 141 |
VisualC++.NET 2003 and Visual C++ .NET 2005. In-house, we mostly |
| 142 |
use VC++.NET 2005. |
| 143 |
|
| 144 |
Coin3D is currently not a .NET assembly or component, so if |
| 145 |
you'd like to use Coin3D from other languages in the |
| 146 |
VisualStudio family (C#, VB, J#), you will need to do some |
| 147 |
C++ coding first (basically add support for Managed |
| 148 |
Extensions directly, or add some new (managed) classes that |
| 149 |
act as external interfaces to Coin3D). We are probably going |
| 150 |
to make a .NET assembly of Coin3D some time, but we |
| 151 |
haven't had sufficient customer demand for it yet. |
| 152 |
|
| 153 |
|
| 154 |
Section 2. Common Problems |
| 155 |
========================== |
| 156 |
|
| 157 |
Q2.1: <Node>::classTypeId != SoType::badType() && "You forgot init()"? |
| 158 |
|
| 159 |
A: If you get this assert, it means the run-time type system in |
| 160 |
Coin was not initialized at the time a <Node> object is constructed. |
| 161 |
|
| 162 |
This can happen for several reasons: |
| 163 |
- you haven't called SoDB::init() yet when you construct a node. |
| 164 |
- you have a global node that is constructed automatically on startup |
| 165 |
before main is run. |
| 166 |
- [VC++] you have linked multiple instances of the Coin library into |
| 167 |
your application or the Coin library and the application or some |
| 168 |
other library are using different C library instances. |
| 169 |
|
| 170 |
In the case of not calling SoDB::init(), it is clearly stated on |
| 171 |
page 36 of The Inventor Mentor that "SoDB::init() must be the first |
| 172 |
Inventor call you make.". |
| 173 |
|
| 174 |
"But this works with SGI Inventor", I hear you say... Actually, |
| 175 |
that is just pure luck. Try e.g. creating a new SoBlinker node, |
| 176 |
and you will see your application going down in flames. |
| 177 |
|
| 178 |
|
| 179 |
Q2.2: Why doesn't it work properly to render the same scene graph in two |
| 180 |
different windows? |
| 181 |
|
| 182 |
A: The reason is probably that the two windows do not share the same |
| 183 |
GL context, but the render actions are not set up with different |
| 184 |
cache contexts. Use two different values with |
| 185 |
SoGLRenderAction::setCacheContext() for the two windows' render |
| 186 |
actions. Example follows: |
| 187 |
|
| 188 |
for (int i=0; i < NR_VIEWERS; i++) { |
| 189 |
SoGLRenderAction * renderaction = window[i]->getGLRenderAction(); |
| 190 |
#ifdef __COIN__ |
| 191 |
/* In Coin, we have added an extension to SoGLCacheContextElement |
| 192 |
for getting a _guaranteed_ unique number for the cache contexts. |
| 193 |
That the original Inventor API is missing a function like this |
| 194 |
should be considered an ugly flaw in the design. */ |
| 195 |
uint32_t uniqcc = SoGLCacheContextElement::getUniqueCacheContext(); |
| 196 |
#else // SGI or TGS Inventor |
| 197 |
/* Use a "pseudo-random" number and cross your fingers that it's |
| 198 |
unique, since there's no decent method in the API from which |
| 199 |
the application programmer can get a unique cache context id. */ |
| 200 |
uint32_t uniqcc = 19720408 + i; |
| 201 |
#endif // SGI / TGS Inventor |
| 202 |
renderaction->setCacheContext(uniqcc); |
| 203 |
} |
| 204 |
|
| 205 |
This is taken care of automatically by Kongsberg Oil & Gas Technologies's |
| 206 |
SoQt / SoGtk / SoXt / SoWin / Sc21 libraries, so you shouldn't |
| 207 |
have to worry about it unless you are making your own GUI |
| 208 |
binding to Coin from scratch. |
| 209 |
|
| 210 |
|
| 211 |
Q2.3: Why does my Visual C++ program using Coin work for debug builds but |
| 212 |
not for release builds? |
| 213 |
|
| 214 |
A: The MS Visual C++ compiler changes behaviour when you change between |
| 215 |
DEBUG and RELEASE mode. Initialization of variables is one thing |
| 216 |
in particular you should look at - debug compilation will cause |
| 217 |
all variables to be initialized to zero, while they will have random |
| 218 |
values for release builds. |
| 219 |
|
| 220 |
There are of course other possible causes as well. |
| 221 |
|
| 222 |
|
| 223 |
Q2.4: I try to change the SoText2/SoText3 font, but nothing happens. |
| 224 |
Why, oh why? |
| 225 |
|
| 226 |
A: The font support prior to Coin 2.1 was limited to a hardcoded font |
| 227 |
for both Text2 and Text3. TrueType 2D fonts support were |
| 228 |
implemented in Coin 2.1 and 3D fonts in Coin 2.2. |
| 229 |
|
| 230 |
On Windows platforms, TrueType fonts are imported by utilizing |
| 231 |
the native support for this in the operating system. No such |
| 232 |
native TrueType support exists on UNIX and UNIX-like systems, |
| 233 |
so these platforms will use the FreeType library |
| 234 |
<URL:http://www.freetype.org>. |
| 235 |
|
| 236 |
If your requested font could not be found, try to set the |
| 237 |
environment variable COIN_DEBUG_FONTSUPPORT to 1. Extensive |
| 238 |
debug information will then be forwarded to the console. This |
| 239 |
includes info on which font library is being used, and whether |
| 240 |
Coin could locate the requested font or not, and where it |
| 241 |
looked. |
| 242 |
|
| 243 |
When using the FreeType library, requested fonts will first be |
| 244 |
searched for in the working directory. The path specified by |
| 245 |
the COIN_FONT_PATH environment variable will then be |
| 246 |
searched. It is not possible to explicitly specify a font file |
| 247 |
when using the Win32 library as all font handling must be |
| 248 |
done through the operating system. |
| 249 |
|
| 250 |
For more information, please read the API documentation on SoFont. |
| 251 |
<URL:http://doc.coin3d.org/Coin/classSoFont.html> |
| 252 |
|
| 253 |
|
| 254 |
Q2.5: Where does the SoGuiExamples module install the programs? |
| 255 |
|
| 256 |
A: They are not installed. The programs are just examples, and do not |
| 257 |
belong with the installed executables on a system. They are built |
| 258 |
in the build dir, and are intended to be run from there. |
| 259 |
|
| 260 |
|
| 261 |
Q2.6: Why can't any of the transparency modes be perfect? |
| 262 |
|
| 263 |
A: See the documentation on SoGLRenderAction::TransparencyType, at |
| 264 |
|
| 265 |
http://doc.coin3d.org/Coin/classSoGLRenderAction.html |
| 266 |
|
| 267 |
For Coin 2.3, a new transparency mode called SORTED_LAYERS_BLEND |
| 268 |
has been implemented for SoGLRenderAction which uses a technique |
| 269 |
that actually produces correct transparency rendering. |
| 270 |
|
| 271 |
For earlier versions of Coin, transparency rendering will often |
| 272 |
fail and produce visual artifacts because blending is done in an |
| 273 |
incorrect order. To avoid visual artifacts, all polygons must be |
| 274 |
rendered in sorted back-to-front order, and intersecting polygons |
| 275 |
must be clipped against each other. This is in general too |
| 276 |
expensive an operation to use in a real-time system, so it was |
| 277 |
not implemented. |
| 278 |
|
| 279 |
Note that there is a transparency mode called "SCREEN_DOOR" that |
| 280 |
does not rely on blending - it uses dithering - that has been in |
| 281 |
Coin since v1.0. This transparency mode always produces correct |
| 282 |
results, it doesn't even require multipass rendering, but since the |
| 283 |
visual result looks somewhat dated people seem to prefer the |
| 284 |
blending techniques. |
| 285 |
|
| 286 |
|
| 287 |
Section 3. Other Hows and Whys |
| 288 |
============================== |
| 289 |
|
| 290 |
Q3.1: Why is the .so-version 40 for Coin 2.0 and 60 for Coin 3.0? |
| 291 |
|
| 292 |
A: This was done to keep the artificial mapping we have constructed |
| 293 |
between the release version number and ABI interface version of Coin |
| 294 |
as simple as possible. We have this mapping because we plan to |
| 295 |
do parallel development of different Coin-versions at the same time |
| 296 |
because Coin 1.0 has special status as the Open Inventor 2.1 |
| 297 |
compatibility release. |
| 298 |
|
| 299 |
Keep in mind that .so-version numbers and release version numbers |
| 300 |
really do not have anything to do with each other in the first place. |
| 301 |
|
| 302 |
When you release a new major version of a library, you usually |
| 303 |
break compatibility with earlier versions of the library. When you |
| 304 |
change the API/ABI of a library, you increment the interface number |
| 305 |
to indicate that the library has a new interface. Since we want to |
| 306 |
continue development of Coin 1.0 after Coin 2.0 is released, we need |
| 307 |
to reserve space for future Coin 1.x releases, and set the Coin 2.0 |
| 308 |
interface number after the reserved space. We decided 20 interface- |
| 309 |
numbers would suffice for each major version of the Coin library, |
| 310 |
and the simplest equation for finding the interface number became |
| 311 |
major*20+minor. |
| 312 |
|
| 313 |
Incidentally, a lot of platforms (Linux included) calculate the |
| 314 |
.so-number by taking the interface number and subtracting the age, |
| 315 |
and the age is the same as the minor release version number for |
| 316 |
Coin. This will make the .so-number stay at 20 for the whole 1.x |
| 317 |
series and similarly stay at 40 for the whole 2.x series, which of |
| 318 |
course looks silly, but that's the way it is. |
| 319 |
|
| 320 |
See also the Libtool manual, section about Versioning. It's the |
| 321 |
same system, except that we have added reserved space in our scheme. |
| 322 |
|
| 323 |
-- |