Monday, October 03, 2005

PocketHAL kick ass

This blog isn’t going to be about CAB-files either.

I ported my code from GAPI to PocketHAL today. I must say that the results surprised me a lot. First off, the code actually runs a bit slower on my hw6515. I don’t know if it’s actually slower, there is some stuff to take into consideration. For example, there is a FPS counter running in realtime, on display. It might take some time to render.

Then I ran it on my h5450, and DAMN! PocketHAL really hits the h5450’s sweet spot! When I was running upon GAPI, I managed to optimize the code about a little. The rasteriser inner loop was optimized using tips from Writing Efficient C for ARM (a thread on PocketMatrix), and I managed to squeeze another 5-6 FPS out of the h5450 (all while the hw6515 was gaining 50 FPS or so, and the Axim x30 another 100 FPS). But when I ported the code over to PocketHAL I suddenly had better results from the h5450 then I had from the hw6515. Damn, was I surprised! The S100 and the x30 however didn’t show any staggering results at all, more or less the same as I got with GAPI. I dare say that my hunch feeling is that it is actually slower on the hw6515, x30 and S100.

I don’t know why it turned out like this. I think that I should investigate some in it, or maybe I’ll just ignore it and live happily with the thoughts of my fine ‘ol h5450 isn’t so bad after all :). I have decided to go on with PocketHAL, because it gives good performance over more machines. I will donate some money tomorrow or so, so that I can have the untagged version.

So what’s up next? I think I will look at the PocketFrog project, it introduces some handy functionality. However after I browsed thru some of the code, I suspect that there are some optimizations left to do (as if I don’t have to optimize my own code first). But still, reading images from disc and other useful stuff would really come handy.

So I suppose I will write about PocketFrog tomorrow.

Sunday, October 02, 2005

3D graphics coding on Pocket PC

3D graphics in your Pocket PC

So I said in my last blog that this blog was going to be about CAB-files huh? Yeah I suppose I did. Anyway, it isn’t going to be about that. Next blog will be about that however.

A year ago I coded a Java Applet on a Apple iBook. Some weeks ago I found that source again and put the demo online Java 3D Applet. And then I decided that I should port that code into C# and make it run on Pocket PC. I had it running in about a couple of hours. Basically all I had to do was correct the syntax. Now I had to run it upon some sort of graphics library. GapiNet sucks really bad, so that wasn’t an alternative. GapiDrawNet however is qute fast, so I used the 30 day demo version to render my whatever my 3D-engine was going to spit in my lap.

I found out that GapiDrawNet didn’t include any good polygon drawers, but only rectangular drawing. I haven’t looked any closer at GapiDraw to see if perhaps there was a polygon drawer in the native lib that just wasn’t mapped into the GapiDrawNet code. So I draw some lines instead, and all was extremely slow. :(

Anyway, I started out on a quest to port my 3D-engine to C++ instead. It was easier said then done. I ended up rewriting the whole code, plus some other code. I also scrapped GapiDraw since it is too expensive for me, and wrote my own graphics lib. Now I have managed to render some cool stuff in real time.


This screen shot is taken from the emulator. I don’t have any mesh reader implemented so I have only tried the cube yet.

Now, let’s do some benchmarking.

HP iPAQ hw6515: Width: 240, Height: 240, FPS: 152
QTek S100: Width: 240, Height: 320, FPS: 110
Axim X30: Width: 240, Height: 320, FPS: 206
HP iPAQ h5450: Width: 240, Height: 320, FPS: 44

Next step would be to optimize it. I think there is a lot that could be done to it. There are a lot of features that I would like to add to the engine as well. Lighting is probably the first thing I will look at. Alpha shading would be nice too. Also I think that I will probably scrap my own GAPI wrapper and go for PocketHAL since it support a lot more features then I will ever bother to put in. Another positive thing about PHAL is that it’s donateware, so even I can afford it :).

When I am satisfied with those things, I think I will go on and write some 2D graphics stuff. I just had to get the 3D out of my system :D.

If you want to get into graphics programming on the Pocket PC then I suggest you check out http://www.pocketmatrix.com/ these guys are sharp.

Oh I forgot, you can download the demo from http://frasse.zapto.org/gouraud.exe, just put it on your Pocket PC (ARM) and run it.