| 1 |
<html lang="en"> |
|---|
| 2 |
<head> |
|---|
| 3 |
<title>DerelictODE</title> |
|---|
| 4 |
<link rel="stylesheet" type="text/css" href="styles.css"> |
|---|
| 5 |
</head> |
|---|
| 6 |
<body> |
|---|
| 7 |
<hr> |
|---|
| 8 |
<hr> |
|---|
| 9 |
<h2 align="center">DerelictODE</h2> |
|---|
| 10 |
<hr> |
|---|
| 11 |
<hr> |
|---|
| 12 |
<h3>Introduction</h3> |
|---|
| 13 |
DerelictODE is a D binding to the <a href="http://www.ode.org/">Open Dynammics Engine</a> |
|---|
| 14 |
library. |
|---|
| 15 |
|
|---|
| 16 |
<div class="note> |
|---|
| 17 |
This binding was created against ODE 0.8. |
|---|
| 18 |
</div> |
|---|
| 19 |
|
|---|
| 20 |
<h3>Floating Point Precision</h3> |
|---|
| 21 |
The ODE shared library can be configured to use single precision or double precision floating point |
|---|
| 22 |
types for all operations. This raises an issue when using DerelictODE: when compiling, either using |
|---|
| 23 |
Derelict's build script or another means, you need to be aware of which configuration of the shared |
|---|
| 24 |
library your application will be using and configure DerelictODE appropriately. |
|---|
| 25 |
<p> |
|---|
| 26 |
When compiling DerelictODE, one of the following two version switches should be used: |
|---|
| 27 |
</p> |
|---|
| 28 |
<pre> |
|---|
| 29 |
-version=DerelictODE_DoublePrecision |
|---|
| 30 |
-version=DerelictODE_SinglePrecision |
|---|
| 31 |
</pre> |
|---|
| 32 |
<p> |
|---|
| 33 |
The former should be used when working with an ODE shared library configured for double precision |
|---|
| 34 |
floating point operations, the latter for a single precision configuration. If neither is specified |
|---|
| 35 |
on the command line during compilation, the default is <tt>DerelictODE_SinglePrecision</tt>. |
|---|
| 36 |
</p> |
|---|
| 37 |
<p> |
|---|
| 38 |
If the configurations of DerelictODE and the ODE shared library do not match, you will most likely |
|---|
| 39 |
see errors when calling ODE functions, though unexpected results or application crashes are not |
|---|
| 40 |
to be ruled out. This presents a particular problem on systems where ODE is already installed. Though |
|---|
| 41 |
even if you do ship an ODE shared library with the application, your users can easily compile their |
|---|
| 42 |
own version of the library and replace yours. So when shipping products with DerelictODE, alwasy be |
|---|
| 43 |
aware of the potential for floating point configuration mismatch. It should be noted that this is not |
|---|
| 44 |
just a problem with DerelictODE, but also exists in C or C++ programs which use the ODE shared library. |
|---|
| 45 |
The only way to avoid the issue is to statically link ODE into your application (an option which |
|---|
| 46 |
DerelictODE does not provide). |
|---|
| 47 |
</p> |
|---|
| 48 |
|
|---|
| 49 |
<h3>Using</h3> |
|---|
| 50 |
<ol> |
|---|
| 51 |
<li>Always make sure the DerelictODE source modules are available on your import |
|---|
| 52 |
path.</li> |
|---|
| 53 |
<li>In modules that make use of DerelictODE, you will need to import the derelict.ode.ode |
|---|
| 54 |
module.</li> |
|---|
| 55 |
<li>Before calling any ODE functions, you need to make a call to <tt>DerelictODE.load()</tt>. |
|---|
| 56 |
This will load the shared library.</li> |
|---|
| 57 |
</ol> |
|---|
| 58 |
|
|---|
| 59 |
<p> |
|---|
| 60 |
The following is a complete program that loads DerelictODE: |
|---|
| 61 |
</p> |
|---|
| 62 |
|
|---|
| 63 |
<pre> |
|---|
| 64 |
import derelict.ode.ode; |
|---|
| 65 |
|
|---|
| 66 |
void main() |
|---|
| 67 |
{ |
|---|
| 68 |
DerelictODE.load(); |
|---|
| 69 |
|
|---|
| 70 |
// now you can call ODE functions |
|---|
| 71 |
} |
|---|
| 72 |
</pre> |
|---|
| 73 |
|
|---|
| 74 |
<p> |
|---|
| 75 |
From this point on, you may call ODE functions as normal. |
|---|
| 76 |
</p> |
|---|
| 77 |
|
|---|
| 78 |
<p> |
|---|
| 79 |
As with other Derelict packages, DerelictODE will throw an exception if an error |
|---|
| 80 |
occurs while loading the shared library. For more information on Derelict |
|---|
| 81 |
exceptions, see the documentation for |
|---|
| 82 |
<a href="loading.html">Loading/Unloading Shared Libraries</a>.</p> |
|---|
| 83 |
|
|---|
| 84 |
<p> |
|---|
| 85 |
Finally, the method <tt>DerelictODE.unload()</tt> is provided for convenience. |
|---|
| 86 |
In normal practice you do not need to call this function, as Derelict will unload |
|---|
| 87 |
the library automatically when the app exits. You generally should only use this |
|---|
| 88 |
function if you need to unload DerelictODE while the application is running. |
|---|
| 89 |
</p> |
|---|
| 90 |
|
|---|
| 91 |
<h3>Dependencies</h3> |
|---|
| 92 |
<a href="util.html">DerelictUtil</a> |
|---|
| 93 |
|
|---|
| 94 |
</body> |
|---|
| 95 |
</html> |
|---|