OGRECave / ogre

scene-oriented, flexible 3D engine (C++, Python, C#, Java)
https://ogrecave.github.io/ogre/
MIT License
3.91k stars 966 forks source link

[OGRE-505] Ogre 1.9 for XCode7, iOS SDK 9[simulator] #203

Closed paroj closed 8 years ago

paroj commented 8 years ago

[reporter="ENGine", created="Wed, 14 Oct 2015 12:26:40 +0100"]

Hi, all.
Few day ago I had to upgrade my soft from XCode 6.4 to XCode7.0.1 and now I'm facing the Ogre's bug (for iOS Simulator):

Unable to find source-code formatter for language: c++. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
{
   OgreAssert(!_mRenderWnd, "Existing render window");

   unsigned int width  = [[UIScreen mainScreen] bounds].size.width;
   unsigned int height = [[UIScreen mainScreen] bounds].size.height;

   Ogre::NameValuePairList params;
   UIWindow *keyWindow = [[[UIApplication sharedApplication] delegate] window];
   params["externalWindowHandle"] = Ogre::StringConverter::toString((unsigned long)keyWindow);
   params["externalViewHandle"] = Ogre::StringConverter::toString((unsigned long)uiView);

   params["colourDepth"] = "32";
   params["contentScalingFactor"] = "1.0";
   params["FSAA"] = "0";
   params["Video Mode"] = Ogre::StringConverter::toString(width) + "x" + Ogre::StringConverter::toString(height);

   // Initialize w/o creating a renderwindow.
   root.mRoot->initialise(false, "");

   // Create the window and attach it to the given UI stuffs.
   _mRenderWnd = mRoot->createRenderWindow([title UTF8String], width, height, false, ¶ms);    <<<<<<<<< crash
   _mRenderWnd->setActive(true);
}

I tried to rebuild Ogre 1.9 from Source (https://bitbucket.org/sinbad/ogre/get/5b731ea126bb.zip + http://sourceforge.net/projects/ogre/fi ... g/download) for XCode7.0.1, but there is the same bug (for iOS Simulator).

Thus, my project works for XCode6.4, iOS SDK 8.4, but when I launch this project under new XCode7.0.1, there is crash.
Also if I'm trying to build the app for iOS device, then the app works without bug! I reinstalled the XCode7.0.1 few times to double check that there are no reasons of XCode, but for the simulator the app doesn't still work

Please, help, guys. Thanks

Original post: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=84195

paroj commented 8 years ago

[author="engine", created="Fri, 16 Oct 2015 09:48:50 +0100"]

Fixed: glew2.cpp

static void open_libgl(void)
{
CFStringRef frameworkPath = CFSTR("/System/Library/Frameworks/OpenGLES.framework");
NSString *sysVersion = [UIDevice currentDevice].systemVersion;
NSArray *sysVersionComponents = [sysVersion componentsSeparatedByString:@"."];

#if TARGET_IPHONE_SIMULATOR
// Ask where Xcode is installed
std::string xcodePath = "/Applications/Xcode.app/Contents/Developer\n";

// The result contains an end line character. Remove it.
size_t pos = xcodePath.find("\n");
xcodePath.erase(pos);

char tempPath[PATH_MAX];
sprintf(tempPath,
"%s/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.%s.sdk/System/Library/Frameworks/OpenGLES.framework",
xcodePath.c_str(),
[[sysVersionComponents objectAtIndex:0] cStringUsingEncoding:NSUTF8StringEncoding],
[[sysVersionComponents objectAtIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]);
frameworkPath = CFStringCreateWithCString(kCFAllocatorDefault, tempPath, kCFStringEncodingUTF8);
#else
// device code
#endif

/*BOOL isSimulator = ([[UIDevice currentDevice].model rangeOfString:@"Simulator"].location != NSNotFound);
if(isSimulator)

{

// Ask where Xcode is installed std::string xcodePath = "/Applications/Xcode.app/Contents/Developer\n";

// The result contains an end line character. Remove it. size_t pos = xcodePath.find("\n"); xcodePath.erase(pos);

char tempPath[PATH_MAX]; sprintf(tempPath, "%s/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator%s.%s.sdk/System/Library/Frameworks/OpenGLES.framework", xcodePath.c_str(), [[sysVersionComponents objectAtIndex:0] cStringUsingEncoding:NSUTF8StringEncoding], [[sysVersionComponents objectAtIndex:1] cStringUsingEncoding:NSUTF8StringEncoding]); frameworkPath = CFStringCreateWithCString(kCFAllocatorDefault, tempPath, kCFStringEncodingUTF8); }

*/

bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
frameworkPath,
kCFURLPOSIXPathStyle, true);

CFRelease(frameworkPath);

bundle = CFBundleCreate(kCFAllocatorDefault, bundleURL);

assert(bundle != NULL);
}