Saturday, September 7, 2013

How to Test Blender GameKit on Real IOS Device Tutorial

Finally, I figured out how to test the Blender3D GameKit on Real IOS devices, such as iphone 5 and iPad 4 in the video. This is using latest xcode 4.6 and ios 6.1 build. Took a while to work out this.

1. go to gamekit on google code site to get the source. copy the svn script and run it in a terminal. It will download the whole package onto your hard disk.
2. go to apple developer site register yourself and pay $99 to get the iOS developer licence. So you can test applications on your iOS devices.
3. go to mac application shop download Xcode. Currently using 4.6
4. open xcode and go to preference -> download install the command tools.
5. search cmake and install.
6. search xquartz and install.
7. open cmake. point source to gamekit-read-only you downloaded before. point target to a folder under it. normally named build.
8. Click configure once. And wait for the settings to come up. Turn on OGREKIT_BUILD_IPHONE,Turn on OGREKIT_BUILD_GLESRS.Turn off OGREKIT_BUILD_GLRS
9. click configure again. only one red line. and then click again. there will be no red lines.
10. click generate. This will generate a xcode project for you named ogrekit.xproject in the build folder.
11. link your iPhone, iPad to computer and start Xcode. this will bring you to a button to set your device for development. click and finish the process.
12. copy your own blender file for testing into iphoneDemo folder.
13. open ogrekit.xproject in xcode and drag the file under iphoneDemo.
14. open main.mm under iphoneDemo folder. edit the name of the blender file to the one you just copied.

const gkString gkDefaultBlend   = "planeTouchMoveIOS.blend";

 go to screen size to annotate them. It is not needed and will mess screen settings. 

// iPad
    //m_prefs.winsize.x        = 768;
    //m_prefs.winsize.y        = 1024;
    // iPhone
//960x640, 480x320
    //m_prefs.winsize.x        = 960;
    //m_prefs.winsize.y        = 640;

//m_prefs.winsize.x        = 320;
    //m_prefs.winsize.y        = 480;

Also search scale. and go to a line that defines scale, annotate it. replace it with:

//CGFloat screenScale = [[UIScreen mainScreen] scale];
    CGFloat screenScale = 1;

15. change the target to buildAll->your device name. and Command + B to build. for the first time it will take a while. but afterwards will be much faster.
16. After succeed the build. Make sure you have your device connected. Change the target to IphoneDemo->your device and click run. 
17. wait for several minutes. the files will be compiled and uploaded on to your device. The App will start running by itself.
18. for ipad just go to the summary page and change the target device to ipad.


No comments:

Post a Comment