Android Bounty


#121

I’ve looked into the sources and tried to fix the errors by myself with putting the required #ifndef OPENGLES around the blocks where the errors occure. It now successfully compiles the glesgsg part but now hangs at the next one, the gles2gsg. This is the new output paste.ubuntu.com/9938917/
I’m not sure what cause those problems as the blocks where these errors are, are already surrounded with #ifndef OPENGLES_1 and 2 statements.

Btw, if that would help you, here are the diffs with the new #ifndef OPENGLES surrounded blocks.
glGraphicsStateGuardian_src.cxx: paste.ubuntu.com/9938876/
glSamplerContext_src.cxx: paste.ubuntu.com/9938882/


#122

Thanks! To clarify, OPENGLES_1 is defined when building glesgsg, and OPENGLES_2 is defined when building gles2gsg. OPENGLES is defined in either case.

For at least several of those errors, it seems that the relevant code has “#ifndef OPENGLES_1” around it even though OpenGL ES 2 doesn’t have it either, so it should say “#ifndef OPENGLES”.


#123

Ah, ok, thanks for the info, will check into that later today and try to fix it. If I get it to work, I’ll post the new diff files here.


#124

Finally got the font rendering (Alpha problem) fixed as well as some newly occured CG problems. All the fixes I’ve made to the panda code are attached to this post. I also got a small game working. Here is a screenshots from it.


GLES-Fix-Patch02.patch (2.82 KB)
GLES-Fix-Patch01.patch (25 KB)


#125

Great work!

I didn’t use your patches since they would break some GLES2 and regular OpenGL functionality, but I pushed some fixes that should address all of the compiler errors.


#126

When I tried to build android app using latest source from git, then I get error in the glGraphicsStateGuardian_src.cxx, which says that ‘GL_INT’ was not declared in this scope. And I really not found GL_INT in the GLES/gl.h, so I use next code as workaround
#ifndef OPENGLES
return GL_INT;
#else
break;
#endif
it allows me to finish compilation, though I not sure that it’s right solution.


#127

Almost - it should be “ifndef OPENGLES_1” since OpenGL ES 2 does have GL_INT.

Thanks! I’ve checked in a fix.


#128

Hey guys,

Not sure if this is still relevant or already found/discussed. I’m browsing through Github and found someone (KillerGoldFisch) who made some progress port with Android and Panda3D.

github.com/KillerGoldFisch/panda3d-android

There’s a step-by-step instructions and how to compile there for clarity.

Maybe his port can somehow help with the project here… :smiley:


#129

Lol… that seems like a fork of a port I’ve made before rdb introduced android support.
It was a new endeavor for me back then, and some of the comments seems even funny now… :smiley:

I guess I even deleted this port from github, but it seems he got the fork before.
There’s no need for such trouble. Panda3d has the support and is wayyy easier now (I guess even the makepanda has the support already - iirc)

Anyway, I advise not to use it. Look for the android support post rdb made instead. ^^


#130

Wow, lol ok. That’s good to know :slight_smile: Glad you guys made great strides since then! keep it up.


#131

I should point out that since the WebGL port seems to work fine on both Android and iOS, I’d personally put more focus there, since that would kill three birds with one stone.


#132

On phones and tablets sqeezing every bit of performance is even more important. However adding browser tech on top of it does not help to speed up things.


#133

can i talk about other engines in here?
i found a way to realise full 3D graphics in Kivy, which works on Android. so that’s a 3D gfx engine with python on Android.
but it’s just gfx, no exiting physics, collision, sound, ai… engine.
another problem is everything (transforming, culling…) is programmed in python, there’s not even ctypes in Kivy-Android. so with object count grows, the program runs slower and slower.
the basic idea of realising a 3D gfx engine in Kivy, is to transform obj matrix into camera space, and Kivy can draw the 3d mesh.
if someone can implement these in native code. then there is a good 3D gfx engine for Android.
but i doubt whether it’s worth the work, perhaps learning to use java is of less trouble.


#134

Hi there, I’m new here, although a long-time Panda3D user, but hopefully someone (especially rdb) can help me out?

I’ve been trying to get Panda3D and Python to work together on Android. I’ve successfully built Python 2.7.2 on Android (the regular ARM version), and put the libraries in the correct place for the Panda build. Then, I built Panda according to the commands listed by rdb, but altered --no-python to --use-python. Then I added the libraries to QPython and tried to import them.

Basically it all builds correctly. However, when I transfer the libraries to two separate devices, and try to import panda3d.core, I consistently get:

ImportError: dlopen failed: could not load library "libpanda.so" needed by "core.so"; caused by cannot locate symbol "PyObject_Cmp" referenced by "libpanda.so"...

I’ve tried the --static ‘makepanda’ argument too (out of curiosity) and fixed all the issues that the build had, but was still kind of sure it wouldn’t work as logic suggests. Unfortunately then I get a similar error about the _deflate symbol (or similar) not being locatable. Anyway, no matter what I do with the code, I always seem to get a missing symbol in ‘libpanda.so’ despite the build working okay. I’ve checked the verbose makepanda logs and Python2.7 is included in the commands where it appears it should be (towards the end of the commands).

I’m aware that Python on Android is currently ‘not working’ so have been attempting to accomplish it myself through adding to/altering the C++ code and looking at how/why the Linux build works properly. I have knowledge of assembler, Python, and many other languages, including writing my own (irrelevant I know, but just saying I am capable of eventually managing to get it to work), but unfortunately besides understanding the syntax and logic, I don’t know enough C++ yet, so I’m falling over constantly trying to work out what to create/change. It would be great to hear from and get a bit of help from anyone who is an expert – even a hint on where to start to get Python working properly on Android would be good. If that help is “it’s going to be really difficult for you, so don’t try” then I understand!


#135

PyObject_Cmp is a symbol provided by the Python so file. It could be that we don’t link libpython into libpanda.so, in which case it would be as simple as changing this in makepanda.py:

TargetAdd('libpanda.dll', opts=OPTS)

to this:

TargetAdd('libpanda.dll', opts=OPTS+['PYTHON'])

_deflate is a symbol provided by zlib. When compiling statically, it is necessary to link with dependent libraries at the final step of the compile process, so we may simply need to link with libz when producing the final shared library. I’ve not tried building Panda statically recently (or at all for Android), but it may be a matter of changing this:

TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2'])

to this:

TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2', 'ZLIB'])

The main problem at this stage is just that nobody’s tried building this in years, so the build system may simply be a bit rusty.


#136

Thanks rdb,

I’ll try what you suggested shortly. I’ve literally just tried (after posting the message) adjusting the arm-linux-androideabi-g++ line of the build to add:

arm-linux-androideabi-g++ […etc…] -Lthirdparty/android-libs-arm/python/lib -Lthirdparty/android-libs-arm/python/lib/python2.7 /media/kivy/MyFiles/android-ndk-r9c/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/libgnustl_shared.so -lpython2.7

And that seems to have worked, panda3d.core now seems to import on Android!

Thanks for your quick reply, it’s most appreciated. I’ll let you know how I get on (and will try what you said).

  • Greg

#137

Awesome! Keep us posted. :slight_smile: Feel free to ask for help if you need it.


#138

Success! These commands now import in my console and return without any errors whatsoever:

import panda3d.core
from direct.showbase.ShowBase import ShowBase

A similar adjustment to libp3direct.so was required to get the second line to work.

Just trying to sort out this error now when I use the ShowBase class:

Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.

I am using SSH at the moment to control the device(s), so that potentially could be a problem(?) I’ve tried adjusting config.prc (it is in the correct place, no error on the ShowBase import), but none of the load-displays seem to work (yet).

I haven’t forgotten your suggestion, and will try it when I next run the makepanda build and report back.


#139

As promised I tried your way too, rdb.

Your adjustments to makepanda.py did work, and resulted in a smaller filesize (due to the extra -strip command following it, which I didn’t include).

I also added PYTHON to TargetAdd for ‘libp3direct.dll’ due to the error when importing ShowBase. I’ll try all the available imports at some point to validate all the libraries are working.

I’m still not sure why the display won’t work, however, so I’m still not seeing anything, but feel like I’m missing something possibly obvious. I’ve definitely got config.prc being loaded, the Panda3D GLES .so library is in the correct place (I built Panda using your original command), pandagles is the choice for load-display, I’ve tried setting fullscreen to #t, and tried setting the plugin-path after searching around. Still a no-go at the moment for some reason!


#140

Hmm, for it to load a render plug-in, it needs to find and load a Config.prc file, find a “load-display pandagles” line in Config.prc, and then successfully load it. Either of those three steps could be going wrong here.

I think the reason it won’t work well is because none of the code we use to determine the location of Config.prc works on Android. Try this:

from panda3d.core import ExecutionEnvironment
print ExecutionEnvironment.getDtoolName()

That’s supposed to return the location of libp3dtool.so, and Panda is supposed to search up from that directory to find ./etc/Config.prc.

There are a number of things that control where it looks for .prc files, though. One of the ways to do this is by passing --override DEFAULT_PRC_DIR=/path/to/prc/dir/ to makepanda. This will force the build to always look in that directory
Another way is by just setting the PANDA_PRC_DIR environment variable to that directory before running a Panda app.

I never got to this because when I built pview as an Android Activity, I just used System.loadLibrary(“pandagles”) from the Java side to load the render plug-in myself. If you can use eg. ctypes to dlopen it yourself, that might be enough, as the plug-in should register itself.