Getting started for iOS/OSX dev

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Getting started for iOS/OSX dev

Post by d000hg »

I've been reading a bunch of Ogre articles and spotted some slight concerns for a noob to developing on Apple with XCode - I've got a Mac and an iPad but only ever developed on Windows. I hope you can help me understand clearly!

Firstly, what version of XCode/OSX should I have? I am running 10.6 (Snow Leopard) and all the 4.x versions seem to require 10.7 (Lion)... the latest I seem able to get without upgrading my OS is 3.2.6 for iOS 4.3. Is this a problem? On the other hand, I read there are problems with XCode 4.3 relating to CMake and as a total newcomer to Apple Development who finds CMake confusing enough on Windows, I want the smoothest path I can to get up and running!

Secondly, what version of Ogre? I can get a nice packaged 1.7 SDK but it seems 1.8 is much more advanced for serious iOS development. Do you guys provide a 1.8 SDK as part of some automated build, or does going to 1.8 mean I have to build from source?

I know you have to be on a paid Apple dev program to get apps into the store, but reading around it sounded like even copying onto my local iPad has this requirement, only the simulator can be used for free developer accounts. Is that right?

I have more questions but don't want to overwhelm you with them except to ask... as an experienced Windows C++ developer who's used Ogre and just about gets CMake, how much pain am I looking at getting Ogre set up for iOS, and ideally for iOS+Mac, development? A rough idea how many headaches to expect is all I mean!! Thanks :)
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Getting started for iOS/OSX dev

Post by aleroy »

Yeah, it can be a little scary getting started ... especially if you've never developed on a Mac. I was in your shoes 4 months ago, so most of these concerns are still fresh in mind. I started off with XCode 4.0 and MacOSX 10.7. From what I here, it's best to keep all your Mac software up-to-date (unlike Windows, Mac updates tend to work without breaking everything ... although, the latest XCode updates haven't quite held to that). If you're able to update your OS, I would suggest you do it; it's likely to be worth your time in the long run.
d000hg wrote:Firstly, what version of XCode/OSX should I have?
XCode 3.2.6 should work just fine. I don't know from personal experience, but I see plenty of documentation as well as posts from users with that environment.
d000hg wrote:Secondly, what version of Ogre? I can get a nice packaged 1.7 SDK but it seems 1.8 is much more advanced for serious iOS development. Do you guys provide a 1.8 SDK as part of some automated build, or does going to 1.8 mean I have to build from source?
I was never able to get OpenGL ES2 to work with the Ogre 1.73 SDK ... but, from forum posts it seems it may be possible. That was my main reason for switching to Ogre 1.80. You can find more about 1.8 features here: http://www.ogre3d.org/tikiwiki/ByatisNotes.
d000hg wrote:I know you have to be on a paid Apple dev program to get apps into the store, but reading around it sounded like even copying onto my local iPad has this requirement, only the simulator can be used for free developer accounts. Is that right?
Yep, that's right.
d000hg wrote:I have more questions but don't want to overwhelm you with them except to ask... as an experienced Windows C++ developer who's used Ogre and just about gets CMake, how much pain am I looking at getting Ogre set up for iOS, and ideally for iOS+Mac, development? A rough idea how many headaches to expect is all I mean!! Thanks :)
You can download the SDK for iPhone from the download page. You also need to grab the iPhone Dependencies and XCode templates. When you start a new project with the templates, you will probably need to change the OgreFramework singleton instance definition to ms_Singleton (from msSingleton ... or vice versa).

Having the prebuilt SDK and XCode templates makes it really easy. It's then more an issue of getting used to XCode and the Mac environment in general.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Yeah I saw the "getting started in 15min" page and thought "this looks pretty easy". Then I looked at the pages on building from source and saw mentions about hacking CMake and I can't remember what else, and got pretty scared! Probably more because of CMake - I've used it on several OSS projects but still don't really know what I'm doing :)

That's a real bummer I can't test my code on my own iPad without paying an annual fee. I assumed XCode would at least let me copy it via a physical connection using the USB cable for local testing! Is testing Ogre on the simulator feasible, or is it really slow?

Looking at the 1.8 notes, it's really only ES2.0 that I would want. If I can get away with a pre-built SDK that sounds great - unless anyone is hosting pre-built 1.8RC SDKs ;) Although one fly in the ointment, I use MyGUI in my current codebase and guess I'll have to build that myself for iOS.

Thanks a lot for your help!
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Getting started for iOS/OSX dev

Post by aleroy »

d000hg wrote:That's a real bummer I can't test my code on my own iPad without paying an annual fee. I assumed XCode would at least let me copy it via a physical connection using the USB cable for local testing! Is testing Ogre on the simulator feasible, or is it really slow?
It actually seems to run faster on the simulator ... but, then, I'm also working on a shinny new, fully loaded Mac Mini.
d000hg wrote:Looking at the 1.8 notes, it's really only ES2.0 that I would want. If I can get away with a pre-built SDK that sounds great - unless anyone is hosting pre-built 1.8RC SDKs ;) Although one fly in the ointment, I use MyGUI in my current codebase and guess I'll have to build that myself for iOS.
MyGUI doesn't work well in iOS. The input is offset and it's implementation of multitouch devices is less than desirable. I made my own simple GUI system out of Ogre Overlays. But, that part of my code is currently under review ... I'm finding I need a little more than what overlays can deliver. In other words, I'll get back to you on that one.

I haven't seen links to a pre-built 1.8 SDK. I'd email mine to you, but mine is build for XCode 4.3.2. Honestly, though, the CMake issue isn't as terrible as it sounds. The number of posts about it just goes to show that more of us have been able to work through it ... experience you can draw upon. I'll break it down for you here:

1. Get & build the latest CMake source. Open a terminal window and do the following

Code: Select all

(~)> cd Documents
(Documents) > mkdir code
(Documents) > cd code
(code) > git clone git://cmake.org/cmake.git
(cmake) > cd cmake
(cmake) > ./bootstrap
(cmake) > make
(cmake) > sudo make install
2. Get the Ogre Source

Code: Select all

(cmake) > cd ..
(code) > mkdir ogre_src_1.80
(code) > cd ogre_src_1.80
(ogre_src_1.80) > hg clone https://bitbucket.org/sinbad/ogre
3. Download the iOS dependencies from here: http://sourceforge.net/projects/ogre/fi ... ncies-mac/. I think, in your case, you'll need to grab the 4.3 dependencies ... I think you'd need XCode 4.3.x to build for iOS 5.1. Once you have them, open the .dmg file and copy the iPhoneDependencies folder into "[username]/Documents/code/ogre_src_1.80/ogre". And, finally, rename the copied folder to "iOSDependencies".

4. Prepare cmake. Copy the shell script from the bottom of this wiki article: http://www.ogre3d.org/tikiwiki/Building ... evelopment. Paste it into a text file (using any text editor). There are three options you can set at the top of that script, set them as such:

Code: Select all

# Absolute path to the source code directory.
SRC=/Users/[username]/Documents/code/ogre_src_1.80/ogre
 
# Absolute path to the build directory.
BUILD=/Users/[username]/Documents/code/ogre_src_1.80/OgreSDK1.80iOS
 
# The build configuration. Recommended values are:
#   Release        - optimized code that excludes debugging information.
#   RelWithDebInfo - optimized code that includes debugging information.
CONFIG=Release
Save the file as "buildSDK.sh" to your "Documents/code/ogre_src_1.80" folder.

5. Build Ogre:

Code: Select all

(ogre_src_1.80) > sh buildSDK.sh
Then, all you have to do is grab the XCode templates.

**Note: Since you have XCode3.6.2, you don't actually need to build cmake yourself ... the current stable release will work just fine (for you).
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Awesome, I really appreciate that! I imagine you're right about it not being too horrible, it's the combination of having to do it on an unfamiliar environment :)

Regarding MyGUI - I suspect I wouldn't end up using this long-term but my current code-base uses it and my immediate aim is to at least get something of mine running on iOS. I've tried to design my code using model-view architecture so I can use a completely separate GUI but no doubt I'll find the reality isn't so simple :)
Could you clarify what you meant by "The input is offset" though? I had a vague idea I might still use MyGUI for simple controls and then overlay some iOS/OBJ-C code on top to handle multitouch but I don't know if this is possible/sensible.
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Getting started for iOS/OSX dev

Post by aleroy »

Honestly, I'm not exactly sure, my info came from a post I had found before I got started on my project. I never actually tried it. I looked over the MyGUI code and saw there was no code to suggest an iOS port (MacOS yes, but not iOS) ... so I decided to roll my own GUI system. Anyways, IIRC, the poster complained that, for example, the "hit area" for a button would be offset from the actual button image. Also, that the cursor had to be moved by dragging your finger over the screen. "Clicks" were only detected while the cursor was over the button (i.e. you can't just tap random points). He complained of a few other issues as well.

This is nothing bad against MyGUI, just the result of a library running in an environment it was never designed to run in ....
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

I wonder if this is an issue with MyGUI itself, or how input is passed into MyGUI? MyGUI is designed with OIS in mind as an obvious way to get the input into MyGUI so maybe it's OIS which is not understanding [multi]touch properly. For instance in the input handler you just put in cookbook I could write my own code to translate this to clicks/drags and inject those events into MyGUI. Of course MyGUI is fundamentally designed around single-touch and a mouse but for many apps this would suffice for GUI at least.
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Getting started for iOS/OSX dev

Post by aleroy »

Yeah, that may be true for the offset issue. ... but there's a bigger issue at large. You would have to refactor the input handling methods in MyGUI_InputManager. At present, it doesn't account for the pointer jumping around the screen as you would expect from a touch device. Focus detection is exclusive to the InputManager::injectMouseMove function. That means you can't gain focus by tapping something. You have to drag your finger a bit to invoke the focus routines.

I discovered that while I was rolling my own GUI ... which borrowed quite a bit from MyGUI. I don't recall exactly what I did offhand. I had to add focus detection to mousePress as well as mouseRelease. Also, with a touch device, there is no distinction between "move" and "drag" ... there's probably a few other issue I'm forgetting as well.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

aleroy wrote: 3. Download the iOS dependencies from here: http://sourceforge.net/projects/ogre/fi ... ncies-mac/. I think, in your case, you'll need to grab the 4.3 dependencies ... I think you'd need XCode 4.3.x to build for iOS 5.1. Once you have them, open the .dmg file and copy the iPhoneDependencies folder into "[username]/Documents/code/ogre_src_1.80/ogre". And, finally, rename the copied folder to "iOSDependencies".
A quick question on this... there is no 1.8 dir on that downloads page. Am I safe to get the dependencies for Mac/iOS from the 1.7 dir and use these for 1.8?
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Getting started for iOS/OSX dev

Post by aleroy »

I think masterfalcon may be able to answer that more precisely.

... I'm using prebuilt dependencies packaged in a file name "Ogre_iOS_5-1.0_Dependencies_20111219.dmg" ... but, I got stuff from so many sources while trying to get everything working that I now have know idea where I got that file. I don't see it in the 1.7 folder of the link provided above. It's possible I just renamed it (from "Ogre_iOS_5.0_Dependencies_20111219.dmg"), in which case, the answer is yes.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

I'll have to test that shortly - I got the 1.7.4 SDK working first as a confidence boost and now I need to try 1.8. Are dependencies XCode-version-specific... should the same pre-built dependencies work on 3.2.6?

This seems like it must be a very obvious question but I didn't spot it on the first couple of pages... when I create an iOS project from the template and run on the iPad simulator, it seems to only take a fraction of the iPad screen, roughly the bottom-left corner. How come?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Getting started for iOS/OSX dev

Post by masterfalcon »

The dependencies are built against a specific iOS SDK version, not Xcode version. I believe the current ones were linked with iOS 5.0.

Delete the app from your simulator(same as how you delete from the device). It's using the same prefs for iPad and iPhone. So it thinks your screen is iPhone sized.
caseybasichis
Greenskin
Posts: 100
Joined: Wed Jan 25, 2012 7:50 pm
x 1

Re: Getting started for iOS/OSX dev

Post by caseybasichis »

I'd be very interested to know if anyone is able to trying handling the input of MyGui to get it working on iOs.

I'm still trying to get my system up and running with ogre, but getting a 2d gui running is a primary concern. All the library forum seems to suggest that it may be possible and that there may be some forum users who are currently using the method. Of to dream, a wiki topic: "State of iOs and Android GUI systems for Ogre".
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

I suggest you Google "site:ogre3d.org mygui iphone" and wade through the forum threads, they look useful.

There seem to be quite a few of us looking at GUI on Ogre-iOS right now and I prefer to use MyGUI too so I'll post my findings... please do the same. If you ask nicely someone might have some pre-built version they can upload, but I'm expecting to have to build from source.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

So... I now have Ogre 1.8 SampleBrowser building for the Simulator. However on running it, I see the Ogre splash-screen for about 0.5s then it bails back to the iPad 'desktop'. I can see the SampleBrowser installed but running it gives the same thing every time. Built against iOS 4.3.

Apart from "why isn't it working" my next question is, how to I find the logs when I run on the simulator, and for that matter which files/dirs make up the SampleBrowser application on my Mac's disk? Is it a Mac-style package I should be looking inside?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Getting started for iOS/OSX dev

Post by masterfalcon »

You should see the log when you run from Xcode
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Aha, in the Console. Does a .log file also get saved somewhere?

Anyway it's rather cryptic to a noob like me:
[Session started at 2012-04-16 21:47:32 +0100.]
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
pthread_cond_init$UNIX2003 called from function _ZN5boost12_GLOBAL__N_125make_external_thread_dataEv in image SampleBrowser.
If you are encountering this problem running a simulator binary within gdb, make sure you 'set start-with-shell off' first.
Perhaps an issue with boost, am I on the right track? I have boost installed using MacPorts and I just noticed my CMake script has:

Boost_INCLUDE_DIR:PATH=/usr/local/ogre/ogre1.8/iOSDependencies/include
Boost_LIBRARY_DIRS:FILEPATH=/opt/local/lib

Mixing things up doesn't sound good :) I have boost universal though MacPorts but is the one bundled with iOSDependencies a special version I need to use instead?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Getting started for iOS/OSX dev

Post by masterfalcon »

I'm not familiar with what is included with MacPorts but it is likely linked against the OS X frameworks instead of iOS frameworks.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Yes, moving to the boost supplied in the iOSDependencies gives me a running SampleBrowser on the simulator. Thanks.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Next up... why does building Ogre for device/simulator seem to put the binaries with the same file-names in the same dirs, i.e. building for device overwrites the simulator libs? This seems weird, I want to check I didn't miss something - wouldn't it be normal for my app to reference separate versions of the Ogre libs for device/simulator builds?

For that matter, how do pre-built dependencies manage to work on both the device and the simulator when it is different architecture? Building for the simulator creates an x86 MacOSX app rather than an ARM app, so how can the same libs work in both cases?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Getting started for iOS/OSX dev

Post by masterfalcon »

That's a strange and annoying oddity of CMake.

The libs are "fat" binaries. They contain multiple architectures. Same way that you could have PPC and x86 versions shipped as the same executable.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Do you mean the pre-built dependencies are fat, or the Ogre libs too? For real-life apps, does it waste a significant amount of memory?

If only the pre-built libs are fat, it sounds like I want to tweak my XCode project to spit simulator/device Ogre builds into separate locations.
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Getting started for iOS/OSX dev

Post by masterfalcon »

Just the prebuilt libs are fat
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

Could anyone advise me how well XCode 4 runs compared to 3? I've a reasonably low-spec Mac by modern standards, a 2GHz Core 2 Duo with 2Gb RAM. I remember a while ago on another site reading about people having massive issues with XCode 4 when it was new and am a bit nervous to upgrade my Mac.

Any personal experiences welcome... I gather Lion is at least as fast as Snow Leopard so it's only XCode I worry about.
d000hg
Goblin
Posts: 257
Joined: Tue Sep 02, 2008 9:41 pm
x 1

Re: Getting started for iOS/OSX dev

Post by d000hg »

masterfalcon wrote:Just the prebuilt libs are fat
Quick followup on that, how does this work with the 1.7 iOS SDK? Is that also built fat?