From 6e014a7b1f0f4c753f9e6bfc5800ab583860d5f3 Mon Sep 17 00:00:00 2001 From: Dan Ginsburg Date: Mon, 23 Sep 2013 20:31:24 -0400 Subject: [PATCH] Get Hello_Triangle building on iOS 7. Create wrapper ViewController and AppDelegate. Fix all build errors with the ES framework. --- .gitignore | 28 + Chapter_2/Hello_Triangle/Hello_Triangle.c | 4 +- .../Hello_Triangle.xcodeproj/project.pbxproj | 521 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/Hello_Triangle.xccheckout | 41 ++ .../Base.lproj/Main_iPad.storyboard | 26 + .../Base.lproj/Main_iPhone.storyboard | 26 + .../Hello_Triangle/Hello_Triangle-Info.plist | 51 ++ .../Hello_Triangle/Hello_Triangle-Prefix.pch | 16 + .../AppIcon.appiconset/Contents.json | 53 ++ .../LaunchImage.launchimage/Contents.json | 51 ++ .../Hello_Triangle/en.lproj/InfoPlist.strings | 2 + .../Hello_TriangleTests-Info.plist | 22 + .../Hello_TriangleTests/Hello_TriangleTests.m | 34 ++ .../en.lproj/InfoPlist.strings | 2 + Common/Include/esUtil.h | 10 +- Common/Source/esShapes.c | 1 + Common/Source/esTransform.c | 1 + Common/Source/esUtil.c | 21 +- Common/Source/iOS/AppDelegate.h | 16 + Common/Source/iOS/AppDelegate.m | 47 ++ Common/Source/iOS/ViewController.h | 15 + Common/Source/iOS/ViewController.m | 122 ++++ Common/Source/iOS/main.m | 20 + 24 files changed, 1127 insertions(+), 10 deletions(-) create mode 100644 .gitignore create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.pbxproj create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/xcshareddata/Hello_Triangle.xccheckout create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPad.storyboard create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPhone.storyboard create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Info.plist create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Prefix.pch create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/LaunchImage.launchimage/Contents.json create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/en.lproj/InfoPlist.strings create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests-Info.plist create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests.m create mode 100644 Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/en.lproj/InfoPlist.strings create mode 100644 Common/Source/iOS/AppDelegate.h create mode 100644 Common/Source/iOS/AppDelegate.m create mode 100644 Common/Source/iOS/ViewController.h create mode 100644 Common/Source/iOS/ViewController.m create mode 100644 Common/Source/iOS/main.m diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0fbd904 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +.DS_Store +*.swp +*.lock +profile +*~.nib + + + +DerivedData/ +build/ + + + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 +v + +xcuserdata +*.moved-aside + + diff --git a/Chapter_2/Hello_Triangle/Hello_Triangle.c b/Chapter_2/Hello_Triangle/Hello_Triangle.c index 2984123..13a163d 100644 --- a/Chapter_2/Hello_Triangle/Hello_Triangle.c +++ b/Chapter_2/Hello_Triangle/Hello_Triangle.c @@ -77,7 +77,7 @@ GLuint LoadShader ( GLenum type, const char *shaderSrc ) int Init ( ESContext *esContext ) { UserData *userData = esContext->userData; - GLbyte vShaderStr[] = + char vShaderStr[] = "#version 300 es \n" "in vec4 vPosition; \n" "void main() \n" @@ -85,7 +85,7 @@ int Init ( ESContext *esContext ) " gl_Position = vPosition; \n" "} \n"; - GLbyte fShaderStr[] = + char fShaderStr[] = "#version 300 es \n" "precision mediump float; \n" "out vec4 fragColor; \n" diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.pbxproj b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.pbxproj new file mode 100644 index 0000000..999c856 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.pbxproj @@ -0,0 +1,521 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 7626523617F10E6C007CCD43 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523517F10E6C007CCD43 /* Foundation.framework */; }; + 7626523817F10E6C007CCD43 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523717F10E6C007CCD43 /* CoreGraphics.framework */; }; + 7626523A17F10E6C007CCD43 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523917F10E6C007CCD43 /* UIKit.framework */; }; + 7626523C17F10E6C007CCD43 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523B17F10E6C007CCD43 /* GLKit.framework */; }; + 7626523E17F10E6C007CCD43 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523D17F10E6C007CCD43 /* OpenGLES.framework */; }; + 7626524417F10E6C007CCD43 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7626524217F10E6C007CCD43 /* InfoPlist.strings */; }; + 7626524D17F10E6C007CCD43 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7626524B17F10E6C007CCD43 /* Main_iPhone.storyboard */; }; + 7626525017F10E6C007CCD43 /* Main_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7626524E17F10E6C007CCD43 /* Main_iPad.storyboard */; }; + 7626525917F10E6C007CCD43 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7626525817F10E6C007CCD43 /* Images.xcassets */; }; + 7626526017F10E6C007CCD43 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626525F17F10E6C007CCD43 /* XCTest.framework */; }; + 7626526117F10E6C007CCD43 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523517F10E6C007CCD43 /* Foundation.framework */; }; + 7626526217F10E6C007CCD43 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7626523917F10E6C007CCD43 /* UIKit.framework */; }; + 7626526A17F10E6C007CCD43 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7626526817F10E6C007CCD43 /* InfoPlist.strings */; }; + 7626526C17F10E6C007CCD43 /* Hello_TriangleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7626526B17F10E6C007CCD43 /* Hello_TriangleTests.m */; }; + 7626527E17F10EE6007CCD43 /* esShader.c in Sources */ = {isa = PBXBuildFile; fileRef = 7626527517F10EE6007CCD43 /* esShader.c */; }; + 7626527F17F10EE6007CCD43 /* esShapes.c in Sources */ = {isa = PBXBuildFile; fileRef = 7626527617F10EE6007CCD43 /* esShapes.c */; }; + 7626528017F10EE6007CCD43 /* esTransform.c in Sources */ = {isa = PBXBuildFile; fileRef = 7626527717F10EE6007CCD43 /* esTransform.c */; }; + 7626528117F10EE6007CCD43 /* esUtil.c in Sources */ = {isa = PBXBuildFile; fileRef = 7626527817F10EE6007CCD43 /* esUtil.c */; }; + 7626528217F10EE6007CCD43 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7626527A17F10EE6007CCD43 /* AppDelegate.m */; }; + 7626528317F10EE6007CCD43 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7626527B17F10EE6007CCD43 /* main.m */; }; + 7626528417F10EE6007CCD43 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7626527D17F10EE6007CCD43 /* ViewController.m */; }; + 7626528617F10FAD007CCD43 /* Hello_Triangle.c in Sources */ = {isa = PBXBuildFile; fileRef = 7626528517F10FAD007CCD43 /* Hello_Triangle.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 7626526317F10E6C007CCD43 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 7626522A17F10E6C007CCD43 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 7626523117F10E6C007CCD43; + remoteInfo = Hello_Triangle; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 7626523217F10E6C007CCD43 /* Hello_Triangle.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Hello_Triangle.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 7626523517F10E6C007CCD43 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 7626523717F10E6C007CCD43 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 7626523917F10E6C007CCD43 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 7626523B17F10E6C007CCD43 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = System/Library/Frameworks/GLKit.framework; sourceTree = SDKROOT; }; + 7626523D17F10E6C007CCD43 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + 7626524117F10E6C007CCD43 /* Hello_Triangle-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Hello_Triangle-Info.plist"; sourceTree = ""; }; + 7626524317F10E6C007CCD43 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 7626524717F10E6C007CCD43 /* Hello_Triangle-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Hello_Triangle-Prefix.pch"; sourceTree = ""; }; + 7626524C17F10E6C007CCD43 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; + 7626524F17F10E6C007CCD43 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPad.storyboard; sourceTree = ""; }; + 7626525817F10E6C007CCD43 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 7626525E17F10E6C007CCD43 /* Hello_TriangleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Hello_TriangleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 7626525F17F10E6C007CCD43 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 7626526717F10E6C007CCD43 /* Hello_TriangleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Hello_TriangleTests-Info.plist"; sourceTree = ""; }; + 7626526917F10E6C007CCD43 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 7626526B17F10E6C007CCD43 /* Hello_TriangleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Hello_TriangleTests.m; sourceTree = ""; }; + 7626527517F10EE6007CCD43 /* esShader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = esShader.c; path = ../../../../../Common/Source/esShader.c; sourceTree = ""; }; + 7626527617F10EE6007CCD43 /* esShapes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = esShapes.c; path = ../../../../../Common/Source/esShapes.c; sourceTree = ""; }; + 7626527717F10EE6007CCD43 /* esTransform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = esTransform.c; path = ../../../../../Common/Source/esTransform.c; sourceTree = ""; }; + 7626527817F10EE6007CCD43 /* esUtil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = esUtil.c; path = ../../../../../Common/Source/esUtil.c; sourceTree = ""; }; + 7626527917F10EE6007CCD43 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ../../../../../Common/Source/iOS/AppDelegate.h; sourceTree = ""; }; + 7626527A17F10EE6007CCD43 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ../../../../../Common/Source/iOS/AppDelegate.m; sourceTree = ""; }; + 7626527B17F10EE6007CCD43 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ../../../../../Common/Source/iOS/main.m; sourceTree = ""; }; + 7626527C17F10EE6007CCD43 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = ../../../../../Common/Source/iOS/ViewController.h; sourceTree = ""; }; + 7626527D17F10EE6007CCD43 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = ../../../../../Common/Source/iOS/ViewController.m; sourceTree = ""; }; + 7626528517F10FAD007CCD43 /* Hello_Triangle.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Hello_Triangle.c; path = ../../../Hello_Triangle.c; sourceTree = ""; }; + 7626528717F110A5007CCD43 /* esUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = esUtil.h; path = ../../../../../Common/Include/esUtil.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 7626522F17F10E6C007CCD43 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626523E17F10E6C007CCD43 /* OpenGLES.framework in Frameworks */, + 7626523817F10E6C007CCD43 /* CoreGraphics.framework in Frameworks */, + 7626523A17F10E6C007CCD43 /* UIKit.framework in Frameworks */, + 7626523C17F10E6C007CCD43 /* GLKit.framework in Frameworks */, + 7626523617F10E6C007CCD43 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7626525B17F10E6C007CCD43 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626526017F10E6C007CCD43 /* XCTest.framework in Frameworks */, + 7626526217F10E6C007CCD43 /* UIKit.framework in Frameworks */, + 7626526117F10E6C007CCD43 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 7626522917F10E6C007CCD43 = { + isa = PBXGroup; + children = ( + 7626523F17F10E6C007CCD43 /* Hello_Triangle */, + 7626526517F10E6C007CCD43 /* Hello_TriangleTests */, + 7626523417F10E6C007CCD43 /* Frameworks */, + 7626523317F10E6C007CCD43 /* Products */, + ); + sourceTree = ""; + }; + 7626523317F10E6C007CCD43 /* Products */ = { + isa = PBXGroup; + children = ( + 7626523217F10E6C007CCD43 /* Hello_Triangle.app */, + 7626525E17F10E6C007CCD43 /* Hello_TriangleTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 7626523417F10E6C007CCD43 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 7626523517F10E6C007CCD43 /* Foundation.framework */, + 7626523717F10E6C007CCD43 /* CoreGraphics.framework */, + 7626523917F10E6C007CCD43 /* UIKit.framework */, + 7626523B17F10E6C007CCD43 /* GLKit.framework */, + 7626523D17F10E6C007CCD43 /* OpenGLES.framework */, + 7626525F17F10E6C007CCD43 /* XCTest.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 7626523F17F10E6C007CCD43 /* Hello_Triangle */ = { + isa = PBXGroup; + children = ( + 7626528717F110A5007CCD43 /* esUtil.h */, + 7626528517F10FAD007CCD43 /* Hello_Triangle.c */, + 7626527517F10EE6007CCD43 /* esShader.c */, + 7626527617F10EE6007CCD43 /* esShapes.c */, + 7626527717F10EE6007CCD43 /* esTransform.c */, + 7626527817F10EE6007CCD43 /* esUtil.c */, + 7626527917F10EE6007CCD43 /* AppDelegate.h */, + 7626527A17F10EE6007CCD43 /* AppDelegate.m */, + 7626527B17F10EE6007CCD43 /* main.m */, + 7626527C17F10EE6007CCD43 /* ViewController.h */, + 7626527D17F10EE6007CCD43 /* ViewController.m */, + 7626524B17F10E6C007CCD43 /* Main_iPhone.storyboard */, + 7626524E17F10E6C007CCD43 /* Main_iPad.storyboard */, + 7626525817F10E6C007CCD43 /* Images.xcassets */, + 7626524017F10E6C007CCD43 /* Supporting Files */, + ); + path = Hello_Triangle; + sourceTree = ""; + }; + 7626524017F10E6C007CCD43 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 7626524117F10E6C007CCD43 /* Hello_Triangle-Info.plist */, + 7626524217F10E6C007CCD43 /* InfoPlist.strings */, + 7626524717F10E6C007CCD43 /* Hello_Triangle-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 7626526517F10E6C007CCD43 /* Hello_TriangleTests */ = { + isa = PBXGroup; + children = ( + 7626526B17F10E6C007CCD43 /* Hello_TriangleTests.m */, + 7626526617F10E6C007CCD43 /* Supporting Files */, + ); + path = Hello_TriangleTests; + sourceTree = ""; + }; + 7626526617F10E6C007CCD43 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 7626526717F10E6C007CCD43 /* Hello_TriangleTests-Info.plist */, + 7626526817F10E6C007CCD43 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 7626523117F10E6C007CCD43 /* Hello_Triangle */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7626526F17F10E6C007CCD43 /* Build configuration list for PBXNativeTarget "Hello_Triangle" */; + buildPhases = ( + 7626522E17F10E6C007CCD43 /* Sources */, + 7626522F17F10E6C007CCD43 /* Frameworks */, + 7626523017F10E6C007CCD43 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Hello_Triangle; + productName = Hello_Triangle; + productReference = 7626523217F10E6C007CCD43 /* Hello_Triangle.app */; + productType = "com.apple.product-type.application"; + }; + 7626525D17F10E6C007CCD43 /* Hello_TriangleTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7626527217F10E6C007CCD43 /* Build configuration list for PBXNativeTarget "Hello_TriangleTests" */; + buildPhases = ( + 7626525A17F10E6C007CCD43 /* Sources */, + 7626525B17F10E6C007CCD43 /* Frameworks */, + 7626525C17F10E6C007CCD43 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 7626526417F10E6C007CCD43 /* PBXTargetDependency */, + ); + name = Hello_TriangleTests; + productName = Hello_TriangleTests; + productReference = 7626525E17F10E6C007CCD43 /* Hello_TriangleTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 7626522A17F10E6C007CCD43 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0500; + ORGANIZATIONNAME = "Daniel Ginsburg"; + TargetAttributes = { + 7626525D17F10E6C007CCD43 = { + TestTargetID = 7626523117F10E6C007CCD43; + }; + }; + }; + buildConfigurationList = 7626522D17F10E6C007CCD43 /* Build configuration list for PBXProject "Hello_Triangle" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 7626522917F10E6C007CCD43; + productRefGroup = 7626523317F10E6C007CCD43 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 7626523117F10E6C007CCD43 /* Hello_Triangle */, + 7626525D17F10E6C007CCD43 /* Hello_TriangleTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 7626523017F10E6C007CCD43 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626525017F10E6C007CCD43 /* Main_iPad.storyboard in Resources */, + 7626524D17F10E6C007CCD43 /* Main_iPhone.storyboard in Resources */, + 7626525917F10E6C007CCD43 /* Images.xcassets in Resources */, + 7626524417F10E6C007CCD43 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7626525C17F10E6C007CCD43 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626526A17F10E6C007CCD43 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 7626522E17F10E6C007CCD43 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626528417F10EE6007CCD43 /* ViewController.m in Sources */, + 7626527E17F10EE6007CCD43 /* esShader.c in Sources */, + 7626528617F10FAD007CCD43 /* Hello_Triangle.c in Sources */, + 7626527F17F10EE6007CCD43 /* esShapes.c in Sources */, + 7626528017F10EE6007CCD43 /* esTransform.c in Sources */, + 7626528117F10EE6007CCD43 /* esUtil.c in Sources */, + 7626528317F10EE6007CCD43 /* main.m in Sources */, + 7626528217F10EE6007CCD43 /* AppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7626525A17F10E6C007CCD43 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 7626526C17F10E6C007CCD43 /* Hello_TriangleTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 7626526417F10E6C007CCD43 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 7626523117F10E6C007CCD43 /* Hello_Triangle */; + targetProxy = 7626526317F10E6C007CCD43 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 7626524217F10E6C007CCD43 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 7626524317F10E6C007CCD43 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 7626524B17F10E6C007CCD43 /* Main_iPhone.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7626524C17F10E6C007CCD43 /* Base */, + ); + name = Main_iPhone.storyboard; + sourceTree = ""; + }; + 7626524E17F10E6C007CCD43 /* Main_iPad.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 7626524F17F10E6C007CCD43 /* Base */, + ); + name = Main_iPad.storyboard; + sourceTree = ""; + }; + 7626526817F10E6C007CCD43 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 7626526917F10E6C007CCD43 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 7626526D17F10E6C007CCD43 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "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_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 7626526E17F10E6C007CCD43 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 7626527017F10E6C007CCD43 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Hello_Triangle/Hello_Triangle-Prefix.pch"; + INFOPLIST_FILE = "Hello_Triangle/Hello_Triangle-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + USER_HEADER_SEARCH_PATHS = ../../../../Common/Include; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 7626527117F10E6C007CCD43 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Hello_Triangle/Hello_Triangle-Prefix.pch"; + INFOPLIST_FILE = "Hello_Triangle/Hello_Triangle-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + USER_HEADER_SEARCH_PATHS = ../../../../Common/Include; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 7626527317F10E6C007CCD43 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Hello_Triangle.app/Hello_Triangle"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Hello_Triangle/Hello_Triangle-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "Hello_TriangleTests/Hello_TriangleTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 7626527417F10E6C007CCD43 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Hello_Triangle.app/Hello_Triangle"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Hello_Triangle/Hello_Triangle-Prefix.pch"; + INFOPLIST_FILE = "Hello_TriangleTests/Hello_TriangleTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 7626522D17F10E6C007CCD43 /* Build configuration list for PBXProject "Hello_Triangle" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7626526D17F10E6C007CCD43 /* Debug */, + 7626526E17F10E6C007CCD43 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7626526F17F10E6C007CCD43 /* Build configuration list for PBXNativeTarget "Hello_Triangle" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7626527017F10E6C007CCD43 /* Debug */, + 7626527117F10E6C007CCD43 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 7626527217F10E6C007CCD43 /* Build configuration list for PBXNativeTarget "Hello_TriangleTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 7626527317F10E6C007CCD43 /* Debug */, + 7626527417F10E6C007CCD43 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 7626522A17F10E6C007CCD43 /* Project object */; +} diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..ce39868 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/xcshareddata/Hello_Triangle.xccheckout b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/xcshareddata/Hello_Triangle.xccheckout new file mode 100644 index 0000000..d56d7d9 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace/xcshareddata/Hello_Triangle.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 56E8436A-CEC6-44A3-B5A0-7AA9396154C7 + IDESourceControlProjectName + Hello_Triangle + IDESourceControlProjectOriginsDictionary + + 841560CE-6BF1-49AE-A07F-FF6771E734F9 + ssh://github.com/danginsburg/opengles-book.git + + IDESourceControlProjectPath + ES30/Code/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 841560CE-6BF1-49AE-A07F-FF6771E734F9 + ../../../../../../../.. + + IDESourceControlProjectURL + ssh://github.com/danginsburg/opengles-book.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 841560CE-6BF1-49AE-A07F-FF6771E734F9 + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 841560CE-6BF1-49AE-A07F-FF6771E734F9 + IDESourceControlWCCName + opengles-book + + + + diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPad.storyboard b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPad.storyboard new file mode 100644 index 0000000..be77021 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPad.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPhone.storyboard b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPhone.storyboard new file mode 100644 index 0000000..5c0d8e3 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Base.lproj/Main_iPhone.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Info.plist b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Info.plist new file mode 100644 index 0000000..c84668d --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ES3Book.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIMainStoryboardFile + Main_iPhone + UIMainStoryboardFile~ipad + Main_iPad + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Prefix.pch b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Prefix.pch new file mode 100644 index 0000000..82a2bb4 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Hello_Triangle-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/AppIcon.appiconset/Contents.json b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..91bf9c1 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,53 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/LaunchImage.launchimage/Contents.json b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 0000000..6f870a4 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,51 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "subtype" : "retina4", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/en.lproj/InfoPlist.strings b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_Triangle/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests-Info.plist b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests-Info.plist new file mode 100644 index 0000000..8299b13 --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + ES3Book.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests.m b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests.m new file mode 100644 index 0000000..7683bde --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/Hello_TriangleTests.m @@ -0,0 +1,34 @@ +// +// Hello_TriangleTests.m +// Hello_TriangleTests +// +// Created by Daniel Ginsburg on 9/23/13. +// Copyright (c) 2013 Daniel Ginsburg. All rights reserved. +// + +#import + +@interface Hello_TriangleTests : XCTestCase + +@end + +@implementation Hello_TriangleTests + +- (void)setUp +{ + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown +{ + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample +{ + XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); +} + +@end diff --git a/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/en.lproj/InfoPlist.strings b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/Chapter_2/Hello_Triangle/iOS/Hello_Triangle/Hello_TriangleTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/Common/Include/esUtil.h b/Common/Include/esUtil.h index c9762ee..1379e0d 100644 --- a/Common/Include/esUtil.h +++ b/Common/Include/esUtil.h @@ -21,9 +21,13 @@ // Includes // #include + +#ifdef __APPLE__ +#include +#else #include #include - +#endif #ifdef __cplusplus extern "C" { @@ -82,6 +86,7 @@ struct ESContext /// Window height GLint height; +#ifndef __APPLE__ /// Display handle EGLNativeDisplayType eglNativeDisplay; @@ -96,7 +101,8 @@ struct ESContext /// EGL surface EGLSurface eglSurface; - +#endif + /// Callbacks void (ESCALLBACK *drawFunc) ( ESContext* ); void (ESCALLBACK *shutdownFunc) ( ESContext* ); diff --git a/Common/Source/esShapes.c b/Common/Source/esShapes.c index 31e0efa..37b1e68 100644 --- a/Common/Source/esShapes.c +++ b/Common/Source/esShapes.c @@ -18,6 +18,7 @@ // #include "esUtil.h" #include +#include #include /// diff --git a/Common/Source/esTransform.c b/Common/Source/esTransform.c index 587e80b..39f662b 100644 --- a/Common/Source/esTransform.c +++ b/Common/Source/esTransform.c @@ -20,6 +20,7 @@ // #include "esUtil.h" #include +#include #define PI 3.1415926535897932384626433832795f diff --git a/Common/Source/esUtil.c b/Common/Source/esUtil.c index a49066d..f32cd42 100644 --- a/Common/Source/esUtil.c +++ b/Common/Source/esUtil.c @@ -12,7 +12,7 @@ // // A utility library for OpenGL ES. This library provides a // basic common framework for the example applications in the -// OpenGL ES 2.0 Programming Guide. +// OpenGL ES 3.0 Programming Guide. // /// @@ -21,8 +21,7 @@ #include #include #include -#include -#include +#include #include "esUtil.h" #include "esUtil_win.h" @@ -39,10 +38,15 @@ /// // Types // +#ifndef __APPLE__ #pragma pack(push,x1) // Byte alignment (8-bit) #pragma pack(1) +#endif typedef struct +#ifdef __APPLE__ +__attribute__((packed)) +#endif { unsigned char IdSize, MapType, @@ -59,15 +63,17 @@ typedef struct } TGA_HEADER; +#ifndef __APPLE__ #pragma pack(pop,x1) +#endif - +#ifndef __APPLE__ /// // CreateEGLContext() // // Creates an EGL rendering context and all associated elements // -EGLBoolean CreateEGLContext ( EGLNativeWindowType eglNativeWindow, EGLNativeDisplayType eglNativeDisplay, +EGLBoolean CreateEGLContext ( EGLNativeWindowType eglNativeWindow, EGLNativeDisplayType eglNativeDisplay, EGLDisplay* eglDisplay, EGLContext* eglContext, EGLSurface* eglSurface, EGLint attribList[]) { @@ -137,7 +143,8 @@ EGLBoolean CreateEGLContext ( EGLNativeWindowType eglNativeWindow, EGLNativeDisp *eglSurface = surface; *eglContext = context; return EGL_TRUE; -} +} +#endif ////////////////////////////////////////////////////////////////// // @@ -173,6 +180,7 @@ void ESUTIL_API esInitContext ( ESContext *esContext ) // GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, const char* title, GLint width, GLint height, GLuint flags ) { +#ifndef __APPLE__ EGLint attribList[] = { EGL_RED_SIZE, 5, @@ -216,6 +224,7 @@ GLboolean ESUTIL_API esCreateWindow ( ESContext *esContext, const char* title, G { return GL_FALSE; } +#endif // #ifndef __APPLE__ return GL_TRUE; diff --git a/Common/Source/iOS/AppDelegate.h b/Common/Source/iOS/AppDelegate.h new file mode 100644 index 0000000..90b29cb --- /dev/null +++ b/Common/Source/iOS/AppDelegate.h @@ -0,0 +1,16 @@ +// +// Book: OpenGL(R) ES 2.0 Programming Guide +// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner +// ISBN-10: 0321502795 +// ISBN-13: 9780321502797 +// Publisher: Addison-Wesley Professional +// URLs: http://safari.informit.com/9780321563835 +// http://www.opengles-book.com + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/Common/Source/iOS/AppDelegate.m b/Common/Source/iOS/AppDelegate.m new file mode 100644 index 0000000..f026ea5 --- /dev/null +++ b/Common/Source/iOS/AppDelegate.m @@ -0,0 +1,47 @@ +// +// Book: OpenGL(R) ES 2.0 Programming Guide +// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner +// ISBN-10: 0321502795 +// ISBN-13: 9780321502797 +// Publisher: Addison-Wesley Professional +// URLs: http://safari.informit.com/9780321563835 +// http://www.opengles-book.com + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + 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 diff --git a/Common/Source/iOS/ViewController.h b/Common/Source/iOS/ViewController.h new file mode 100644 index 0000000..685b014 --- /dev/null +++ b/Common/Source/iOS/ViewController.h @@ -0,0 +1,15 @@ +// +// Book: OpenGL(R) ES 2.0 Programming Guide +// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner +// ISBN-10: 0321502795 +// ISBN-13: 9780321502797 +// Publisher: Addison-Wesley Professional +// URLs: http://safari.informit.com/9780321563835 +// http://www.opengles-book.com + +#import +#import + +@interface ViewController : GLKViewController + +@end diff --git a/Common/Source/iOS/ViewController.m b/Common/Source/iOS/ViewController.m new file mode 100644 index 0000000..a06cfb3 --- /dev/null +++ b/Common/Source/iOS/ViewController.m @@ -0,0 +1,122 @@ +// +// Book: OpenGL(R) ES 2.0 Programming Guide +// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner +// ISBN-10: 0321502795 +// ISBN-13: 9780321502797 +// Publisher: Addison-Wesley Professional +// URLs: http://safari.informit.com/9780321563835 +// http://www.opengles-book.com +// + +// ViewController.m +// +// iOS wrapper code using GLKit for OpenGL ES 3.0 Programming +// Guide Framework. + +#import "ViewController.h" +#include "esUtil.h" + +extern void esMain( ESContext *esContext ); + + +@interface ViewController () +{ + + ESContext _esContext; +} +@property (strong, nonatomic) EAGLContext *context; +@property (strong, nonatomic) GLKBaseEffect *effect; + + +- (void)setupGL; +- (void)tearDownGL; +@end + +@implementation ViewController + +- (void)viewDidLoad +{ + [super viewDidLoad]; + + self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; + + if (!self.context) + { + NSLog(@"Failed to create ES context"); + } + + GLKView *view = (GLKView *)self.view; + view.context = self.context; + view.drawableDepthFormat = GLKViewDrawableDepthFormat24; + + [self setupGL]; +} + +- (void)dealloc +{ + [self tearDownGL]; + + if ([EAGLContext currentContext] == self.context) { + [EAGLContext setCurrentContext:nil]; + } +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + + if ([self isViewLoaded] && ([[self view] window] == nil)) { + self.view = nil; + + [self tearDownGL]; + + if ([EAGLContext currentContext] == self.context) { + [EAGLContext setCurrentContext:nil]; + } + self.context = nil; + } + + // Dispose of any resources that can be recreated. +} + +- (void)setupGL +{ + [EAGLContext setCurrentContext:self.context]; + + memset( &_esContext, 0, sizeof( _esContext ) ); + + esMain( &_esContext ); +} + +- (void)tearDownGL +{ + [EAGLContext setCurrentContext:self.context]; + + if ( _esContext.shutdownFunc ) + { + _esContext.shutdownFunc( &_esContext ); + } +} + + +- (void)update +{ + if ( _esContext.updateFunc ) + { + _esContext.updateFunc( &_esContext, self.timeSinceLastUpdate ); + } +} + +- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect +{ + _esContext.width = view.drawableWidth; + _esContext.height = view.drawableHeight; + + if ( _esContext.drawFunc ) + { + _esContext.drawFunc( &_esContext ); + } +} + + +@end diff --git a/Common/Source/iOS/main.m b/Common/Source/iOS/main.m new file mode 100644 index 0000000..f1a8d7d --- /dev/null +++ b/Common/Source/iOS/main.m @@ -0,0 +1,20 @@ +// +// Book: OpenGL(R) ES 2.0 Programming Guide +// Authors: Aaftab Munshi, Dan Ginsburg, Dave Shreiner +// ISBN-10: 0321502795 +// ISBN-13: 9780321502797 +// Publisher: Addison-Wesley Professional +// URLs: http://safari.informit.com/9780321563835 +// http://www.opengles-book.com +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +}