Wrapping Nvidia Physx SDK 3.3.3

Hello everyone,

I prepared a small test bench for Nvidia Physx 3.3.3.

here:


find some examples.

Soon will be a packed addons for 3.3.3 SDK physx.

Here:
http://docs.nvidia.com/gameworks/content/gameworkslibrary/physx/apireference/files/index.html
Api reference.

Here:
http://physxinfo.com/wiki/PhysX_SDK_3.x
you will find the specifications of the new sdk.

Here:


guide account github Nvidia.

Here:
https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/MigrationTo33.html
info migrating 3.2 > 3.3

video:




photo:




Suggestions are welcome.

Ciao
Dario

8 Likes

Looks great! Is this for the Tegra K1?

Awesome, it seems there is hardware acceleration for the clothing solver, particles and fluids on most modern NVIDIA GPUs. Would be cool to see some SPH.

Exactly Sir @jvcleave, the PhysX 3.3.3 running on Tegra k1, right now I’m trying to cross compile from linux to Android, I am having some problems with the compiler of ndk9d but is solvable, short news updates.

I want to point out that nvidia puts together a toolkit for developing Mobile Android
compatible with Tegra k1:
https://developer.nvidia.com/tegra-android-development-pack

I just uploaded the repository is another example:

good day!

Yes Sir @amnon , I am also very excited about the new future.
regarding the Smoothed particle hydrodynamics-personally I’ve always had a soft spot for fluid dynamics, I always try alone to write something without good results, now with physx changes everything, I hope to pack a examples of SPH.

I have some examples on the repository of 3D fluid but the cast is processed in CPU.

Source:

video:

good day!!

other example:




I’m working on particle turbulence, hair and destruction.

good day!
Dario

Very nice!

Do you intend to turn these tests into an ofxAddon eventually? If so, I hope it will include support for windows/codeblocks. :smiley: And a step-by-step on making it work, I suppose one needs to register and get the SDK (source) or something? Anyway, looking forward to trying this some day. Very promising. Keep up the good work! :grin:

Thank You,

@amnon for the moment is a study phase of the sdk,
just have a good familiarity with it I provide to package ofxaddons and test on most operating systems.

sdk are here:
https://github.com/NVIDIAGameWorks/PhysX
is open, but you must register.

greetings
Dario

Physx+OF = GREAT!

That’s probably a stupid question, but
Is it possible to compile your examples under OF v0.8.4 and Physx 3.3.2 ?

I’m new C++ and i don’t know how to make links to Physx libs, includes… i guess config.make must do the job but how to setup to my config ?

ps: i use C::B under Ubuntu 14.04 LTS

thank’s

thanks @spinzero,

are under linux; but do not use codeblocks, in any case I think the editor codeblocks
to its system for linking external libraries (probably very simple).

However, to be clear on how to properly link an external library like the new PhysxNvidia then you can refer to config.make of one of the examples:

as can be seen from the example config.make above the folder there is another folder called “physxNV” here I quote what you need for a compilation of physx 3.3.3:

includes
lib
lib
bin

careful to use the correct link for the operating system.
I’m on a debian 64 bit then in config.make find links to:

Lib/linux64
lib/linux64
Bin/linux64
etc…

Referring to your question, the answer is yes!
but there are some fundamental differences between 3.3.3 and 3.3.2

Refer to this to understand:
https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/MigrationTo33.html

the addons that I will publish exit OF9 not support compiling with physx 3.2.

Saluti Dario

Thank’s :slight_smile:

Now my Physx3.3.2 correspond to physxNV folder but
when i compile the make file it return those errors:

-o obj/linux64/Release/externals/glew/src/glew.o -c externals/glew/src/glew.c
cc1: warning: command line option ‘-Wno-invalid-offsetof’ is valid for C++/ObjC++ but not for C [enabled by default]
cc1: warning: command line option ‘-frtti’ is valid for C++/ObjC++ but not for C [enabled by default]
cc1: warning: command line option ‘-fvisibility-inlines-hidden’ is valid for C++/ObjC++ but not for C [enabled by default]
In file included from ./externals/glew/include/GL/glew.h:198:0,
                 from externals/glew/src/glew.c:32:
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stddef.h:29:42: error: missing binary operator before token "("
 #if !defined(_PTRDIFF_T) || __has_feature(modules)
                                          ^
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stddef.h:37:39: error: missing binary operator before token "("
 #if !defined(_SIZE_T) || __has_feature(modules)
                                       ^
...   
In file included from ./externals/glew/include/GL/glew.h:199:0,
                 from externals/glew/src/glew.c:32:
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:32:54: error: missing binary operator before token "("
     defined(__has_include_next) && __has_include_next(<stdint.h>)
                                                      ^
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:187:0: warning: "__int_least32_t" redefined [enabled by default]
 # define __int_least32_t int32_t
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:114:0: note: this is the location of the previous definition
 # define __uint_least32_t uint64_t
...
 ^
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:486:0: note: this is the location of the previous definition
 # define __INT_LEAST16_MAX   INT64_MAX
 ^
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:580:0: note: this is the location of the previous definition
 # define __INT_LEAST8_MAX    INT32_MAX
 ^
./externals/clang/3.3.2/linux32/lib/clang/3.3/include/stdint.h:622:0: warning: "__UINT_LEAST8_MAX" redefined [enabled 
 ^
In file included from externals/glew/src/glew.c:32:0:
./externals/glew/include/GL/glew.h:1603:1: error: unknown type name ‘ptrdiff_t’
 typedef ptrdiff_t GLsizeiptr;
...
 ^
In file included from ./externals/glew/include/GL/glxew.h:94:0,
                 from externals/glew/src/glew.c:36:
/usr/include/X11/Xlib.h:1116:5: error: unknown type name ‘wchar_t’
     wchar_t        *chars;
     ^
/usr/include/X11/Xlib.h:1275:2: error: unknown type name ‘wchar_t’
  wchar_t *wide_char;
  ^
...
     wchar_t**  list
     ^
/usr/include/X11/Xutil.h:789:5: error: unknown type name ‘wchar_t’
     wchar_t***  list_return,
     ^
externals/glew/src/glew.c: In function ‘glxewGetExtension’:
externals/glew/src/glew.c:8845:26: warning: the comparison will always evaluate as ‘false’ for the address of ‘glXGetClientString’ will never be NULL [-Waddress]
   if (glXGetClientString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE;

If i undertood, it compile in C and we need C++,
but i have g++ installed !?. may be i need something like g+±mingw-w64 deb ?

Hi @spinzero,

test this new config.cmake:
config.zip (1.3 KB)

Give me another piece of information, its operating system is 32bit?
if this were the case, replace m64 with m32 in config.make

Good day
Dario

Bonjour Kashim!

I’m64,
compiling new config.cmake return:

In file included from /usr/include/X11/Xlib.h:44:0,
                 from /usr/include/GL/glx.h:30,
                 from ../../../libs/openFrameworks/utils/ofConstants.h:180,
                 from ../../../libs/openFrameworks/ofMain.h:5,
                 from src/main.cpp:1:
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:46:4: error: expected identifier before numeric constant
    None,  // the filter setting to kill all events
    ^
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:46:4: error: expected ‘}’ before numeric constant
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:46:4: error: expected unqualified-id before numeric constant
In file included from ../physxNV/Include/PxPhysicsAPI.h:90:0,
                 from src/xphysx.h:1,
                 from src/main.cpp:3:
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:57:50: error: ‘EventPriorities’ has not been declared
  struct EventPriority { static const PxU32 val = EventPriorities::Medium; };
                                                  ^
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:37:44: error: ‘EventPriorities’ has not been declared
 #define PX_PROFILE_EVENT_PROFILE_THRESHOLD EventPriorities::Medium
                                            ^
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:63:59: note: in expansion of macro ‘PX_PROFILE_EVENT_PROFILE_THRESHOLD’
   static const bool val = EventPriority<TEventId>::val <= PX_PROFILE_EVENT_PROFILE_THRESHOLD;
                                                           ^
../physxNV/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:66:2: error: expected declaration before ‘}’ token
 }}

ps: stilll have linker mistake somewhere, because i’ve also to rewrite some headers path (extensions/, common/, pxtask/) located in Include folder:

#include "PxPhysicsAPI.h"
#include "extensions/PxDefaultAllocator.h"
#include "extensions/PxDefaultErrorCallback.h"
#include "common/PxTolerancesScale.h"
#include "extensions/PxDefaultSimulationFilterShader.h"
#include "extensions/PxExtensionsAPI.h"
#include "extensions/PxDefaultCpuDispatcher.h"
#include "extensions/PxShapeExt.h"
#include "pxtask/PxTask.h"
#include "ofMain.h"

@spinzero you can do a:

    ls physxfolder/Include/

for physx 3.2 you must link to other material and at the moment I do not have with me the 3.2.

Dario

Hello Dario!

I’ve got sdk 3.3.3,
as mentionned in readme_linux.htm i checked:

libxxf86vm
-devlibgl1
-mesa-devlibglu1
-mesa
-devgcc
-multilibg++
-multilibia32-libs

…Only Cuda Toolkit 6.0 missing, to old for Ubuntu 14.04 and i wasn’t able to install either Cuda 6.5 or 7 (on Asus N550J)…

I compiled sdk sources without errors,
then tryed again both config.make after complete some headers path in xphysx.h:

 #include **extensions**/PxDefaultErrorCallback.h
 #include  **common**/PxTolerancesScale.h
...
 #include **pxtask**/PxTask.h"

Now errors seems coming from PxProfileCompileTimeEventFilter.h:

    In file included from /usr/include/X1complete some headers paths 
1/Xlib.h:44:0,
                     from /usr/include/GL/glx.h:30,
                     from ../../../libs/openFrameworks/utils/ofConstants.h:180,
                     from ../../../libs/openFrameworks/ofMain.h:5,
                     from src/main.cpp:1:
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:29:4: error: expected identifier before numeric constant
        None,  // the filter setting to kill all events
        ^
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:29:4: error: expected ‘}’ before numeric constant
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:29:4: error: expected unqualified-id before numeric constant
    In file included from ../PhysXSDK/Include/PxPhysicsAPI.h:73:0,
                     from src/xphysx.h:1,
                     from src/main.cpp:3:
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:40:50: error: ‘EventPriorities’ has not been declared
      struct EventPriority { static const PxU32 val = EventPriorities::Medium; };
                                                      ^
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:20:44: error: ‘EventPriorities’ has not been declared
     #define PX_PROFILE_EVENT_PROFILE_THRESHOLD EventPriorities::Medium
                                                ^
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:46:59: note: in expansion of macro ‘PX_PROFILE_EVENT_PROFILE_THRESHOLD’
       static const bool val = EventPriority<TEventId>::val <= PX_PROFILE_EVENT_PROFILE_THRESHOLD;
                                                               ^
    ../PhysXSDK/Include/physxprofilesdk/PxProfileCompileTimeEventFilter.h:49:2: error: expected declaration before ‘}’ token
     }}

Do i miss a step in sdk install,
i don’t need to put sdk headers or lib in /usr/ ?

thank’s

@spinzero

this is not necessary:

libxxf86vm
-devlibgl1
-mesa-devlibglu1
-mesa
-devgcc
-multilibg ++
-multilibia32-libs

the problem seems to be the linker.
make sure you’ve configured well config.make
point to physxsdk on your PC.

test create an empty project with only:

#include "ofMain.h"
#include "ofAppGlutWindow.h"
#include <PxPhysicsAPI.h>

#ifdef _DEBUG 
#pragma comment(lib, "PhysX3DEBUG_x64.lib") 
#pragma comment(lib, "PhysX3CommonDEBUG_x64.lib") 
#pragma comment(lib, "PhysX3ExtensionsDEBUG.lib") 
#else 
#pragma comment(lib, "PhysX3_x64.lib")  
#pragma comment(lib, "PhysX3Common_x64.lib") 
#pragma comment(lib, "PhysX3Extensions.lib")
#endif

using namespace std;
using namespace physx;

class ofApp : public ofBaseApp {

    PxPhysics*               gPhysicsSDK = NULL;
    PxFoundation*            gFoundation = NULL;
    PxDefaultErrorCallback   gDefaultErrorCallback;
    PxDefaultAllocator       gDefaultAllocatorCallback; 
    PxScene*                        gScene = NULL;

   void setup(){}
   void update(){}
   ...
};

Good Day
Dario

H!

I finally figure out!

To avoid enum redefinition error i switched an includes order:

include ofApp.h
include ofMain.h

…and precise some broken physx lib links through LD_LIBRARY_PATH …

thank’s for ur help, to

Hi Kashim!

I try to compile your sources on debian (& bumblebee) but
i get this error !?

Do you have an idea ?
thank’s

now I’m on a trip for work, when I get back in the office I do the tests!
of basic, remember an incompatibility with X11…

…X11 error disappear, but :

/usr/local/OF-9.7/apps/.../PxPreprocessor.h:326:$error: #error Exactly one of NDEBUG and _DEBUG needs to  be defined by preprocessor
error Exactly one of NDEBUG and _DEBUG needs to be defined by preprocessor ...
expected '}' before numeric constant  PxPRofileCompileEventFileter.h
'EventProperties' has not been declared   PxProfileCompileventFilter.h

…I didn’t change the config.make, where’s there’s some definitions:

defines   = -DPHYSX_PROFILE_SDK
defines   += -DRENDER_SNIPPET
defines   += -D_DEBUG
defines   += -D_NDEBUG
defines   += -DPX_DEBUG
...