Joshua Moerman
13 years ago
commit
f2cdca50d8
13 changed files with 1153 additions and 0 deletions
@ -0,0 +1,312 @@ |
|||||
|
// !$*UTF8*$! |
||||
|
{ |
||||
|
archiveVersion = 1; |
||||
|
classes = { |
||||
|
}; |
||||
|
objectVersion = 46; |
||||
|
objects = { |
||||
|
|
||||
|
/* Begin PBXBuildFile section */ |
||||
|
4280A91C1553DD4C00664DC2 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4280A91B1553DD4C00664DC2 /* UIKit.framework */; }; |
||||
|
4280A91E1553DD4C00664DC2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4280A91D1553DD4C00664DC2 /* Foundation.framework */; }; |
||||
|
4280A9201553DD4C00664DC2 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4280A91F1553DD4C00664DC2 /* CoreGraphics.framework */; }; |
||||
|
4280A9221553DD4C00664DC2 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4280A9211553DD4C00664DC2 /* GLKit.framework */; }; |
||||
|
4280A9241553DD4C00664DC2 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4280A9231553DD4C00664DC2 /* OpenGLES.framework */; }; |
||||
|
4280A92A1553DD4C00664DC2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4280A9281553DD4C00664DC2 /* InfoPlist.strings */; }; |
||||
|
4280A92C1553DD4C00664DC2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4280A92B1553DD4C00664DC2 /* main.m */; }; |
||||
|
4280A9301553DD4C00664DC2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4280A92F1553DD4C00664DC2 /* AppDelegate.m */; }; |
||||
|
4280A9321553DD4C00664DC2 /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 4280A9311553DD4C00664DC2 /* Shader.fsh */; }; |
||||
|
4280A9341553DD4C00664DC2 /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 4280A9331553DD4C00664DC2 /* Shader.vsh */; }; |
||||
|
4280A9371553DD4C00664DC2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4280A9361553DD4C00664DC2 /* ViewController.m */; }; |
||||
|
4280A93A1553DD4C00664DC2 /* ViewController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4280A9381553DD4C00664DC2 /* ViewController_iPhone.xib */; }; |
||||
|
4280A93D1553DD4C00664DC2 /* ViewController_iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4280A93B1553DD4C00664DC2 /* ViewController_iPad.xib */; }; |
||||
|
/* End PBXBuildFile section */ |
||||
|
|
||||
|
/* Begin PBXFileReference section */ |
||||
|
4280A9171553DD4C00664DC2 /* GLGameTemplate.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GLGameTemplate.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||
|
4280A91B1553DD4C00664DC2 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; |
||||
|
4280A91D1553DD4C00664DC2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; |
||||
|
4280A91F1553DD4C00664DC2 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; |
||||
|
4280A9211553DD4C00664DC2 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; |
||||
|
4280A9231553DD4C00664DC2 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; |
||||
|
4280A9271553DD4C00664DC2 /* GLGameTemplate-Info.plist */ = {isa = PBXFileReference; path = "GLGameTemplate-Info.plist"; sourceTree = "<group>"; }; |
||||
|
4280A9291553DD4C00664DC2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; |
||||
|
4280A92B1553DD4C00664DC2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; |
||||
|
4280A92D1553DD4C00664DC2 /* GLGameTemplate-Prefix.pch */ = {isa = PBXFileReference; path = "GLGameTemplate-Prefix.pch"; sourceTree = "<group>"; }; |
||||
|
4280A92E1553DD4C00664DC2 /* AppDelegate.h */ = {isa = PBXFileReference; path = AppDelegate.h; sourceTree = "<group>"; }; |
||||
|
4280A92F1553DD4C00664DC2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; |
||||
|
4280A9311553DD4C00664DC2 /* Shader.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.fsh; path = Shaders/Shader.fsh; sourceTree = "<group>"; }; |
||||
|
4280A9331553DD4C00664DC2 /* Shader.vsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = "<group>"; }; |
||||
|
4280A9351553DD4C00664DC2 /* ViewController.h */ = {isa = PBXFileReference; path = ViewController.h; sourceTree = "<group>"; }; |
||||
|
4280A9361553DD4C00664DC2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; |
||||
|
4280A9391553DD4C00664DC2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPhone.xib; sourceTree = "<group>"; }; |
||||
|
4280A93C1553DD4C00664DC2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ViewController_iPad.xib; sourceTree = "<group>"; }; |
||||
|
/* End PBXFileReference section */ |
||||
|
|
||||
|
/* Begin PBXFrameworksBuildPhase section */ |
||||
|
4280A9141553DD4C00664DC2 /* Frameworks */ = { |
||||
|
isa = PBXFrameworksBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4280A91C1553DD4C00664DC2 /* UIKit.framework in Frameworks */, |
||||
|
4280A91E1553DD4C00664DC2 /* Foundation.framework in Frameworks */, |
||||
|
4280A9201553DD4C00664DC2 /* CoreGraphics.framework in Frameworks */, |
||||
|
4280A9221553DD4C00664DC2 /* GLKit.framework in Frameworks */, |
||||
|
4280A9241553DD4C00664DC2 /* OpenGLES.framework in Frameworks */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXFrameworksBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXGroup section */ |
||||
|
4280A90C1553DD4C00664DC2 = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4280A9251553DD4C00664DC2 /* GLGameTemplate */, |
||||
|
4280A91A1553DD4C00664DC2 /* Frameworks */, |
||||
|
4280A9181553DD4C00664DC2 /* Products */, |
||||
|
); |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A9181553DD4C00664DC2 /* Products */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4280A9171553DD4C00664DC2 /* GLGameTemplate.app */, |
||||
|
); |
||||
|
name = Products; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A91A1553DD4C00664DC2 /* Frameworks */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4280A91B1553DD4C00664DC2 /* UIKit.framework */, |
||||
|
4280A91D1553DD4C00664DC2 /* Foundation.framework */, |
||||
|
4280A91F1553DD4C00664DC2 /* CoreGraphics.framework */, |
||||
|
4280A9211553DD4C00664DC2 /* GLKit.framework */, |
||||
|
4280A9231553DD4C00664DC2 /* OpenGLES.framework */, |
||||
|
); |
||||
|
name = Frameworks; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A9251553DD4C00664DC2 /* GLGameTemplate */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4280A92E1553DD4C00664DC2 /* AppDelegate.h */, |
||||
|
4280A92F1553DD4C00664DC2 /* AppDelegate.m */, |
||||
|
4280A9311553DD4C00664DC2 /* Shader.fsh */, |
||||
|
4280A9331553DD4C00664DC2 /* Shader.vsh */, |
||||
|
4280A9351553DD4C00664DC2 /* ViewController.h */, |
||||
|
4280A9361553DD4C00664DC2 /* ViewController.m */, |
||||
|
4280A9381553DD4C00664DC2 /* ViewController_iPhone.xib */, |
||||
|
4280A93B1553DD4C00664DC2 /* ViewController_iPad.xib */, |
||||
|
4280A9261553DD4C00664DC2 /* Supporting Files */, |
||||
|
); |
||||
|
path = GLGameTemplate; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A9261553DD4C00664DC2 /* Supporting Files */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4280A9271553DD4C00664DC2 /* GLGameTemplate-Info.plist */, |
||||
|
4280A9281553DD4C00664DC2 /* InfoPlist.strings */, |
||||
|
4280A92B1553DD4C00664DC2 /* main.m */, |
||||
|
4280A92D1553DD4C00664DC2 /* GLGameTemplate-Prefix.pch */, |
||||
|
); |
||||
|
name = "Supporting Files"; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
/* End PBXGroup section */ |
||||
|
|
||||
|
/* Begin PBXNativeTarget section */ |
||||
|
4280A9161553DD4C00664DC2 /* GLGameTemplate */ = { |
||||
|
isa = PBXNativeTarget; |
||||
|
buildConfigurationList = 4280A9401553DD4C00664DC2 /* Build configuration list for PBXNativeTarget "GLGameTemplate" */; |
||||
|
buildPhases = ( |
||||
|
4280A9131553DD4C00664DC2 /* Sources */, |
||||
|
4280A9141553DD4C00664DC2 /* Frameworks */, |
||||
|
4280A9151553DD4C00664DC2 /* Resources */, |
||||
|
); |
||||
|
buildRules = ( |
||||
|
); |
||||
|
dependencies = ( |
||||
|
); |
||||
|
name = GLGameTemplate; |
||||
|
productName = GLGameTemplate; |
||||
|
productReference = 4280A9171553DD4C00664DC2 /* GLGameTemplate.app */; |
||||
|
productType = "com.apple.product-type.application"; |
||||
|
}; |
||||
|
/* End PBXNativeTarget section */ |
||||
|
|
||||
|
/* Begin PBXProject section */ |
||||
|
4280A90E1553DD4C00664DC2 /* Project object */ = { |
||||
|
isa = PBXProject; |
||||
|
attributes = { |
||||
|
LastUpgradeCheck = 0430; |
||||
|
ORGANIZATIONNAME = Vadovas; |
||||
|
}; |
||||
|
buildConfigurationList = 4280A9111553DD4C00664DC2 /* Build configuration list for PBXProject "GLGameTemplate" */; |
||||
|
compatibilityVersion = "Xcode 3.2"; |
||||
|
developmentRegion = English; |
||||
|
hasScannedForEncodings = 0; |
||||
|
knownRegions = ( |
||||
|
en, |
||||
|
); |
||||
|
mainGroup = 4280A90C1553DD4C00664DC2; |
||||
|
productRefGroup = 4280A9181553DD4C00664DC2 /* Products */; |
||||
|
projectDirPath = ""; |
||||
|
projectRoot = ""; |
||||
|
targets = ( |
||||
|
4280A9161553DD4C00664DC2 /* GLGameTemplate */, |
||||
|
); |
||||
|
}; |
||||
|
/* End PBXProject section */ |
||||
|
|
||||
|
/* Begin PBXResourcesBuildPhase section */ |
||||
|
4280A9151553DD4C00664DC2 /* Resources */ = { |
||||
|
isa = PBXResourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4280A92A1553DD4C00664DC2 /* InfoPlist.strings in Resources */, |
||||
|
4280A9321553DD4C00664DC2 /* Shader.fsh in Resources */, |
||||
|
4280A9341553DD4C00664DC2 /* Shader.vsh in Resources */, |
||||
|
4280A93A1553DD4C00664DC2 /* ViewController_iPhone.xib in Resources */, |
||||
|
4280A93D1553DD4C00664DC2 /* ViewController_iPad.xib in Resources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXResourcesBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXSourcesBuildPhase section */ |
||||
|
4280A9131553DD4C00664DC2 /* Sources */ = { |
||||
|
isa = PBXSourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4280A92C1553DD4C00664DC2 /* main.m in Sources */, |
||||
|
4280A9301553DD4C00664DC2 /* AppDelegate.m in Sources */, |
||||
|
4280A9371553DD4C00664DC2 /* ViewController.m in Sources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXSourcesBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXVariantGroup section */ |
||||
|
4280A9281553DD4C00664DC2 /* InfoPlist.strings */ = { |
||||
|
isa = PBXVariantGroup; |
||||
|
children = ( |
||||
|
4280A9291553DD4C00664DC2 /* en */, |
||||
|
); |
||||
|
name = InfoPlist.strings; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A9381553DD4C00664DC2 /* ViewController_iPhone.xib */ = { |
||||
|
isa = PBXVariantGroup; |
||||
|
children = ( |
||||
|
4280A9391553DD4C00664DC2 /* en */, |
||||
|
); |
||||
|
name = ViewController_iPhone.xib; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4280A93B1553DD4C00664DC2 /* ViewController_iPad.xib */ = { |
||||
|
isa = PBXVariantGroup; |
||||
|
children = ( |
||||
|
4280A93C1553DD4C00664DC2 /* en */, |
||||
|
); |
||||
|
name = ViewController_iPad.xib; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
/* End PBXVariantGroup section */ |
||||
|
|
||||
|
/* Begin XCBuildConfiguration section */ |
||||
|
4280A93E1553DD4C00664DC2 /* Debug */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; |
||||
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
||||
|
COPY_PHASE_STRIP = NO; |
||||
|
GCC_C_LANGUAGE_STANDARD = gnu99; |
||||
|
GCC_DYNAMIC_NO_PIC = NO; |
||||
|
GCC_OPTIMIZATION_LEVEL = 0; |
||||
|
GCC_PREPROCESSOR_DEFINITIONS = ( |
||||
|
"DEBUG=1", |
||||
|
"$(inherited)", |
||||
|
); |
||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO; |
||||
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0; |
||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES; |
||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES; |
||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1; |
||||
|
SDKROOT = iphoneos; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4280A93F1553DD4C00664DC2 /* Release */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||
|
ARCHS = "$(ARCHS_STANDARD_32_BIT)"; |
||||
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; |
||||
|
COPY_PHASE_STRIP = YES; |
||||
|
GCC_C_LANGUAGE_STANDARD = gnu99; |
||||
|
GCC_VERSION = com.apple.compilers.llvm.clang.1_0; |
||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES; |
||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES; |
||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 5.1; |
||||
|
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; |
||||
|
SDKROOT = iphoneos; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
VALIDATE_PRODUCT = YES; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
4280A9411553DD4C00664DC2 /* Debug */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES; |
||||
|
GCC_PREFIX_HEADER = "GLGameTemplate/GLGameTemplate-Prefix.pch"; |
||||
|
"GCC_THUMB_SUPPORT[arch=armv6]" = ""; |
||||
|
INFOPLIST_FILE = "GLGameTemplate/GLGameTemplate-Info.plist"; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
WRAPPER_EXTENSION = app; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4280A9421553DD4C00664DC2 /* Release */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES; |
||||
|
GCC_PREFIX_HEADER = "GLGameTemplate/GLGameTemplate-Prefix.pch"; |
||||
|
"GCC_THUMB_SUPPORT[arch=armv6]" = ""; |
||||
|
INFOPLIST_FILE = "GLGameTemplate/GLGameTemplate-Info.plist"; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
WRAPPER_EXTENSION = app; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
/* End XCBuildConfiguration section */ |
||||
|
|
||||
|
/* Begin XCConfigurationList section */ |
||||
|
4280A9111553DD4C00664DC2 /* Build configuration list for PBXProject "GLGameTemplate" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4280A93E1553DD4C00664DC2 /* Debug */, |
||||
|
4280A93F1553DD4C00664DC2 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
defaultConfigurationName = Release; |
||||
|
}; |
||||
|
4280A9401553DD4C00664DC2 /* Build configuration list for PBXNativeTarget "GLGameTemplate" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4280A9411553DD4C00664DC2 /* Debug */, |
||||
|
4280A9421553DD4C00664DC2 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
}; |
||||
|
/* End XCConfigurationList section */ |
||||
|
}; |
||||
|
rootObject = 4280A90E1553DD4C00664DC2 /* Project object */; |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
//
|
||||
|
// AppDelegate.h
|
||||
|
// GLGameTemplate
|
||||
|
//
|
||||
|
// Created by Joshua Moerman on 5/4/12.
|
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved.
|
||||
|
//
|
||||
|
|
||||
|
#import <UIKit/UIKit.h> |
||||
|
|
||||
|
@class ViewController; |
||||
|
|
||||
|
@interface AppDelegate : UIResponder <UIApplicationDelegate> |
||||
|
|
||||
|
@property (strong, nonatomic) UIWindow *window; |
||||
|
|
||||
|
@property (strong, nonatomic) ViewController *viewController; |
||||
|
|
||||
|
@end |
@ -0,0 +1,66 @@ |
|||||
|
// |
||||
|
// AppDelegate.m |
||||
|
// GLGameTemplate |
||||
|
// |
||||
|
// Created by Joshua Moerman on 5/4/12. |
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
#import "AppDelegate.h" |
||||
|
|
||||
|
#import "ViewController.h" |
||||
|
|
||||
|
@implementation AppDelegate |
||||
|
|
||||
|
@synthesize window = _window; |
||||
|
@synthesize viewController = _viewController; |
||||
|
|
||||
|
- (void)dealloc |
||||
|
{ |
||||
|
[_window release]; |
||||
|
[_viewController release]; |
||||
|
[super dealloc]; |
||||
|
} |
||||
|
|
||||
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
||||
|
{ |
||||
|
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]; |
||||
|
// Override point for customization after application launch. |
||||
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { |
||||
|
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil] autorelease]; |
||||
|
} else { |
||||
|
self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil] autorelease]; |
||||
|
} |
||||
|
self.window.rootViewController = self.viewController; |
||||
|
[self.window makeKeyAndVisible]; |
||||
|
return YES; |
||||
|
} |
||||
|
|
||||
|
- (void)applicationWillResignActive:(UIApplication *)application |
||||
|
{ |
||||
|
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. |
||||
|
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. |
||||
|
} |
||||
|
|
||||
|
- (void)applicationDidEnterBackground:(UIApplication *)application |
||||
|
{ |
||||
|
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. |
||||
|
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. |
||||
|
} |
||||
|
|
||||
|
- (void)applicationWillEnterForeground:(UIApplication *)application |
||||
|
{ |
||||
|
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. |
||||
|
} |
||||
|
|
||||
|
- (void)applicationDidBecomeActive:(UIApplication *)application |
||||
|
{ |
||||
|
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. |
||||
|
} |
||||
|
|
||||
|
- (void)applicationWillTerminate:(UIApplication *)application |
||||
|
{ |
||||
|
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. |
||||
|
} |
||||
|
|
||||
|
@end |
@ -0,0 +1,47 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||
|
<plist version="1.0"> |
||||
|
<dict> |
||||
|
<key>CFBundleDevelopmentRegion</key> |
||||
|
<string>en</string> |
||||
|
<key>CFBundleDisplayName</key> |
||||
|
<string>${PRODUCT_NAME}</string> |
||||
|
<key>CFBundleExecutable</key> |
||||
|
<string>${EXECUTABLE_NAME}</string> |
||||
|
<key>CFBundleIdentifier</key> |
||||
|
<string>Vadovas.${PRODUCT_NAME:rfc1034identifier}</string> |
||||
|
<key>CFBundleInfoDictionaryVersion</key> |
||||
|
<string>6.0</string> |
||||
|
<key>CFBundleName</key> |
||||
|
<string>${PRODUCT_NAME}</string> |
||||
|
<key>CFBundlePackageType</key> |
||||
|
<string>APPL</string> |
||||
|
<key>CFBundleShortVersionString</key> |
||||
|
<string>1.0</string> |
||||
|
<key>CFBundleSignature</key> |
||||
|
<string>????</string> |
||||
|
<key>CFBundleVersion</key> |
||||
|
<string>1.0</string> |
||||
|
<key>LSRequiresIPhoneOS</key> |
||||
|
<true/> |
||||
|
<key>UIRequiredDeviceCapabilities</key> |
||||
|
<array> |
||||
|
<string>armv7</string> |
||||
|
</array> |
||||
|
<key>UIStatusBarHidden</key> |
||||
|
<true/> |
||||
|
<key>UISupportedInterfaceOrientations</key> |
||||
|
<array> |
||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||
|
</array> |
||||
|
<key>UISupportedInterfaceOrientations~ipad</key> |
||||
|
<array> |
||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||
|
</array> |
||||
|
</dict> |
||||
|
</plist> |
@ -0,0 +1,14 @@ |
|||||
|
// |
||||
|
// Prefix header for all source files of the 'GLGameTemplate' target in the 'GLGameTemplate' project |
||||
|
// |
||||
|
|
||||
|
#import <Availability.h> |
||||
|
|
||||
|
#ifndef __IPHONE_5_0 |
||||
|
#warning "This project uses features only available in iOS SDK 5.0 and later." |
||||
|
#endif |
||||
|
|
||||
|
#ifdef __OBJC__ |
||||
|
#import <UIKit/UIKit.h> |
||||
|
#import <Foundation/Foundation.h> |
||||
|
#endif |
@ -0,0 +1,14 @@ |
|||||
|
// |
||||
|
// Shader.fsh |
||||
|
// GLGameTemplate |
||||
|
// |
||||
|
// Created by Joshua Moerman on 5/4/12. |
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
varying lowp vec4 colorVarying; |
||||
|
|
||||
|
void main() |
||||
|
{ |
||||
|
gl_FragColor = colorVarying; |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
// |
||||
|
// Shader.vsh |
||||
|
// GLGameTemplate |
||||
|
// |
||||
|
// Created by Joshua Moerman on 5/4/12. |
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
attribute vec4 position; |
||||
|
attribute vec3 normal; |
||||
|
|
||||
|
varying lowp vec4 colorVarying; |
||||
|
|
||||
|
uniform mat4 modelViewProjectionMatrix; |
||||
|
uniform mat3 normalMatrix; |
||||
|
|
||||
|
void main() |
||||
|
{ |
||||
|
vec3 eyeNormal = normalize(normalMatrix * normal); |
||||
|
vec3 lightPosition = vec3(0.0, 0.0, 1.0); |
||||
|
vec4 diffuseColor = vec4(0.4, 0.4, 1.0, 1.0); |
||||
|
|
||||
|
float nDotVP = max(0.0, dot(eyeNormal, normalize(lightPosition))); |
||||
|
|
||||
|
colorVarying = diffuseColor * nDotVP; |
||||
|
|
||||
|
gl_Position = modelViewProjectionMatrix * position; |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
//
|
||||
|
// ViewController.h
|
||||
|
// GLGameTemplate
|
||||
|
//
|
||||
|
// Created by Joshua Moerman on 5/4/12.
|
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved.
|
||||
|
//
|
||||
|
|
||||
|
#import <UIKit/UIKit.h> |
||||
|
#import <GLKit/GLKit.h> |
||||
|
|
||||
|
@interface ViewController : GLKViewController |
||||
|
|
||||
|
@end |
@ -0,0 +1,401 @@ |
|||||
|
// |
||||
|
// ViewController.m |
||||
|
// GLGameTemplate |
||||
|
// |
||||
|
// Created by Joshua Moerman on 5/4/12. |
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
#import "ViewController.h" |
||||
|
|
||||
|
#define BUFFER_OFFSET(i) ((char *)NULL + (i)) |
||||
|
|
||||
|
// Uniform index. |
||||
|
enum |
||||
|
{ |
||||
|
UNIFORM_MODELVIEWPROJECTION_MATRIX, |
||||
|
UNIFORM_NORMAL_MATRIX, |
||||
|
NUM_UNIFORMS |
||||
|
}; |
||||
|
GLint uniforms[NUM_UNIFORMS]; |
||||
|
|
||||
|
// Attribute index. |
||||
|
enum |
||||
|
{ |
||||
|
ATTRIB_VERTEX, |
||||
|
ATTRIB_NORMAL, |
||||
|
NUM_ATTRIBUTES |
||||
|
}; |
||||
|
|
||||
|
GLfloat gCubeVertexData[216] = |
||||
|
{ |
||||
|
// Data layout for each line below is: |
||||
|
// positionX, positionY, positionZ, normalX, normalY, normalZ, |
||||
|
0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
0.5f, -0.5f, 0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
0.5f, 0.5f, -0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 0.0f, |
||||
|
|
||||
|
0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, |
||||
|
|
||||
|
-0.5f, 0.5f, -0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
-0.5f, 0.5f, 0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
-0.5f, -0.5f, -0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
-0.5f, -0.5f, 0.5f, -1.0f, 0.0f, 0.0f, |
||||
|
|
||||
|
-0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
-0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
-0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
0.5f, -0.5f, -0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
0.5f, -0.5f, 0.5f, 0.0f, -1.0f, 0.0f, |
||||
|
|
||||
|
0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, 1.0f, |
||||
|
|
||||
|
0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, |
||||
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, |
||||
|
0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, |
||||
|
0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f, |
||||
|
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f, -1.0f, |
||||
|
-0.5f, 0.5f, -0.5f, 0.0f, 0.0f, -1.0f |
||||
|
}; |
||||
|
|
||||
|
@interface ViewController () { |
||||
|
GLuint _program; |
||||
|
|
||||
|
GLKMatrix4 _modelViewProjectionMatrix; |
||||
|
GLKMatrix3 _normalMatrix; |
||||
|
float _rotation; |
||||
|
|
||||
|
GLuint _vertexArray; |
||||
|
GLuint _vertexBuffer; |
||||
|
} |
||||
|
@property (strong, nonatomic) EAGLContext *context; |
||||
|
@property (strong, nonatomic) GLKBaseEffect *effect; |
||||
|
|
||||
|
- (void)setupGL; |
||||
|
- (void)tearDownGL; |
||||
|
|
||||
|
- (BOOL)loadShaders; |
||||
|
- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file; |
||||
|
- (BOOL)linkProgram:(GLuint)prog; |
||||
|
- (BOOL)validateProgram:(GLuint)prog; |
||||
|
@end |
||||
|
|
||||
|
@implementation ViewController |
||||
|
|
||||
|
@synthesize context = _context; |
||||
|
@synthesize effect = _effect; |
||||
|
|
||||
|
- (void)dealloc |
||||
|
{ |
||||
|
[_context release]; |
||||
|
[_effect release]; |
||||
|
[super dealloc]; |
||||
|
} |
||||
|
|
||||
|
- (void)viewDidLoad |
||||
|
{ |
||||
|
[super viewDidLoad]; |
||||
|
|
||||
|
self.context = [[[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2] autorelease]; |
||||
|
|
||||
|
if (!self.context) { |
||||
|
NSLog(@"Failed to create ES context"); |
||||
|
} |
||||
|
|
||||
|
GLKView *view = (GLKView *)self.view; |
||||
|
view.context = self.context; |
||||
|
view.drawableDepthFormat = GLKViewDrawableDepthFormat24; |
||||
|
|
||||
|
[self setupGL]; |
||||
|
} |
||||
|
|
||||
|
- (void)viewDidUnload |
||||
|
{ |
||||
|
[super viewDidUnload]; |
||||
|
|
||||
|
[self tearDownGL]; |
||||
|
|
||||
|
if ([EAGLContext currentContext] == self.context) { |
||||
|
[EAGLContext setCurrentContext:nil]; |
||||
|
} |
||||
|
self.context = nil; |
||||
|
} |
||||
|
|
||||
|
- (void)didReceiveMemoryWarning |
||||
|
{ |
||||
|
[super didReceiveMemoryWarning]; |
||||
|
// Release any cached data, images, etc. that aren't in use. |
||||
|
} |
||||
|
|
||||
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation |
||||
|
{ |
||||
|
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { |
||||
|
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); |
||||
|
} else { |
||||
|
return YES; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
- (void)setupGL |
||||
|
{ |
||||
|
[EAGLContext setCurrentContext:self.context]; |
||||
|
|
||||
|
[self loadShaders]; |
||||
|
|
||||
|
self.effect = [[[GLKBaseEffect alloc] init] autorelease]; |
||||
|
self.effect.light0.enabled = GL_TRUE; |
||||
|
self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f); |
||||
|
|
||||
|
glEnable(GL_DEPTH_TEST); |
||||
|
|
||||
|
glGenVertexArraysOES(1, &_vertexArray); |
||||
|
glBindVertexArrayOES(_vertexArray); |
||||
|
|
||||
|
glGenBuffers(1, &_vertexBuffer); |
||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer); |
||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(gCubeVertexData), gCubeVertexData, GL_STATIC_DRAW); |
||||
|
|
||||
|
glEnableVertexAttribArray(GLKVertexAttribPosition); |
||||
|
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(0)); |
||||
|
glEnableVertexAttribArray(GLKVertexAttribNormal); |
||||
|
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12)); |
||||
|
|
||||
|
glBindVertexArrayOES(0); |
||||
|
} |
||||
|
|
||||
|
- (void)tearDownGL |
||||
|
{ |
||||
|
[EAGLContext setCurrentContext:self.context]; |
||||
|
|
||||
|
glDeleteBuffers(1, &_vertexBuffer); |
||||
|
glDeleteVertexArraysOES(1, &_vertexArray); |
||||
|
|
||||
|
self.effect = nil; |
||||
|
|
||||
|
if (_program) { |
||||
|
glDeleteProgram(_program); |
||||
|
_program = 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
#pragma mark - GLKView and GLKViewController delegate methods |
||||
|
|
||||
|
- (void)update |
||||
|
{ |
||||
|
float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height); |
||||
|
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f); |
||||
|
|
||||
|
self.effect.transform.projectionMatrix = projectionMatrix; |
||||
|
|
||||
|
GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f); |
||||
|
baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f); |
||||
|
|
||||
|
// Compute the model view matrix for the object rendered with GLKit |
||||
|
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f); |
||||
|
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); |
||||
|
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); |
||||
|
|
||||
|
self.effect.transform.modelviewMatrix = modelViewMatrix; |
||||
|
|
||||
|
// Compute the model view matrix for the object rendered with ES2 |
||||
|
modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f); |
||||
|
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f); |
||||
|
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix); |
||||
|
|
||||
|
_normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL); |
||||
|
|
||||
|
_modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix); |
||||
|
|
||||
|
_rotation += self.timeSinceLastUpdate * 0.5f; |
||||
|
} |
||||
|
|
||||
|
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect |
||||
|
{ |
||||
|
glClearColor(0.65f, 0.65f, 0.65f, 1.0f); |
||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
||||
|
|
||||
|
glBindVertexArrayOES(_vertexArray); |
||||
|
|
||||
|
// Render the object with GLKit |
||||
|
[self.effect prepareToDraw]; |
||||
|
|
||||
|
glDrawArrays(GL_TRIANGLES, 0, 36); |
||||
|
|
||||
|
// Render the object again with ES2 |
||||
|
glUseProgram(_program); |
||||
|
|
||||
|
glUniformMatrix4fv(uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX], 1, 0, _modelViewProjectionMatrix.m); |
||||
|
glUniformMatrix3fv(uniforms[UNIFORM_NORMAL_MATRIX], 1, 0, _normalMatrix.m); |
||||
|
|
||||
|
glDrawArrays(GL_TRIANGLES, 0, 36); |
||||
|
} |
||||
|
|
||||
|
#pragma mark - OpenGL ES 2 shader compilation |
||||
|
|
||||
|
- (BOOL)loadShaders |
||||
|
{ |
||||
|
GLuint vertShader, fragShader; |
||||
|
NSString *vertShaderPathname, *fragShaderPathname; |
||||
|
|
||||
|
// Create shader program. |
||||
|
_program = glCreateProgram(); |
||||
|
|
||||
|
// Create and compile vertex shader. |
||||
|
vertShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"vsh"]; |
||||
|
if (![self compileShader:&vertShader type:GL_VERTEX_SHADER file:vertShaderPathname]) { |
||||
|
NSLog(@"Failed to compile vertex shader"); |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
// Create and compile fragment shader. |
||||
|
fragShaderPathname = [[NSBundle mainBundle] pathForResource:@"Shader" ofType:@"fsh"]; |
||||
|
if (![self compileShader:&fragShader type:GL_FRAGMENT_SHADER file:fragShaderPathname]) { |
||||
|
NSLog(@"Failed to compile fragment shader"); |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
// Attach vertex shader to program. |
||||
|
glAttachShader(_program, vertShader); |
||||
|
|
||||
|
// Attach fragment shader to program. |
||||
|
glAttachShader(_program, fragShader); |
||||
|
|
||||
|
// Bind attribute locations. |
||||
|
// This needs to be done prior to linking. |
||||
|
glBindAttribLocation(_program, ATTRIB_VERTEX, "position"); |
||||
|
glBindAttribLocation(_program, ATTRIB_NORMAL, "normal"); |
||||
|
|
||||
|
// Link program. |
||||
|
if (![self linkProgram:_program]) { |
||||
|
NSLog(@"Failed to link program: %d", _program); |
||||
|
|
||||
|
if (vertShader) { |
||||
|
glDeleteShader(vertShader); |
||||
|
vertShader = 0; |
||||
|
} |
||||
|
if (fragShader) { |
||||
|
glDeleteShader(fragShader); |
||||
|
fragShader = 0; |
||||
|
} |
||||
|
if (_program) { |
||||
|
glDeleteProgram(_program); |
||||
|
_program = 0; |
||||
|
} |
||||
|
|
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
// Get uniform locations. |
||||
|
uniforms[UNIFORM_MODELVIEWPROJECTION_MATRIX] = glGetUniformLocation(_program, "modelViewProjectionMatrix"); |
||||
|
uniforms[UNIFORM_NORMAL_MATRIX] = glGetUniformLocation(_program, "normalMatrix"); |
||||
|
|
||||
|
// Release vertex and fragment shaders. |
||||
|
if (vertShader) { |
||||
|
glDetachShader(_program, vertShader); |
||||
|
glDeleteShader(vertShader); |
||||
|
} |
||||
|
if (fragShader) { |
||||
|
glDetachShader(_program, fragShader); |
||||
|
glDeleteShader(fragShader); |
||||
|
} |
||||
|
|
||||
|
return YES; |
||||
|
} |
||||
|
|
||||
|
- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file |
||||
|
{ |
||||
|
GLint status; |
||||
|
const GLchar *source; |
||||
|
|
||||
|
source = (GLchar *)[[NSString stringWithContentsOfFile:file encoding:NSUTF8StringEncoding error:nil] UTF8String]; |
||||
|
if (!source) { |
||||
|
NSLog(@"Failed to load vertex shader"); |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
*shader = glCreateShader(type); |
||||
|
glShaderSource(*shader, 1, &source, NULL); |
||||
|
glCompileShader(*shader); |
||||
|
|
||||
|
#if defined(DEBUG) |
||||
|
GLint logLength; |
||||
|
glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &logLength); |
||||
|
if (logLength > 0) { |
||||
|
GLchar *log = (GLchar *)malloc(logLength); |
||||
|
glGetShaderInfoLog(*shader, logLength, &logLength, log); |
||||
|
NSLog(@"Shader compile log:\n%s", log); |
||||
|
free(log); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
glGetShaderiv(*shader, GL_COMPILE_STATUS, &status); |
||||
|
if (status == 0) { |
||||
|
glDeleteShader(*shader); |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
return YES; |
||||
|
} |
||||
|
|
||||
|
- (BOOL)linkProgram:(GLuint)prog |
||||
|
{ |
||||
|
GLint status; |
||||
|
glLinkProgram(prog); |
||||
|
|
||||
|
#if defined(DEBUG) |
||||
|
GLint logLength; |
||||
|
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); |
||||
|
if (logLength > 0) { |
||||
|
GLchar *log = (GLchar *)malloc(logLength); |
||||
|
glGetProgramInfoLog(prog, logLength, &logLength, log); |
||||
|
NSLog(@"Program link log:\n%s", log); |
||||
|
free(log); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
glGetProgramiv(prog, GL_LINK_STATUS, &status); |
||||
|
if (status == 0) { |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
return YES; |
||||
|
} |
||||
|
|
||||
|
- (BOOL)validateProgram:(GLuint)prog |
||||
|
{ |
||||
|
GLint logLength, status; |
||||
|
|
||||
|
glValidateProgram(prog); |
||||
|
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); |
||||
|
if (logLength > 0) { |
||||
|
GLchar *log = (GLchar *)malloc(logLength); |
||||
|
glGetProgramInfoLog(prog, logLength, &logLength, log); |
||||
|
NSLog(@"Program validate log:\n%s", log); |
||||
|
free(log); |
||||
|
} |
||||
|
|
||||
|
glGetProgramiv(prog, GL_VALIDATE_STATUS, &status); |
||||
|
if (status == 0) { |
||||
|
return NO; |
||||
|
} |
||||
|
|
||||
|
return YES; |
||||
|
} |
||||
|
|
||||
|
@end |
@ -0,0 +1,2 @@ |
|||||
|
/* Localized versions of Info.plist keys */ |
||||
|
|
@ -0,0 +1,110 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="8.00"> |
||||
|
<data> |
||||
|
<int key="IBDocument.SystemTarget">1280</int> |
||||
|
<string key="IBDocument.SystemVersion">11C25</string> |
||||
|
<string key="IBDocument.InterfaceBuilderVersion">1919</string> |
||||
|
<string key="IBDocument.AppKitVersion">1138.11</string> |
||||
|
<string key="IBDocument.HIToolboxVersion">566.00</string> |
||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> |
||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="NS.object.0">916</string> |
||||
|
</object> |
||||
|
<array key="IBDocument.IntegratedClassDependencies"> |
||||
|
<string>IBProxyObject</string> |
||||
|
<string>IBUIView</string> |
||||
|
</array> |
||||
|
<array key="IBDocument.PluginDependencies"> |
||||
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
</array> |
||||
|
<object class="NSMutableDictionary" key="IBDocument.Metadata"> |
||||
|
<string key="NS.key.0">PluginDependencyRecalculationVersion</string> |
||||
|
<integer value="1" key="NS.object.0"/> |
||||
|
</object> |
||||
|
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> |
||||
|
<object class="IBProxyObject" id="372490531"> |
||||
|
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string> |
||||
|
<string key="targetRuntimeIdentifier">IBIPadFramework</string> |
||||
|
</object> |
||||
|
<object class="IBProxyObject" id="975951072"> |
||||
|
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string> |
||||
|
<string key="targetRuntimeIdentifier">IBIPadFramework</string> |
||||
|
</object> |
||||
|
<object class="IBUIView" id="191373211"> |
||||
|
<reference key="NSNextResponder"/> |
||||
|
<int key="NSvFlags">274</int> |
||||
|
<string key="NSFrame">{{0, 20}, {768, 1004}}</string> |
||||
|
<reference key="NSSuperview"/> |
||||
|
<reference key="NSWindow"/> |
||||
|
<object class="NSColor" key="IBUIBackgroundColor"> |
||||
|
<int key="NSColorSpace">3</int> |
||||
|
<bytes key="NSWhite">MQA</bytes> |
||||
|
<object class="NSColorSpace" key="NSCustomColorSpace"> |
||||
|
<int key="NSID">2</int> |
||||
|
</object> |
||||
|
</object> |
||||
|
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"> |
||||
|
<int key="IBUIStatusBarStyle">2</int> |
||||
|
</object> |
||||
|
<string key="targetRuntimeIdentifier">IBIPadFramework</string> |
||||
|
</object> |
||||
|
</array> |
||||
|
<object class="IBObjectContainer" key="IBDocument.Objects"> |
||||
|
<array class="NSMutableArray" key="connectionRecords"> |
||||
|
<object class="IBConnectionRecord"> |
||||
|
<object class="IBCocoaTouchOutletConnection" key="connection"> |
||||
|
<string key="label">view</string> |
||||
|
<reference key="source" ref="372490531"/> |
||||
|
<reference key="destination" ref="191373211"/> |
||||
|
</object> |
||||
|
<int key="connectionID">3</int> |
||||
|
</object> |
||||
|
</array> |
||||
|
<object class="IBMutableOrderedSet" key="objectRecords"> |
||||
|
<array key="orderedObjects"> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">0</int> |
||||
|
<array key="object" id="0"/> |
||||
|
<reference key="children" ref="1000"/> |
||||
|
<nil key="parent"/> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">1</int> |
||||
|
<reference key="object" ref="191373211"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">-1</int> |
||||
|
<reference key="object" ref="372490531"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
<string key="objectName">File's Owner</string> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">-2</int> |
||||
|
<reference key="object" ref="975951072"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
</object> |
||||
|
</array> |
||||
|
</object> |
||||
|
<dictionary class="NSMutableDictionary" key="flattenedProperties"> |
||||
|
<string key="-1.CustomClassName">ViewController</string> |
||||
|
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="-2.CustomClassName">UIResponder</string> |
||||
|
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="1.CustomClassName">GLKView</string> |
||||
|
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
</dictionary> |
||||
|
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> |
||||
|
<nil key="activeLocalization"/> |
||||
|
<dictionary class="NSMutableDictionary" key="localizations"/> |
||||
|
<nil key="sourceID"/> |
||||
|
<int key="maxID">3</int> |
||||
|
</object> |
||||
|
<object class="IBClassDescriber" key="IBDocument.Classes"/> |
||||
|
<int key="IBDocument.localizationMode">0</int> |
||||
|
<string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> |
||||
|
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> |
||||
|
<int key="IBDocument.defaultPropertyAccessControl">3</int> |
||||
|
<string key="IBCocoaTouchPluginVersion">916</string> |
||||
|
</data> |
||||
|
</archive> |
@ -0,0 +1,108 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00"> |
||||
|
<data> |
||||
|
<int key="IBDocument.SystemTarget">1280</int> |
||||
|
<string key="IBDocument.SystemVersion">11C25</string> |
||||
|
<string key="IBDocument.InterfaceBuilderVersion">1919</string> |
||||
|
<string key="IBDocument.AppKitVersion">1138.11</string> |
||||
|
<string key="IBDocument.HIToolboxVersion">566.00</string> |
||||
|
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> |
||||
|
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="NS.object.0">916</string> |
||||
|
</object> |
||||
|
<array key="IBDocument.IntegratedClassDependencies"> |
||||
|
<string>IBProxyObject</string> |
||||
|
<string>IBUIView</string> |
||||
|
</array> |
||||
|
<array key="IBDocument.PluginDependencies"> |
||||
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
</array> |
||||
|
<object class="NSMutableDictionary" key="IBDocument.Metadata"> |
||||
|
<string key="NS.key.0">PluginDependencyRecalculationVersion</string> |
||||
|
<integer value="1" key="NS.object.0"/> |
||||
|
</object> |
||||
|
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> |
||||
|
<object class="IBProxyObject" id="841351856"> |
||||
|
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string> |
||||
|
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> |
||||
|
</object> |
||||
|
<object class="IBProxyObject" id="371349661"> |
||||
|
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string> |
||||
|
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> |
||||
|
</object> |
||||
|
<object class="IBUIView" id="184854543"> |
||||
|
<reference key="NSNextResponder"/> |
||||
|
<int key="NSvFlags">274</int> |
||||
|
<string key="NSFrameSize">{320, 460}</string> |
||||
|
<reference key="NSSuperview"/> |
||||
|
<reference key="NSWindow"/> |
||||
|
<object class="NSColor" key="IBUIBackgroundColor"> |
||||
|
<int key="NSColorSpace">3</int> |
||||
|
<bytes key="NSWhite">MQA</bytes> |
||||
|
<object class="NSColorSpace" key="NSCustomColorSpace"> |
||||
|
<int key="NSID">2</int> |
||||
|
</object> |
||||
|
</object> |
||||
|
<bool key="IBUIClearsContextBeforeDrawing">NO</bool> |
||||
|
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> |
||||
|
</object> |
||||
|
</array> |
||||
|
<object class="IBObjectContainer" key="IBDocument.Objects"> |
||||
|
<array class="NSMutableArray" key="connectionRecords"> |
||||
|
<object class="IBConnectionRecord"> |
||||
|
<object class="IBCocoaTouchOutletConnection" key="connection"> |
||||
|
<string key="label">view</string> |
||||
|
<reference key="source" ref="841351856"/> |
||||
|
<reference key="destination" ref="184854543"/> |
||||
|
</object> |
||||
|
<int key="connectionID">3</int> |
||||
|
</object> |
||||
|
</array> |
||||
|
<object class="IBMutableOrderedSet" key="objectRecords"> |
||||
|
<array key="orderedObjects"> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">0</int> |
||||
|
<array key="object" id="0"/> |
||||
|
<reference key="children" ref="1000"/> |
||||
|
<nil key="parent"/> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">-1</int> |
||||
|
<reference key="object" ref="841351856"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
<string key="objectName">File's Owner</string> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">-2</int> |
||||
|
<reference key="object" ref="371349661"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
</object> |
||||
|
<object class="IBObjectRecord"> |
||||
|
<int key="objectID">2</int> |
||||
|
<reference key="object" ref="184854543"/> |
||||
|
<reference key="parent" ref="0"/> |
||||
|
</object> |
||||
|
</array> |
||||
|
</object> |
||||
|
<dictionary class="NSMutableDictionary" key="flattenedProperties"> |
||||
|
<string key="-1.CustomClassName">ViewController</string> |
||||
|
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="-2.CustomClassName">UIResponder</string> |
||||
|
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
<string key="2.CustomClassName">GLKView</string> |
||||
|
<string key="2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> |
||||
|
</dictionary> |
||||
|
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> |
||||
|
<nil key="activeLocalization"/> |
||||
|
<dictionary class="NSMutableDictionary" key="localizations"/> |
||||
|
<nil key="sourceID"/> |
||||
|
<int key="maxID">4</int> |
||||
|
</object> |
||||
|
<object class="IBClassDescriber" key="IBDocument.Classes"/> |
||||
|
<int key="IBDocument.localizationMode">0</int> |
||||
|
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string> |
||||
|
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> |
||||
|
<int key="IBDocument.defaultPropertyAccessControl">3</int> |
||||
|
<string key="IBCocoaTouchPluginVersion">916</string> |
||||
|
</data> |
||||
|
</archive> |
@ -0,0 +1,18 @@ |
|||||
|
// |
||||
|
// main.m |
||||
|
// GLGameTemplate |
||||
|
// |
||||
|
// Created by Joshua Moerman on 5/4/12. |
||||
|
// Copyright (c) 2012 Vadovas. All rights reserved. |
||||
|
// |
||||
|
|
||||
|
#import <UIKit/UIKit.h> |
||||
|
|
||||
|
#import "AppDelegate.h" |
||||
|
|
||||
|
int main(int argc, char *argv[]) |
||||
|
{ |
||||
|
@autoreleasepool { |
||||
|
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); |
||||
|
} |
||||
|
} |
Reference in new issue