aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Documentation/PhysXGuide/Manual/Startup.html
blob: 6f9d5acdcccc11a8f834827d909abac71cf7d698 (plain) (blame)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Startup and Shutdown &mdash; NVIDIA PhysX SDK 3.4.2 Documentation</title>
    
    <link rel="stylesheet" href="../_static/nvidia.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="../_static/breathe.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '3.4.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="NVIDIA PhysX SDK 3.4.2 Documentation" href="../index.html" />
    <link rel="up" title="User&#39;s Guide" href="Index.html" />
    <link rel="next" title="Threading" href="Threading.html" />
    <link rel="prev" title="The PhysX API" href="API.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="Threading.html" title="Threading"
             accesskey="N">next</a></li>
        <li class="right" >
          <a href="API.html" title="The PhysX API"
             accesskey="P">previous</a> |</li>
        <li><a href="../Index.html">NVIDIA PhysX SDK 3.4.2 Documentation</a> &raquo;</li>
          <li><a href="Index.html" accesskey="U">User's Guide</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="startup-and-shutdown">
<span id="startup"></span><h1>Startup and Shutdown<a class="headerlink" href="#startup-and-shutdown" title="Permalink to this headline"></a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline"></a></h2>
<p>The first step in using the PhysX SDK in a program is the initialization of some global objects.  These objects can be released when PhysX is no longer needed to free resources.  This chapter describes how to do this.</p>
</div>
<div class="section" id="foundation-and-physics">
<h2>Foundation and Physics<a class="headerlink" href="#foundation-and-physics" title="Permalink to this headline"></a></h2>
<p>First, in some startup code, create a <em>PxFoundation</em> object:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">static</span> <span class="n">PxDefaultErrorCallback</span> <span class="n">gDefaultErrorCallback</span><span class="p">;</span>
<span class="k">static</span> <span class="n">PxDefaultAllocator</span> <span class="n">gDefaultAllocatorCallback</span><span class="p">;</span>

<span class="n">mFoundation</span> <span class="o">=</span> <span class="n">PxCreateFoundation</span><span class="p">(</span><span class="n">PX_FOUNDATION_VERSION</span><span class="p">,</span> <span class="n">gDefaultAllocatorCallback</span><span class="p">,</span>
    <span class="n">gDefaultErrorCallback</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">mFoundation</span><span class="p">)</span>
    <span class="n">fatalError</span><span class="p">(</span><span class="s">&quot;PxCreateFoundation failed!&quot;</span><span class="p">);</span>
</pre></div>
</div>
<p>Every PhysX module requires a PxFoundation instance to be available. The required parameters are a version ID, an allocator callback and an error callback. <em>PX_PHYSICS_VERSION</em>, is a macro predefined in our headers to enable PhysX to check for a version mismatch between the headers and the corresponding SDK DLLs.</p>
<p>Usually, the allocator callback and error callback are specific to the application, but PhysX provides default implementations that make it easy to get started. See <a class="reference internal" href="API.html#memorymanagement"><em>Memory Management</em></a> and <a class="reference internal" href="API.html#errorreporting"><em>Error Reporting</em></a> for more details of these callbacks. (The actual sample code supports an advanced memory allocator that tracks allocations instead of the default, but we have omitted that detail here.)</p>
<p>Now create the top-level <em>PxPhysics</em> object:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="kt">bool</span> <span class="n">recordMemoryAllocations</span> <span class="o">=</span> <span class="nb">true</span><span class="p">;</span>

<span class="n">mPvd</span> <span class="o">=</span> <span class="n">PxCreatePvd</span><span class="p">(</span><span class="o">*</span><span class="n">gFoundation</span><span class="p">);</span>
<span class="n">PxPvdTransport</span><span class="o">*</span> <span class="n">transport</span> <span class="o">=</span> <span class="n">PxDefaultPvdSocketTransportCreate</span><span class="p">(</span><span class="n">PVD_HOST</span><span class="p">,</span> <span class="mi">5425</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
<span class="n">mPvd</span><span class="o">-&gt;</span><span class="n">connect</span><span class="p">(</span><span class="o">*</span><span class="n">transport</span><span class="p">,</span><span class="n">PxPvdInstrumentationFlag</span><span class="o">::</span><span class="n">eALL</span><span class="p">);</span>


<span class="n">mPhysics</span> <span class="o">=</span> <span class="n">PxCreatePhysics</span><span class="p">(</span><span class="n">PX_PHYSICS_VERSION</span><span class="p">,</span> <span class="o">*</span><span class="n">mFoundation</span><span class="p">,</span>
    <span class="n">PxTolerancesScale</span><span class="p">(),</span> <span class="n">recordMemoryAllocations</span><span class="p">,</span> <span class="n">mPvd</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">mPhysics</span><span class="p">)</span>
    <span class="n">fatalError</span><span class="p">(</span><span class="s">&quot;PxCreatePhysics failed!&quot;</span><span class="p">);</span>
</pre></div>
</div>
<p>Again, the version ID has to be passed in. The PxTolerancesScale parameter makes it easier to author content at different scales and still have PhysX work as expected, but to get started simply pass a default object of this type. The recordMemoryAllocations parameter specifies whether to perform memory profiling. The optional PVD instance enables the debugging and profiling with the PhysX Visual Debugger.</p>
</div>
<div class="section" id="cooking">
<h2>Cooking<a class="headerlink" href="#cooking" title="Permalink to this headline"></a></h2>
<p>The PhysX cooking library provides utilities for creating, converting, and serializing bulk data. Depending on your application, you may wish to link to the cooking library in order to process such data at runtime. Alternatively you may be able to process all such data in advance and just load it into memory as required. Initialize the cooking library as follows:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mCooking</span> <span class="o">=</span> <span class="n">PxCreateCooking</span><span class="p">(</span><span class="n">PX_PHYSICS_VERSION</span><span class="p">,</span> <span class="o">*</span><span class="n">mFoundation</span><span class="p">,</span> <span class="n">PxCookingParams</span><span class="p">(</span><span class="n">scale</span><span class="p">));</span>
<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">mCooking</span><span class="p">)</span>
    <span class="n">fatalError</span><span class="p">(</span><span class="s">&quot;PxCreateCooking failed!&quot;</span><span class="p">);</span>
</pre></div>
</div>
<p>The PxCookingParams struct configures the cooking library to target different platforms, use non-default tolerances or produce optional outputs. It is important to use consistent PxTolerancesScale values everywhere in your application (see <a class="reference internal" href="API.html#pxtolerancescale"><em>Using Different Units</em></a> for more details).</p>
<p>The cooking library generates data through a streaming interface. In the samples, implementations of streams are provided in the PxToolkit library to read and write from files and memory buffers. Heightfield or Trianglemesh cooked meshes can be directly inserted into PxPhysics without serialization using the PxPhysicsInsertionCallback. The default callback must be used and can be obtained using the PxPhysics::getPhysicsInsertionCallback().</p>
</div>
<div class="section" id="extensions">
<h2>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline"></a></h2>
<p>The extensions library  contains many functions that may be useful to a large class of users, but which some users may prefer to omit from their application either for code size reasons or to avoid use of certain subsystems, such as those pertaining to networking. Initializing the extensions library requires the PxPhysics object:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">PxInitExtensions</span><span class="p">(</span><span class="o">*</span><span class="n">mPhysics</span><span class="p">,</span> <span class="n">mPvd</span><span class="p">))</span>
    <span class="n">fatalError</span><span class="p">(</span><span class="s">&quot;PxInitExtensions failed!&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="optional-sdk-components">
<span id="optionalsdkcomponents"></span><h2>Optional SDK Components<a class="headerlink" href="#optional-sdk-components" title="Permalink to this headline"></a></h2>
<p>When linking PhysX as a static library on memory constrained platforms, it is possible to avoid linking the code of some PhysX features that are not always used in order to save memory.  Currently the optional features are:</p>
<blockquote>
<div><ul class="simple">
<li>Articulations</li>
<li>Height Fields</li>
<li>Cloth</li>
<li>Particles</li>
</ul>
</div></blockquote>
<p>If your application requires a subset of this functionality, it is recommended that you call PxCreateBasePhysics as opposed to PxCreatePhysics and then manually register the components you require.  Below is an example that registers some of the options:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">physx</span><span class="o">::</span><span class="n">PxPhysics</span><span class="o">*</span> <span class="n">customCreatePhysics</span><span class="p">(</span><span class="n">physx</span><span class="o">::</span><span class="n">PxU32</span> <span class="n">version</span><span class="p">,</span>
    <span class="n">physx</span><span class="o">::</span><span class="n">PxFoundation</span><span class="o">&amp;</span> <span class="n">foundation</span><span class="p">,</span>
    <span class="k">const</span> <span class="n">physx</span><span class="o">::</span><span class="n">PxTolerancesScale</span><span class="o">&amp;</span> <span class="n">scale</span><span class="p">,</span>
    <span class="kt">bool</span> <span class="n">trackOutstandingAllocations</span>
    <span class="n">physx</span><span class="o">::</span><span class="n">PxPvd</span><span class="o">*</span> <span class="n">pvd</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">physx</span><span class="o">::</span><span class="n">PxPhysics</span><span class="o">*</span> <span class="n">physics</span> <span class="o">=</span> <span class="n">PxCreateBasePhysics</span><span class="p">(</span><span class="n">version</span><span class="p">,</span> <span class="n">foundation</span><span class="p">,</span> <span class="n">scale</span><span class="p">,</span>
        <span class="n">trackOutstandingAllocations</span><span class="p">,</span> <span class="n">pvd</span><span class="p">);</span>

    <span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="n">physics</span><span class="p">)</span>
        <span class="k">return</span> <span class="nb">NULL</span><span class="p">;</span>

    <span class="n">PxRegisterArticulations</span><span class="p">(</span><span class="o">*</span><span class="n">physics</span><span class="p">);</span>
    <span class="n">PxRegisterHeightFields</span><span class="p">(</span><span class="o">*</span><span class="n">physics</span><span class="p">);</span>

    <span class="k">return</span> <span class="n">physics</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
<p>Note that this will only save memory when linking PhysX as a static library, as we rely on the linker to strip out the unused code.</p>
</div>
<div class="section" id="delay-loading-dlls">
<h2>Delay-Loading DLLs<a class="headerlink" href="#delay-loading-dlls" title="Permalink to this headline"></a></h2>
<p>The PhysXCommon DLL, PxFoundation DLL and PxPvdSDK DLL are marked as delay-loaded inside of the PhysX, PhysXCooking, PhysXCommon and PxPvdSDK projects. So it is possible to have delay-loaded PxFoundation, PxPvdSDK, PhysXCommon, PhysX and PhysXCooking DLLs.</p>
<div class="section" id="physxcommon-dll-and-pxfoundation-dll-load">
<h3>PhysXCommon DLL and PxFoundation DLL load<a class="headerlink" href="#physxcommon-dll-and-pxfoundation-dll-load" title="Permalink to this headline"></a></h3>
<p>The application links against PhysXCommon DLL, and will usually load PxFoundation.dll, PxPvdSDK and PhysXCommon.dll before any other PhysX DLL. The DLL loaded by the application must be the same one that will be used by the PhysX and PhysXCooking DLLs.  In the PhysX and PhysXCooking DLLs, the choice of PhysXCommon, PxFoundation and PxPvdSDK is made as follows:</p>
<blockquote>
<div><ul class="simple">
<li>If delay load hook is specified the PhysXCommon name, PxFoundation or PxPvdSDK name provided by user is used</li>
<li>If delay load hook is not specified, the corresponding PhysXCommon DLL, PxFoundation DLL or PxPvdSDK DLL is used</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="pxdelayloadhook">
<h3>PxDelayLoadHook<a class="headerlink" href="#pxdelayloadhook" title="Permalink to this headline"></a></h3>
<p>The PxDelayLoadHook class supports loading of different versions of PhysXCommon DLL, PxFoundation DLL or PxPvdSDK DLL. This can be achieved by providing different DLL names to the PhysX SDK through a custom subclass of PxDelayLoadHook, see the following example:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SampleDelayLoadHook</span><span class="o">:</span> <span class="k">public</span> <span class="n">PxDelayLoadHook</span>
<span class="p">{</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXCommonDEBUGDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3CommonDEBUG_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXCommonCHECKEDDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3CommonCHECKED_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXCommonPROFILEDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3CommonPROFILE_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXCommonDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3Common_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxFoundationDEBUGDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxFoundationDEBUG_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxFoundationCHECKEDDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxFoundationCHECKED_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxFoundationPROFILEDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxFoundationPROFILE_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxFoundationDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxFoundation_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxPvdSDKDEBUGDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxPvdSDKDEBUG_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxPvdSDKCHECKEDDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxPvdSDKCHECKED_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxPvdSDKPROFILEDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxPvdSDKPROFILE_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPxPvdSDKDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PxPvdSDK_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
<span class="p">}</span> <span class="n">gDelayLoadHook</span><span class="p">;</span>
</pre></div>
</div>
<p>Now the hook must be set for PhysX, PhysXCooking, PhysXCommon, PxPvdSDK:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxSetPhysXDelayLoadHook</span><span class="p">(</span><span class="o">&amp;</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
<span class="n">PxSetPhysXCookingDelayLoadHook</span><span class="p">(</span><span class="o">&amp;</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
<span class="n">PxSetPhysXCommonDelayLoadHook</span><span class="p">(</span><span class="o">&amp;</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
<span class="n">PxPvdSetFoundationDelayLoadHook</span><span class="p">(</span><span class="o">&amp;</span><span class="n">gDelayLoadHook</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="pxgpuloadhook">
<h3>PxGpuLoadHook<a class="headerlink" href="#pxgpuloadhook" title="Permalink to this headline"></a></h3>
<p>The PxGpuLoadHook class supports loading of different versions of PhysXGpu DLL. This can be achieved by providing different DLL names to the PhysX SDK through a custom subclass of PxGpuLoadHook, see the following example:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">class</span> <span class="nc">SampleGpuLoadHook</span><span class="o">:</span> <span class="k">public</span> <span class="n">PxGpuLoadHook</span>
<span class="p">{</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXGpuDEBUGDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3GpuDEBUG_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXGpuCHECKEDDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3GpuCHECKED_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXGpuPROFILEDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3GpuPROFILE_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
    <span class="k">virtual</span> <span class="k">const</span> <span class="kt">char</span><span class="o">*</span> <span class="n">getPhysXGpuDllName</span><span class="p">()</span> <span class="k">const</span>
        <span class="p">{</span> <span class="k">return</span> <span class="s">&quot;PhysX3Gpu_x64_Test.dll&quot;</span><span class="p">;</span> <span class="p">}</span>
<span class="p">}</span> <span class="n">gGpuLoadHook</span><span class="p">;</span>
</pre></div>
</div>
<p>Now the hook must be set for PhysX:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">PxSetPhysXGpuLoadHook</span><span class="p">(</span><span class="o">&amp;</span><span class="n">gGpuLoadHook</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="physxcommon-secure-load">
<h3>PhysXCommon Secure Load<a class="headerlink" href="#physxcommon-secure-load" title="Permalink to this headline"></a></h3>
<p>All PhysX DLLs distributed by NVIDIA are signed. The PhysXCommon DLL signature is checked, when it is loaded by PhysX or PhysXCooking. If signature test fails the application is terminated.</p>
</div>
</div>
<div class="section" id="shutting-down">
<h2>Shutting Down<a class="headerlink" href="#shutting-down" title="Permalink to this headline"></a></h2>
<p>To dispose of any PhysX object, call its release() method.  This will destroy the object, and all contained objects.  The precise behavior depends on the object type being released, so refer to the reference guide for details.  To shut down the extensions library, call the function <em>PxCloseExtensions()</em>. To shut down physics, call release() on the PxPhysics object, and this will clean up all of the physics objects:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mPhysics</span><span class="o">-&gt;</span><span class="n">release</span><span class="p">();</span>
</pre></div>
</div>
<p>Do not forget to release the foundation object as well, but only after all other PhysX modules have been released:</p>
<div class="highlight-c++"><div class="highlight"><pre><span class="n">mFoundation</span><span class="o">-&gt;</span><span class="n">release</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../Index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Startup and Shutdown</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#foundation-and-physics">Foundation and Physics</a></li>
<li><a class="reference internal" href="#cooking">Cooking</a></li>
<li><a class="reference internal" href="#extensions">Extensions</a></li>
<li><a class="reference internal" href="#optional-sdk-components">Optional SDK Components</a></li>
<li><a class="reference internal" href="#delay-loading-dlls">Delay-Loading DLLs</a><ul>
<li><a class="reference internal" href="#physxcommon-dll-and-pxfoundation-dll-load">PhysXCommon DLL and PxFoundation DLL load</a></li>
<li><a class="reference internal" href="#pxdelayloadhook">PxDelayLoadHook</a></li>
<li><a class="reference internal" href="#pxgpuloadhook">PxGpuLoadHook</a></li>
<li><a class="reference internal" href="#physxcommon-secure-load">PhysXCommon Secure Load</a></li>
</ul>
</li>
<li><a class="reference internal" href="#shutting-down">Shutting Down</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="API.html"
                        title="previous chapter">The PhysX API</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="Threading.html"
                        title="next chapter">Threading</a></p>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="Threading.html" title="Threading"
             >next</a></li>
        <li class="right" >
          <a href="API.html" title="The PhysX API"
             >previous</a> |</li>
        <li><a href="../Index.html">NVIDIA PhysX SDK 3.4.2 Documentation</a> &raquo;</li>
          <li><a href="Index.html" >User's Guide</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2008-2018 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.
    </div>
  </body>
</html>