Panda3D on Mac from p3dapp

Hi all,

I have been searching for a way to use Panda3D on my Macbook Pro running Mac OS X 10.5 Leopard and found one today. This method should work, I guess, on 10.4 if you install Python 2.4 as noted in the last part. I am new to Panda3D and was simply looking to experiment. Since there is not a lot of information about getting things to work under OS X I thought I would post how I did it.

All credit for the hard work it took to actually get things working by patching and compiling must go to Hypnos (and others?). All I did was move things to where it was easy to run the samples on my system.

The end result of all this is an install of Panda3D that is available for general system use (or to your user, depending on where you put the frameworks).

Hypnos’ thread on his OS X application bundle is below for reference. If you’re going to distribute a Panda3D application, you should probably stick with the bundle he’s made. My method is more for learning and easily running tutorials. … highlight=

First, download p3dapp from here (I got 0.7): … ts/p3dapp/

Open that DMG file, revealing the p3dapp application bundle. Right click or Ctrl click and select ‘Show Package Contents’ from the menu. Open another finder window and select ‘Go To Folder…’ from the ‘Go’ menu. Type in ‘/usr/local’ without the quotes and click Go. If you get ‘the folder cannot be found’, open the Terminal and create it with ‘sudo mkdir /usr/local’.

Back in the package contents window, navigate into the Content folder, then into the Resources folder. Copy the opt folder and the panda folder into /usr/local (you probably will be prompted for your password). Now, in the package window navigate back one directory and then into the Frameworks directory. In your other finder window go to either ~/Library/Frameworks or /Library/Frameworks (the first will make Panda available to your user and you may have to create the directory; the second will make it available to all users on your system. I went with the first.) Copy Cg.framework and OpenAL.framework to the Frameworks directory you chose.

Now add this to your .bash_profile:

# Add Panda3d path and dev variables
if [ -d "/usr/local/panda/bin" ]
    export PATH="/usr/local/panda/bin:$PATH"
    export PYTHONPATH=/usr/local/panda/lib:/usr/local/panda/lib/direct
    export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}/usr/local/panda/lib:/usr/local/opt/lib

And finally, if you want openal audio, edit /usr/local/panda/etc/60_config.prc. Comment out the fmod_audio line and uncomment the openal audio line above it. Close your Terminal and restart it so the new environment variables take effect.

Grab the ‘complete source code’ tar.gz file and decompress it. Open the Terminal once more and navigate to the samples directory in the newly decompressed source directory. Run a sample by going in one directory and executing ‘python’

You will get warnings about a Python C API version mismatch if you are using 10.5’s Python 2.5. So far I have ignored them and things have worked well enough to run all the samples I have tried. The only thing I’ve run into so far is a few samples (fireflies) report that the video driver doesn’t support multiple render targets. Maybe someone with more Panda3D experience can sort that out.

Also, the C API warnings can become overwhelming, so you might want to play with Python’s warning control switch. You can use something like:
python -W ignore::RuntimeWarning

The full blown description of Python warnings is here and in the python man page.

If you’re on 10.4 or want to try Python 2.4 on 10.5 (don’t recommend this), there are universal packages of 2.4 here:

Hope this helps someone else get started today with Panda3D!

Could you write a HOW TO compile panda3d on mac in the manual?

Last time i checked panda3d could be compiled using the available tutorials (under the mac build thread).

You may encounter problems if you compile under 10.5, under 10.4 everything should work fine.

This thread is using the prebuilt package i made quite a while ago, where i relied on the build tutorial as well. This build also incorporates openal (using patches), which unfortunately doesnt even work fine with the fixes (only 1 sound channel). I still recommend using fmod for osx.

Could some of you mac people make us a mac 1.5.0 distribution?

I’ll try to do it.

I have already successfully compiled panda3d 1.5.0. Still got to pack it up.

Bamboo seems to work mostly, however i get the error:
Warning in ./models/phong-hyperShade.egg at line 14, column 39:
envtype { normal_gloss_map }
Normal maps seem to be fine, not sure about the per-pixel lighting.

I have posted a new binary under the “General Discussion” -> “1.5.0 Release! (partay!)” thread. I will also post it under the orignial thread of the binary osx release.

Hi guys,

I followed the instructions on the thread but i get this error message when I run one of the samples:

Traceback (most recent call last):
File “”, line 18, in
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

i’m currently working on it, but just wanted to know if someone else has had this message with this instructions.

Thanks much in advance.

check your PYTHONPATH in the .bash_profile file. It must contain the directory you have the direct and pandac directory in.

Yes Hypnos, thank ou, I had realized it after posting thanks for the response, If anything else comes up I’ll let you guys know

Hi I’m pretty new to mac, so I don’t know a lot about unix.

I’ve read all the tutorials and did searches online, but could someone explain how I can access the bash_profile or bash_login file? Without being able to edit it, I am getting a lot of import errors.

I guess importing code that is not there is hard to do.

.bash_profile and/or .bash_login are located in your home folder and are invisible by default (that’s what the period in front of the names does). TextMate, for one, will allow you to see invisible files when you use its Open command (there is a checkbox to toggle the setting). The free TextWrangler might do the same thing.

Another alternative is to use the Automater action to reveal all invisible files in the Finder. I can’t recall if that action comes with Leopard or not. I may have downloaded it from somewhere.

The point is that once you can see .bash_login (or .bash_profile – they do the same thing AFAIK), you can edit it with any text editor.