iPhone support?


So, then I couldn’t use this IPhone support with the official SDK and release my game on the app store even if I’m on an Intel Mac? Or is there any way that this could be supported using Python?


I do plan to support the official SDK using this, so you’ll be able to develop in Panda using Python, then distribute your app on the App Store. But, you’ll need to have an Intel Mac, and pony up the $99.

We can also support the open-source toolchain, for the rest of you.



That’ll be great. This is awesome, great job.


Will you use the IPhone SDK 3.0?


Huh, I don’t know that it matters that much. The particular version of SDK used to compile the engine is surely the smallest part of this whole porting effort. Most of the stuff that Panda brings to the table is outside of the realm of the SDK, anyway–Panda is a 3-D graphics engine, while the SDK and its Frameworks provide fundamentally 2-D operations. If you’re programming in Panda, you probably won’t be using most of the UIKit operations, unless you go out of your way to call them directly (for instance, by using PyObjC or some such).

You could, of course, write your own Objective-C app using the full SDK and all of its interfaces, and also link with Panda to use Panda’s operations only when it suited you. Then you would largely be writing your own app using Apple’s SDK, and using Panda incidentally; and it would be completely up to you which version of the SDK you used.

But, if you wrote an app entirely in Python and Panda, you wouldn’t really see any of the SDK directly.



Hmm, it doesn’t seem like the Cg Toolkit supports the iPhone. We should get GLSL support working. :slight_smile:


GLSL not supported on the IPhone either. :slight_smile:



Oh, darn. I thought iPhone supported OpenGL ES 2.0 (which supports shaders) but it seems like they only support 1.1.


A bit of news:
the new iPhone 3GS supports OpenGL ES 2.0
:arrow_right: http://www.pocketgamer.biz/r/PG.Biz/iPhone+3GS/feature.asp?c=13744


Hi, I’m new here… This is fantastic news…

Dare I ask, when do you reckon this capability will be available?


Depends on how intrepid you are, I suppose. You could actually download Panda from the cvs tree and build it yourself (using a special iPhone build configuration), and run Panda3D apps on your phone today. But for a fully-supported turnkey solution, you’ll need to wait at least for the 1.7 release, which is not yet scheduled but will hopefully happen within a few months.

(In addition to the publish itself, there’s also a little more work that still needs to be done in the codebase to make it a complete iPhone solution. Some of this work will overlap with the web plugin effort I’m also working on, so I’ve put the iPhone development temporarily on hold while I continue the web plugin effort full-speed. But the claimed timeframe of a few months still applies.)



Quick reply! …wow, didn’t realise it was that developed? A few months? That’s nothing!

I’m a total noob to all this stuff really, I’ve just been looking for a way of making simple 3D games with my mate who is studying 3D modelling and animation. I looked at Blender but can’t import his 3dsmax models (with animation) properly it seems. I’m learning Python for my web development job, so I looked around and came across Panda! …looks great, and then read this about iPhone deployment, even better!

Nice one! Certainly appreciate all the hard work.


Sweet, looking forward to it. I’ve already started developing 2D games on iphone, but I already have a couple game concepts I’d really love 3D graphics for.


I’ve just checked in OpenGL ES 2.x support to CVS, including GLSL support of course.
It’s highly experimental, but functional (I can apply shaders to objects). Since the fixed-function pipeline is no longer there, we do need a shader generator with GLSL support though.

I don’t own an iPhone, but it seems to work on my PowerVR SGX 530 card of my OMAP 3530-based SoC. =) The iPhone 3GS uses the SGX 520, I believe, which is almost the same thing, but just 2x as slow.


your avatar makes my computer feel 2x as slow.

Can we get more updates from David regarding this? I heard that its stopped do to browser plug in. Can we get update on the plugin as well?


I’ve just changed my avatar. 8)

I can see he’s checking in loads of new stuff to the web plugin every day- most of it even compiles fine on my Linux box.
Too bad there’s no npapi plugin support for Linux yet, I’d love to try it already. :slight_smile:

PS. p3dPythonRun.cxx references a “runp3d_frozen.pyd”, how do I make that?


The plugin effort is indeed going well. I’ve got a webpage running Airblade and Roaming Ralph in a little embedded applet window. Right now I’m working on adding scriptability, so that Panda can control the web document; or JavaScript on the web page can control Panda. Still to come are automatic Panda version selection and patching, and security features. And, of course, support for Mac (partially complete so far) and Linux (not yet started).

The iPhone support is on hold for now, but it will eventually take advantage of the same .p3d packaged application we’ll be using for web distribution, so it does make sense to wait a little bit for that to be finished. Still, as it is right now, Panda does run just fine on the iPhone, with Python and everything. It does take a bit of an effort to compile for the iPhone, and this is one reason why it will be advantageous to have a p3d-runner already precompiled for the device. (Of course, installing this p3d-runner program on your iPhone will require a jailbroken phone, because Apple doesn’t want you to have apps that run other apps. For those who’d rather not go there, we can still provide the straight-and-narrow path to iPhone development, which will just be a little clumsier.)

I have the following script on my Mac box:

python $DIRECT/src/showutil/pfreeze.py -i direct.directbase.DirectStart -i direct.actor.Actor -i direct.fsm.FSM -i direct.directutil.Mopath -o runp3d_frozen.so direct.showutil.runp3d

.pyd is just the extension on Windows, other platforms will use .so.

Having the runp3d_frozen file isn’t enough, though; you’ll next need the Python/Panda package that it will want to download. I also have this script:

#! /bin/sh

cp -v $DTOOL/built/lib/*.dylib ~/p3drun/  || exit
cp -v $PANDA/built/lib/*.dylib ~/p3drun/  || exit
cp -v $DIRECT/built/lib/*.dylib ~/p3drun/  || exit
cp -v $DIRECT/built/bin/p3dpython ~/p3drun/  || exit

mkdir -p ~/p3dstage/coreapi/dev/osx.i386
cp -v $DIRECT/built/lib/p3d_plugin.dylib ~/p3dstage/coreapi/dev/osx.i386/ || exit

python $DIRECT/src/plugin/make_package.py -d ~/p3dstage -s ~/p3drun -p panda3d_dev_osx.i386  || exit
python $DIRECT/src/plugin/make_contents.py -d ~/p3dstage  || exit

And then I compile with:

#define P3D_PLUGIN_DOWNLOAD file:///Users/drose/p3dstage

As you can see, there’s a bit of setup work you’ll need to do to play with this locally. :slight_smile: Still, I don’t see any reason why you wouldn’t be able to get the panda3d standalone application to compile and run on a Linux box or anywhere else. It might not even be far to get the npapi part compiled on Linux, though I’ll get there eventually, I promise. :slight_smile:



Thanks - I was able to run p3dpython with your instructions. No idea how it works, though - does it communicate with the plugin via sockets? How is the XML stuff piped to p3dpython?

After a lot of hacking I was also able to get pfreeze, packp3d and runp3d working. Really neat stuff =)

I recently installed WinXP on VirtualBox (Panda works with 3D acceleration on it) so I’m sorely tempted to try building the plugin. :slight_smile:


p3dpython communicates with the browser via anonymous pipes, as created via the standard Posix pipe() call. This, of course, requires p3dpython to be launched as a subordinate process to the browser itself; it can’t be run from the command line. The XML data is streamed in both directions along these anonymous pipes; it’s just a quick-and-easy way to stream arbitrary data between separate processes.

Having Panda run in a separate process is quite a pain, but it really is necessary in order to support more than one instance of a Panda window running in the browser at once, especially unrelated instances. It’s also necessary to support different versions of Panda in different instances; and it has other nice advantages like keeping Panda’s frame rate independent of the browser, and helping to keep the browser from crashing in case the Panda app crashes.

I’m surprised it took hacking to get packp3d and runp3d running. Those should have worked out the box. pfreeze was a mess, though, and will definitely require some cleanup to make it more world-friendly. Are your changes safe enough to commit back in, to save me the work of re-doing your efforts when I visit Linux? :slight_smile:



Packp3d and runp3d worked well, but first I couldn’t get my models to load. I just found out I just had to omit the ‘.egg’ when loading models in my game, and runp3d would change the default model extension. Clever!
Maybe there should be a config var to force models to be loaded as .bam, even if .egg was explicitly requested, so any game given to packp3d would work. Then again, this would be a bit hacky.

Also, I think there should be a commandline option to specify custom extensions to be included (xml, etc) instead of just .egg and images.

First, I had to alter it to add the include and link directories of Python to the compile/link commands and “-lpython2.6”. (Is it a good idea to link to Python at link-time this way, or should we link to pystub or so.)
Also, it didn’t chew names with dashes (like Tut-Roaming-Ralph) because it would convert that into a C variable name. Maybe we should hash that or make pfreeze remove special symbols.