PDA

View Full Version : iOS Support



Andru
29-03-2011, 07:08 PM
I spent a lot of time with ritual dances and launching rays of hate to Apple for their licences and finally I got FreePascal for iPhoneSim and real iOS, and also headers, which were converted from original h-files. And here the first happiness - Hello World(taken from here (http://wiki.freepascal.org/iPhone_Laz_Extension#Hello_World)) with configured Makefile for automatic building and uploading binaries to iPhoneSimulator. So, I'm going to learn Cocoa API and EAGLContext for initializing OpenGL ES context :) For now there is only compilable core of ZenGL.

http://zengl.org/history/zengl_ios_screen01s.png (http://zengl.org/history/zengl_ios_screen01.png)

Traveler
29-03-2011, 07:34 PM
You, sir, are going to make a lot of people happy.

wagenheimer
29-03-2011, 10:16 PM
Awesome news!

Andru
30-03-2011, 12:21 AM
Maybe this topic will be something like a mini-blog :) Current progress is:
- new units for abstraction from Objective-Pascal iOS-code inside ZenGL procedural code
- logging is now works
- ZenGL can create simple window :)

Next step will be mainLoop and some other stuff related to window and screen.

wagenheimer
30-03-2011, 03:28 AM
Go on!! Keep on the excellent work! =)

paul_nicholls
30-03-2011, 03:45 AM
Awesome dude!

cheers,
Paul

AirPas
30-03-2011, 09:22 AM
wow , i'll check this thread always

Andru
30-03-2011, 07:48 PM
So, mainLoop is done(with quite crazy code because of iOS architecture >_<). Window now can be fullscreen and timers are working. But seems I will rewrite timers, because there are some problems with UNIX functions on iOS. GetTimeOfDay seems to work fine, but FpStat for checking if file/directory exists - is not... Another problem - there is no full documentation for Objective-Pascal with some comparisons with Objective-C constructions, and this makes hard to understand Cocoa API with only Objective-C examples in official documentation and internet.

Starting to read about EAGLContext under iOS :)

update: About documentation I was a bit wrong - here the comparison (Differences) :)

Chesso
31-03-2011, 02:39 AM
Not exactly sure what this means, but I hoped to develop for iOS later down the track and if I can use the language I already am, that would be awesome!!!

Andru
31-03-2011, 10:58 AM
but I hoped to develop for iOS later down the track and if I can use the language I already am, that would be awesome!!!
ZenGL API will be always Pascal-compatible, Objective-Pascal is used only inside zgl_ios_* units, which are provides system part :)

Andru
01-04-2011, 06:35 AM
EAGLContext now is initializes and CEAGLLayer creates, so next step will be correct using presentRenderbuffer with GL_RENDERBUFFER_OES for rendering something :)

PS: Apple... as always they want to be different and develop their own bicycles like EAGLContext and CEAGLLayer instead of using concept of EGL, which is used on other platforms :)

Andru
01-04-2011, 05:11 PM
YEAH! :)
http://zengl.org/history/zengl_ios_screen02s.png (http://zengl.org/history/zengl_ios_screen02.png)

There are only red quad and white background because of glClearColor(always yours, Captain Obvious :)). And this is not a first april joke :) Next step is loading resources and some cleaning of code(current realization is little bit draft).

Andru
03-04-2011, 07:13 AM
So, here are I'm now :) I've built some static libraries for resources(zlib, libogg, and libvorbis) and now ZenGL can this:
http://zengl.org/history/zengl_ios_screen03s.png (http://zengl.org/history/zengl_ios_screen03.png)
I think next few days(or maybe week) I will work on all other system stuff like "touch"-input, rotating device and so on.

paul_nicholls
03-04-2011, 09:01 AM
rock on!

cheers,
Paul

Traveler
03-04-2011, 10:11 AM
Awesome work!

WILL
03-04-2011, 10:38 AM
Wow, nice. :D

Do you have access to actual hardware that you can test it out on? I think that would be your last official step to ensure that ZenGL will run on the iPad or iPhone well.

Also, it would be a HUGE boon to those that want to setup FPC on their Macs to do iOS development if you could write a tutorial on how to get a development environment setup and what configurations should be made. This is something that has hindered even my own progress on this front for my own iOS efforts.

Andru
03-04-2011, 11:33 AM
Do you have access to actual hardware that you can test it out on?
Personally I have no iPad/iPhone(for now, maybe later I will buy it :)), but friend of mine have it, and as soon as we resolve question with certificate, I will be able to test all this on real device :)


if you could write a tutorial on how to get a development environment setup and what configurations should be made
Yeah... there are a lot of steps, but for all of them I have written bash-scripts :) Only one question which I didn't check it's a building from Xcode for uploading applications to iPad/iPhone.

wagenheimer
03-04-2011, 12:08 PM
Congratulations! =)

I have an Iphone and a Developer Account! If you want, I cant test it on real device to you!

Stoney
03-04-2011, 01:50 PM
I have an Iphone and a Developer Account! If you want, I cant test it on real device to you!

Same here. I have an iPod Touch 4th Gen (Retina Display).
Btw: You should check if it works with XCode 4. Apple made some major changes with the new XCode version and a lot of things broke in the process.

Andru
03-04-2011, 02:22 PM
You should check if it works with XCode 4. Apple made some major changes with the new XCode version and a lot of things broke in the process.
Reading mac-pascal mail list I found that there is no support for it with FreePascal...

Stoney
03-04-2011, 03:55 PM
XCode 4 works with FreePascal 2.5.1, see: http://web.me.com/macpgmr/ObjP/Xcode4/ObjP_Part1.html

Andru
03-04-2011, 04:19 PM
XCode 4 works with FreePascal 2.5.1, see: http://web.me.com/macpgmr/ObjP/Xcode4/ObjP_Part1.html
Hm, interesting :)

So, can anybody sign&test for me this executable (http://zengl.org/tmp/demo01.zip) via codesign as described here (http://developer.apple.com/library/mac/#documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2)? :) It was built with iPhone SDK 4.2, zlib for ARMv6, but I don't know for which ARM is configured gcc toolchain.

wagenheimer
03-04-2011, 09:35 PM
Apple really does not make the things easy. I am not able to sign your application. The command line instructions really does not help much! =(

I have some work to do now, but I will take a look on it again later!

WILL
03-04-2011, 10:29 PM
You know what, I've actually went out to the book store to pick-up a couple of books on the subject (teaching Objective-C as it be) and they actually have some good information about using Xcode and getting your Apps setup on a real piece of hardware and even the whole submission process getting it onto the App Store. It might not hurt to check out some of these books.

I have...


iPhone & iPad Game Development for Dummies (http://www.amazon.com/iPhone-iPad-Development-Dummies-Computer/dp/0470599103/ref=pd_sim_b_6)
Beginning Mac Programming (http://www.amazon.com/Beginning-Mac-Programming-Objective-C-Programmers/dp/1934356514/ref=sr_1_1?s=books&ie=UTF8&qid=1301869701&sr=1-1) (Develop with Objective-C and Cocoa)

I also was looking at...

iPad Programming (http://www.amazon.com/iPad-Programming-Daniel-H-Steinberg/dp/1934356573/ref=pd_sim_b_7)
Head First iPhone and iPad Development (http://www.amazon.com/Head-First-iPhone-iPad-Development/dp/1449387829/ref=sr_1_4?s=books&ie=UTF8&qid=1301869415&sr=1-4)

The Objective-C stuff might not be as useful to us, but all the other Xcode and Apple Developer stuff might come in handy to learn from a book.

wagenheimer
04-04-2011, 10:35 PM
Well.... It works!! =)... It's signed and running on my Iphone! 60 fps!

The command to sign is really simple :

codesign -s Developer demo01.app/demo01

paul_nicholls
04-04-2011, 11:02 PM
That is so awesome! :)

Now I wish I had a iPhone/iPod, or some other flavour of Apple device to try programming for LOL

cheers,
Paul

Andru
09-04-2011, 05:49 PM
Now ZenGL can rotate viewport together with device :) Also all new code have been committed into svn. Maybe later I will provide all object files for zlib, libogg, libjpeg and chipmunk.

Andru
13-04-2011, 09:41 PM
Last time I was busy by other aspects of ZenGL, but few moments ago I finished implementation of mouse events emulation via touch input :) And I will start to implement touch_*(still thinking which functions will be useful) functions specially for iOS, because emulation of mouse_* functions(mouse_X, mouse_Y, mouse_Down, mouse_Click, mouse_DblClick and mouse_Up for M_BLEFT) is not enough.

Ingemar
19-04-2011, 10:02 AM
Well.... It works!! =)... It's signed and running on my Iphone! 60 fps!

The command to sign is really simple :

codesign -s Developer demo01.app/demo01

I am trying to understand the process of loading an iOS program into a device. What does codesign do? How do you transfer the application? (Preferrably without using Xcode.)

Andru
19-04-2011, 02:46 PM
Ingemar

What does codesign do?
Allows your application to work on iOS-devices.


How do you transfer the application?
After signing you can just drag&drop your bundle to iTunes :)

Ingemar
19-04-2011, 03:57 PM
Ingemar

Allows your application to work on iOS-devices.


After signing you can just drag&drop your bundle to iTunes :)

So... all I have to do is to figure out how to call codesign properly, and then the developer can drag-and-drop and test as much as he/she likes? Sounds pretty easy.

Andru
23-04-2011, 07:35 AM
So, I have written the first part of the notes "ZenGL for iOS" (http://zengl.org/wiki/doku.php?id=other:ios). It can be useful not only for those people who uses ZenGL :) A bit later I will write about compilation some of ZenGL demo.

WILL
23-04-2011, 01:08 PM
That wiki of yours is looking pretty handy so far. :)

Especially the iOS section. I imagine you'll update it once the FPC team releases the 2.5.2 version of the compiler?

Andru
23-04-2011, 07:42 PM
I imagine you'll update it once the FPC team releases the 2.5.2 version of the compiler?
I hope so, and I hope that after official release of FreePascal 2.5.x it would be much easier for programmers to compile something for iOS via FreePascal :)

So, I have finished second part of those notes and put sample project for compilation and testing :)

wagenheimer
23-04-2011, 09:16 PM
Well.. as expected it does not works with XCode 4.0.2. I get this error when running finish_fpc_iphone_install.command (object file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk//usr/lib/crt1.o was built for different arm sub-type (6) than link command line (0) for architecture arm)

Downloading XCode 3.2.6 (4.1 gb) and I will try again.

Andru
23-04-2011, 09:40 PM
As I remember XCode 3.2.6 is also ships with iOS SDK 4.3 and this can be a problem, because parser for Objective-C headers officially can be used only with iOS SDK 4.2.

wagenheimer
23-04-2011, 09:54 PM
I will test it here... but anyway, where can I find XCode 3.2.5? I could not find it on Apple iOS developer WebSite.

Andru
23-04-2011, 10:06 PM
A bit time for googling and here the result from official server(you must login first):
https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.2__final/xcode_3.2.5_and_ios_sdk_4.2_final.dmg

Anyway, I will try to do something with Xcode 3.2.6 and 4.0.2 later

Andru
11-05-2011, 11:00 AM
Some news since last time:
- implemented touch_* functions
- implemented virtual keyboard
- implemented loading jpgs via UIImage(and found bug (http://bugs.freepascal.org/view.php?id=19329) in FreePascal converting scripts)
- implemented locking device orientation(Landscape/Portrait)
- implemented tex_GetData via FBO

So, maybe I will release stable ZenGL 0.2.2 and development version 0.3 soon :)

Stoney
15-05-2011, 04:52 PM
I just remembered that your ZenGL license is LGPL. You should really consider changing the license as at the moment this only allows open-source software to be developed with ZenGL for iOS devices.
Libraries for iOS have to be linked statically and commercial closed-source usage with LGPL libraries is only allowed if the library is linked dynamically.

Andru
15-05-2011, 06:32 PM
Yeah, I know, and what? :) I haven't thought about the license for commercial projects, because currently ZenGL is in development stage for iOS. Maybe later I will provide some commercial license or something else.

Ingemar
30-05-2011, 06:58 AM
Now ZenGL can rotate viewport together with device :) Also all new code have been committed into svn. Maybe later I will provide all object files for zlib, libogg, libjpeg and chipmunk.

I can't find any reference here not on the ZenGL pages on to how to perform the svn checkout. Only by Googling I found the address

svn co http://zengl.googlecode.com/svn/tags/0.2.x

which works, but I am not sure if that will check out the right version.

Andru
30-05-2011, 07:27 AM
In topic Description (http://www.pascalgamedevelopment.com/showthread.php?6404-Description) you can find link to "SVN repository" :)


svn co http://zengl.googlecode.com/svn/tags/0.2.x
This command will checkout stable 0.2.x branch.

Andru
15-01-2012, 10:35 PM
I updated note about compilation ZenGL for iOS (http://zengl.org/wiki/doku.php?id=compilation:ios). With FreePascal 2.6.0 now it's quite easy to use it with XCode.