Pi does physics better than I though it would!


28 posts   Page 1 of 2   1, 2
by chris_c » Mon Jul 02, 2012 10:21 am
http://www.youtube.com/watch?v=NsQpn3Z3U-s

I have to say it actually seems to be able to cope with ODE physics engine a sight better than I thought it would.

I'm not sure if I should add a simplified interface to ODE to my gles2framework...
its not really difficult to use ODE but it aint newbie friendly :D

I'm assuming that this is one area where you really see the benefit of hard float in raspbian ?

You could have knocked me over with a feather when ODE's build scripts automagically added hard float flags!
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by Burngate » Mon Jul 02, 2012 11:00 am
Knowing sod all about ODE (or GL ES or ...) never-the-less I was impressed! Beautiful demonstration!
Wyszkowski's Second Law: Anything can be made to work if you fiddle with it long enough.
Brain surgery is easier than psychoanalysis
User avatar
Posts: 2995
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK
by alexeames » Mon Jul 02, 2012 11:02 am
Excellent. We'll be able to do something like angry birds type games then. This is really cool 8-)
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2091
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
by chris_c » Mon Jul 02, 2012 12:22 pm
Burngate wrote:Knowing sod all about ODE (or GL ES or ...)

Well the idea behind my framework is that as long as you know some basic C you should be able to leverage the power of GL-ES after reading a few tutorials....

never-the-less I was impressed! Beautiful demonstration!

too kind... I've half a mind to throw in some sphere's as well on a static mesh, and really push it to see what it can manage.....
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by chris_c » Mon Jul 02, 2012 12:27 pm
alexeames wrote:Excellent. We'll be able to do something like angry birds type games then. This is really cool 8-)

2d physics is *well* within the reach of the pi, and 3d seems to be at least practical if you're careful! :D
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by Jim Manley » Tue Jul 03, 2012 8:39 am
Hi Chris - looks really nice! The README says "soon to support the raspberry pi". Assuming you hadn't updated the README.md, I tried to make inside the gles2framework directory on my Pi, but, got a "/bin/sh: pkg-config: not found" error right off the bat. I did create the /etc/ld.so.conf.d/vc.conf file as specified in README.md. Are you doing something manually in the interim in order to be able to generate the demo in the YouBoob video?

Looking forward to playing with this when it's ready :)
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by gregeric » Tue Jul 03, 2012 8:44 am
@ Jim: apt-get install pkg-config will fix that one.
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by chris_c » Tue Jul 03, 2012 11:01 am
its fully ready for the PI - yes I did forget to amend that bit for the readme.md

you might like to try

sudo apt-get install pkg-config

its mentioned as a dependency in the aforementioned readme.md :p
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by chris_c » Tue Jul 03, 2012 11:16 am
http://www.youtube.com/watch?v=QuzdWwQyJbo

64 boxes, 64 spheres, 1 static mesh 16,0002 triangles

30 years ago when I was hand assembling z80 code into a REM statement I had this dream spec for my "perfect" computer....

The raspberry PI blows it out of the water!

Don't let *anyone* tell you the raspberry pi is too underpowered for gaming, with a little creativity theres oceans of room for some absolutely stonking games on this platform! :D
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by chris_c » Tue Jul 03, 2012 11:30 am
oops i lied thought i'd mentioned pkg-config in the readme - does now!
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by gregeric » Tue Jul 03, 2012 11:37 am
Wow, that's pretty.
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by chris_c » Tue Jul 03, 2012 10:09 pm
http://www.youtube.com/watch?v=dbG6sQskxoQ better lighting and internal improvements....
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by Jim Manley » Wed Jul 04, 2012 3:00 am
chris_c wrote:oops i lied thought i'd mentioned pkg-config in the readme - does now!

Ha! Vindicated! :D

I figured I would need to pull in pkg-config, but, where my Pi is doesn't currently have wired network access, so, I have to either download .debs when I'm at work and install them manually after I get home, or move the Pi to a different undisclosed location where I can hook it up to a wired Ethernet connection. I still haven't been able to acquire a WiFi dongle that works, and neither of the two I already have is compatible.

I started following the dependencies for pkg-config, but the list keeps getting longer with each successive dependent .deb download, so, I'm hoping that I'll hit bottom before I have to move the Pi. Hmmm, I suppose I should be able to download a CD with everything in the current Debian armel spin and do it that way, but, it would have to be something with all of the .debs, unless I built them from source, and I would have to do that with the Pi (ugh), or look up how to cross-compile this particular flavor. Would I also need the current armhf spin, too?
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by Jim Manley » Wed Jul 04, 2012 4:27 am
DOH! I just found your earlier thread over in Programming ‹ Graphics programming ‹ OpenGLES:

viewtopic.php?t=9693&p=112231

So, Raspbian v2 is the baseline OS? That would explain the armhf automagically working comments, as well as making soooo much sense. :roll:
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by chris_c » Wed Jul 04, 2012 7:59 am
Saying rasbian r2 is the base would maybe be a bit strong, in theory any PI distro should do but YMMV, if you are using raspbian getting the upto date image makes sense...

In terms of speed especially if you are doing dynamics (physics) hard float should give a decent boost.

You really really should run a length of cat5... using ssh scp and also stfp capable editors on a laptop can make development a tad more luxurious, given the poor X speeds.

mind you there is a certain satisfaction to doing most of the work purely on the pi....
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by gregeric » Wed Jul 04, 2012 11:56 am
Eager to get this running locally so did a fresh git clone.

apt-get install libode-dev

make phystest

gcc complains about libode.a: No such file, so I hacked the makefile to point it to /usr/lib/libode.a and it built.

Fails to run though...
Code: Select all
LD_LIBRARY_PATH=/opt/vc/lib ./phystest

ODE Message 2: inertia must be positive definite in dMassCheck() File ../../../../../ode/src/mass.cpp Line 53

ODE INTERNAL ERROR 1: assertion "dMassCheck(mass)" failed in dBodySetMass() [../../../../../ode/src/ode.cpp]
Aborted

Is this the Pi equivalent of the Amiga boing demo? I'd love to see it running!
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by chris_c » Wed Jul 04, 2012 1:04 pm
You'd be better off compiling version v0.12 from the source release you can then
cp ../ode-0.12/ode/src/.libs/libode.a .
from the gles2framework directory

You need it to be dSingle with trimesh support and you might want other things like custom cylinder vs cylinder colliders etc you won't get from the repo version
set drawstuff=none for quicker build (no demos etc)

I'd thought it was obvious from the makefile and static compile that thats what I'd intended, but I'll add something in the README.md

Use of ODE is really only intended for more advanced users and I've yet to decide if I'm going to make a simplified interface for it like I have with the more tedious aspects of GLES....

its a little more than the amiga "bong" demo search chriscchrisc on youtube....
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by chris_c » Wed Jul 04, 2012 1:12 pm
readme.md is updated - I really shouldn't keep assuming things as it makes an **** out of me
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by gregeric » Wed Jul 04, 2012 5:13 pm
Hi Chris all built fine with latest tips & running at last - thanks!

I know there's a huge amount more to it than the old boing demo but it recreated a similar "wow" reaction - for me at least. Hope it'll do the same for my son too ;-).

All that CPU/GPU action certainly warms the Pi a tad!
Posts: 147
Joined: Mon Nov 28, 2011 10:08 am
by Jim Manley » Wed Jul 04, 2012 5:30 pm
As I was reading back through older posts, it struck me ... Angry Birds ... in 3-D! Where did I put those stereoscopic glasses ... ? :lol:

Unbelievably, Angry Birds Space is stuck in 2-D, despite the fact that all of the platforms it runs on have GPUs in them. Of course, to avoid being sued, we'd have to change the birds into pterodactyls or something, make the pigs into hippos, and call it Raging Fowl?

Ka-Kaw! :D
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by chris_c » Wed Jul 04, 2012 6:24 pm
i'd favour mildly miffed marmosets myself :D :lol:

on the subject of CPU heat, I don't seem to get much at all, on the other hand it is very likely to reboot if I mess with even modest overclocking settings... each pi is different no doubt...

mind given that demo I really don't think overclocking is essential, if only X was accelerated *sigh* the one thing thats badly letting down the pi, it'll make a big difference!

on the subject of teenagers :-0 a few *cough* years ago when I was a teenager on a zx81 / BBC B / mz80k / etc etc, I'd have loved some kind of simple coding framework with a bunch of tutorials (I could have never dreamed of the internet then!) and thats the whole inspiration behind gles2framework

If anyone has ideas for tutorials or sample code please do not hesitate to PM me your contact details

I already have someone who has asked to do a blank SD card to running the examples tutorial / walk-through which if that comes off I'll be stoked.

I have access to a VPS and hope to have a collection of downloads / tutorials - all slanted towards C / GLES / game making on Rpi (and linux desktop too)
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by Jim Manley » Wed Jul 04, 2012 9:59 pm
chris_c wrote:i'd favour mildly miffed marmosets myself :D :lol:

Ha! :D
chris_c wrote:on the subject of CPU heat, I don't seem to get much at all, on the other hand it is very likely to reboot if I mess with even modest overclocking settings... each pi is different no doubt...

If the CPU and GPU are run full-bore, heat will increase in an airtight enclosure up into the high 80s to mid 90s degrees F, depending on ambient temperature.

As you may know but others may not, all of the devices of a specific model are made right next to each other on the same wafers and it's not known what the max speed of any device will be until it's tested. They're then sorted, marked, and priced according to rated speed - so, it costs just as much to make a laggard as a speed-demon, there are just fewer faster devices in any given batch in accordance with a statistical bell curve with speed increasing along the x axis (the yield curve).

chris_c wrote:If anyone has ideas for tutorials or sample code please do not hesitate to PM me your contact details

I have access to a VPS and hope to have a collection of downloads / tutorials - all slanted towards C / GLES / game making on Rpi (and linux desktop too)

The Pi-finity! game system I'm developing will feature open source and be written, commented, and documented specifically to help teach students 3-D and game software development. Your framework seems to provide a nice way to divvy up OGLES functionality and I may use it in Pi-finity! if it makes sense. My intention is to also distribute Pi-finity! as an SD image because it's going to need a cut-down version of the OS, a specific CPU/GPU RAM split (192/64 or 128/128 MBs) that maximizes what's needed for the system, rather than the typical default provided in the standard SD card distributions, and other customizations (not to mention ensuring the right dependencies are already in place - I hate chasing down dependencies).
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1358
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by HenryG » Thu Jul 05, 2012 6:12 pm
I't possible to regain the 20% of cpu that the RPI is spending in USB/ethernet management. See http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=7866
Posts: 28
Joined: Sat Sep 10, 2011 3:15 pm
by chris_c » Thu Jul 05, 2012 6:27 pm
well and good if you are just playing with an emulator with some gpio joystick

but at the very least you need Ethernet to do anything and if you crash before you can re enable the module then its switch off time - with the attendant risk of data loss... it just aint worth it.

The fact the usb subsystem is designed broken (much like the sound system - PWM gaaah) is just something you have to live with, with such a cheap platform.

and in any case *even* with the "wasted" 20% cpu time and even *without* overclocking, there is more than enough power to make and play some cracking games.... :)
Posts: 119
Joined: Sun May 06, 2012 10:23 am
by HenryG » Sat Jul 07, 2012 6:40 pm
There is a recent fix in the firmware that fixes this 20% cpu issue, it's reported in that same thread.
Posts: 28
Joined: Sat Sep 10, 2011 3:15 pm