Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial xcode ipad project

  • Loading branch information...
commit 1e0bd2e725e4598289d724212cdcd1941559d8b7 1 parent 5ee0fa1
Elijah Insua authored
Showing with 20,741 additions and 6 deletions.
  1. +4 −0 include/WebGL.h
  2. +324 −0 project/webglstandalone-ipad/webglstandalone-ipad.xcodeproj/project.pbxproj
  3. +7 −0 project/webglstandalone-ipad/webglstandalone-ipad.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  4. +19,074 −0 ...lstandalone-ipad.xcodeproj/project.xcworkspace/xcuserdata/tmpvar.xcuserdatad/UserInterfaceState.xcuserstate
  5. +21 −0 ...ndalone-ipad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
  6. +76 −0 ...e-ipad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcschemes/webglstandalone-ipad.xcscheme
  7. +22 −0 ...dalone-ipad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcschemes/xcschememanagement.plist
  8. +36 −0 project/webglstandalone-ipad/webglstandalone-ipad/EAGLView.h
  9. +145 −0 project/webglstandalone-ipad/webglstandalone-ipad/EAGLView.m
  10. +14 −0 project/webglstandalone-ipad/webglstandalone-ipad/Shaders/Shader.fsh
  11. +22 −0 project/webglstandalone-ipad/webglstandalone-ipad/Shaders/Shader.vsh
  12. +2 −0  project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/InfoPlist.strings
  13. +239 −0 project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/MainWindow.xib
  14. +155 −0 project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/webglstandalone_ipadViewController.xib
  15. +17 −0 project/webglstandalone-ipad/webglstandalone-ipad/main.m
  16. +41 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone-ipad-Info.plist
  17. +14 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone-ipad-Prefix.pch
  18. +21 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadAppDelegate.h
  19. +78 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadAppDelegate.m
  20. +34 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadViewController.h
  21. +383 −0 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadViewController.m
  22. +10 −6 src/arch/wrapper.h
  23. +2 −0  src/js/spidermonkey.cc
4 include/WebGL.h
View
@@ -1,4 +1,8 @@
#ifndef _WEBGL_INCLUDE_GAURD_
#define _WEBGL_INCLUDE_GAURD_
#include "../src/arch/wrapper.h"
+
+ int test(void) {
+ return 1;
+ }
#endif
324 project/webglstandalone-ipad/webglstandalone-ipad.xcodeproj/project.pbxproj
View
@@ -0,0 +1,324 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 06D32A31140DD02F00725E8F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A30140DD02F00725E8F /* UIKit.framework */; };
+ 06D32A33140DD02F00725E8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A32140DD02F00725E8F /* Foundation.framework */; };
+ 06D32A35140DD02F00725E8F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A34140DD02F00725E8F /* CoreGraphics.framework */; };
+ 06D32A37140DD02F00725E8F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A36140DD02F00725E8F /* QuartzCore.framework */; };
+ 06D32A39140DD02F00725E8F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A38140DD02F00725E8F /* OpenGLES.framework */; };
+ 06D32A3F140DD02F00725E8F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 06D32A3D140DD02F00725E8F /* InfoPlist.strings */; };
+ 06D32A42140DD02F00725E8F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 06D32A41140DD02F00725E8F /* main.m */; };
+ 06D32A45140DD02F00725E8F /* webglstandalone_ipadAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 06D32A44140DD02F00725E8F /* webglstandalone_ipadAppDelegate.m */; };
+ 06D32A48140DD02F00725E8F /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 06D32A46140DD02F00725E8F /* MainWindow.xib */; };
+ 06D32A4A140DD02F00725E8F /* Shader.fsh in Resources */ = {isa = PBXBuildFile; fileRef = 06D32A49140DD02F00725E8F /* Shader.fsh */; };
+ 06D32A4C140DD02F00725E8F /* Shader.vsh in Resources */ = {isa = PBXBuildFile; fileRef = 06D32A4B140DD02F00725E8F /* Shader.vsh */; };
+ 06D32A4F140DD02F00725E8F /* EAGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 06D32A4E140DD02F00725E8F /* EAGLView.m */; };
+ 06D32A52140DD02F00725E8F /* webglstandalone_ipadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 06D32A51140DD02F00725E8F /* webglstandalone_ipadViewController.m */; };
+ 06D32A55140DD02F00725E8F /* webglstandalone_ipadViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 06D32A53140DD02F00725E8F /* webglstandalone_ipadViewController.xib */; };
+ 06D32A5C140DD0D700725E8F /* libWebGL.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 06D32A5B140DD0D700725E8F /* libWebGL.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 06D32A2C140DD02F00725E8F /* webglstandalone-ipad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "webglstandalone-ipad.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 06D32A30140DD02F00725E8F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 06D32A32140DD02F00725E8F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 06D32A34140DD02F00725E8F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 06D32A36140DD02F00725E8F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
+ 06D32A38140DD02F00725E8F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
+ 06D32A3C140DD02F00725E8F /* webglstandalone-ipad-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "webglstandalone-ipad-Info.plist"; sourceTree = "<group>"; };
+ 06D32A3E140DD02F00725E8F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 06D32A40140DD02F00725E8F /* webglstandalone-ipad-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "webglstandalone-ipad-Prefix.pch"; sourceTree = "<group>"; };
+ 06D32A41140DD02F00725E8F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 06D32A43140DD02F00725E8F /* webglstandalone_ipadAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webglstandalone_ipadAppDelegate.h; sourceTree = "<group>"; };
+ 06D32A44140DD02F00725E8F /* webglstandalone_ipadAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = webglstandalone_ipadAppDelegate.m; sourceTree = "<group>"; };
+ 06D32A47140DD02F00725E8F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainWindow.xib; sourceTree = "<group>"; };
+ 06D32A49140DD02F00725E8F /* Shader.fsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.fsh; path = Shaders/Shader.fsh; sourceTree = "<group>"; };
+ 06D32A4B140DD02F00725E8F /* Shader.vsh */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.glsl; name = Shader.vsh; path = Shaders/Shader.vsh; sourceTree = "<group>"; };
+ 06D32A4D140DD02F00725E8F /* EAGLView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EAGLView.h; sourceTree = "<group>"; };
+ 06D32A4E140DD02F00725E8F /* EAGLView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EAGLView.m; sourceTree = "<group>"; };
+ 06D32A50140DD02F00725E8F /* webglstandalone_ipadViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = webglstandalone_ipadViewController.h; sourceTree = "<group>"; };
+ 06D32A51140DD02F00725E8F /* webglstandalone_ipadViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = webglstandalone_ipadViewController.m; sourceTree = "<group>"; };
+ 06D32A54140DD02F00725E8F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/webglstandalone_ipadViewController.xib; sourceTree = "<group>"; };
+ 06D32A5B140DD0D700725E8F /* libWebGL.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libWebGL.a; path = ../../build/libWebGL.a; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 06D32A29140DD02F00725E8F /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 06D32A5C140DD0D700725E8F /* libWebGL.a in Frameworks */,
+ 06D32A31140DD02F00725E8F /* UIKit.framework in Frameworks */,
+ 06D32A33140DD02F00725E8F /* Foundation.framework in Frameworks */,
+ 06D32A35140DD02F00725E8F /* CoreGraphics.framework in Frameworks */,
+ 06D32A37140DD02F00725E8F /* QuartzCore.framework in Frameworks */,
+ 06D32A39140DD02F00725E8F /* OpenGLES.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 06D32A21140DD02F00725E8F = {
+ isa = PBXGroup;
+ children = (
+ 06D32A5B140DD0D700725E8F /* libWebGL.a */,
+ 06D32A3A140DD02F00725E8F /* webglstandalone-ipad */,
+ 06D32A2F140DD02F00725E8F /* Frameworks */,
+ 06D32A2D140DD02F00725E8F /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 06D32A2D140DD02F00725E8F /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 06D32A2C140DD02F00725E8F /* webglstandalone-ipad.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 06D32A2F140DD02F00725E8F /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 06D32A30140DD02F00725E8F /* UIKit.framework */,
+ 06D32A32140DD02F00725E8F /* Foundation.framework */,
+ 06D32A34140DD02F00725E8F /* CoreGraphics.framework */,
+ 06D32A36140DD02F00725E8F /* QuartzCore.framework */,
+ 06D32A38140DD02F00725E8F /* OpenGLES.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 06D32A3A140DD02F00725E8F /* webglstandalone-ipad */ = {
+ isa = PBXGroup;
+ children = (
+ 06D32A43140DD02F00725E8F /* webglstandalone_ipadAppDelegate.h */,
+ 06D32A44140DD02F00725E8F /* webglstandalone_ipadAppDelegate.m */,
+ 06D32A46140DD02F00725E8F /* MainWindow.xib */,
+ 06D32A49140DD02F00725E8F /* Shader.fsh */,
+ 06D32A4B140DD02F00725E8F /* Shader.vsh */,
+ 06D32A4D140DD02F00725E8F /* EAGLView.h */,
+ 06D32A4E140DD02F00725E8F /* EAGLView.m */,
+ 06D32A50140DD02F00725E8F /* webglstandalone_ipadViewController.h */,
+ 06D32A51140DD02F00725E8F /* webglstandalone_ipadViewController.m */,
+ 06D32A53140DD02F00725E8F /* webglstandalone_ipadViewController.xib */,
+ 06D32A3B140DD02F00725E8F /* Supporting Files */,
+ );
+ path = "webglstandalone-ipad";
+ sourceTree = "<group>";
+ };
+ 06D32A3B140DD02F00725E8F /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 06D32A3C140DD02F00725E8F /* webglstandalone-ipad-Info.plist */,
+ 06D32A3D140DD02F00725E8F /* InfoPlist.strings */,
+ 06D32A40140DD02F00725E8F /* webglstandalone-ipad-Prefix.pch */,
+ 06D32A41140DD02F00725E8F /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 06D32A2B140DD02F00725E8F /* webglstandalone-ipad */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 06D32A58140DD02F00725E8F /* Build configuration list for PBXNativeTarget "webglstandalone-ipad" */;
+ buildPhases = (
+ 06D32A28140DD02F00725E8F /* Sources */,
+ 06D32A29140DD02F00725E8F /* Frameworks */,
+ 06D32A2A140DD02F00725E8F /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "webglstandalone-ipad";
+ productName = "webglstandalone-ipad";
+ productReference = 06D32A2C140DD02F00725E8F /* webglstandalone-ipad.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 06D32A23140DD02F00725E8F /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 06D32A26140DD02F00725E8F /* Build configuration list for PBXProject "webglstandalone-ipad" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 06D32A21140DD02F00725E8F;
+ productRefGroup = 06D32A2D140DD02F00725E8F /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 06D32A2B140DD02F00725E8F /* webglstandalone-ipad */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 06D32A2A140DD02F00725E8F /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 06D32A3F140DD02F00725E8F /* InfoPlist.strings in Resources */,
+ 06D32A48140DD02F00725E8F /* MainWindow.xib in Resources */,
+ 06D32A4A140DD02F00725E8F /* Shader.fsh in Resources */,
+ 06D32A4C140DD02F00725E8F /* Shader.vsh in Resources */,
+ 06D32A55140DD02F00725E8F /* webglstandalone_ipadViewController.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 06D32A28140DD02F00725E8F /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 06D32A42140DD02F00725E8F /* main.m in Sources */,
+ 06D32A45140DD02F00725E8F /* webglstandalone_ipadAppDelegate.m in Sources */,
+ 06D32A4F140DD02F00725E8F /* EAGLView.m in Sources */,
+ 06D32A52140DD02F00725E8F /* webglstandalone_ipadViewController.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 06D32A3D140DD02F00725E8F /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 06D32A3E140DD02F00725E8F /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+ 06D32A46140DD02F00725E8F /* MainWindow.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 06D32A47140DD02F00725E8F /* en */,
+ );
+ name = MainWindow.xib;
+ sourceTree = "<group>";
+ };
+ 06D32A53140DD02F00725E8F /* webglstandalone_ipadViewController.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 06D32A54140DD02F00725E8F /* en */,
+ );
+ name = webglstandalone_ipadViewController.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 06D32A56140DD02F00725E8F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = 2;
+ };
+ name = Debug;
+ };
+ 06D32A57140DD02F00725E8F /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvmgcc42;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 4.3;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = 2;
+ };
+ name = Release;
+ };
+ 06D32A59140DD02F00725E8F /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ "FRAMEWORK_SEARCH_PATHS[arch=*]" = "";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "webglstandalone-ipad/webglstandalone-ipad-Prefix.pch";
+ "GCC_THUMB_SUPPORT[arch=armv6]" = "";
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../\"/**";
+ INFOPLIST_FILE = "webglstandalone-ipad/webglstandalone-ipad-Info.plist";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../build\"",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 06D32A5A140DD02F00725E8F /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "webglstandalone-ipad/webglstandalone-ipad-Prefix.pch";
+ "GCC_THUMB_SUPPORT[arch=armv6]" = "";
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../\"/**";
+ INFOPLIST_FILE = "webglstandalone-ipad/webglstandalone-ipad-Info.plist";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/../../build\"",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ VALIDATE_PRODUCT = YES;
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 06D32A26140DD02F00725E8F /* Build configuration list for PBXProject "webglstandalone-ipad" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 06D32A56140DD02F00725E8F /* Debug */,
+ 06D32A57140DD02F00725E8F /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 06D32A58140DD02F00725E8F /* Build configuration list for PBXNativeTarget "webglstandalone-ipad" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 06D32A59140DD02F00725E8F /* Debug */,
+ 06D32A5A140DD02F00725E8F /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 06D32A23140DD02F00725E8F /* Project object */;
+}
7 project/webglstandalone-ipad/webglstandalone-ipad.xcodeproj/project.xcworkspace/contents.xcworkspacedata
View
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:webglstandalone-ipad.xcodeproj">
+ </FileRef>
+</Workspace>
19,074 ...andalone-ipad.xcodeproj/project.xcworkspace/xcuserdata/tmpvar.xcuserdatad/UserInterfaceState.xcuserstate
View
19,074 additions, 0 deletions not shown
21 ...lone-ipad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist
View
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Bucket
+ type = "1"
+ version = "1.0">
+ <FileBreakpoints>
+ <FileBreakpoint
+ shouldBeEnabled = "Yes"
+ ignoreCount = "0"
+ continueAfterRunningActions = "No"
+ isPathRelative = "1"
+ filePath = "webglstandalone-ipad/EAGLView.m"
+ timestampString = "336451962.187671"
+ startingColumnNumber = "9223372036854775807"
+ endingColumnNumber = "9223372036854775807"
+ startingLineNumber = "33"
+ endingLineNumber = "33"
+ landmarkName = "-initWithCoder:"
+ landmarkType = "5">
+ </FileBreakpoint>
+ </FileBreakpoints>
+</Bucket>
76 ...pad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcschemes/webglstandalone-ipad.xcscheme
View
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "06D32A2B140DD02F00725E8F"
+ BuildableName = "webglstandalone-ipad.app"
+ BlueprintName = "webglstandalone-ipad"
+ ReferencedContainer = "container:webglstandalone-ipad.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ buildConfiguration = "Debug">
+ <Testables>
+ </Testables>
+ </TestAction>
+ <LaunchAction
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Debug">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "06D32A2B140DD02F00725E8F"
+ BuildableName = "webglstandalone-ipad.app"
+ BlueprintName = "webglstandalone-ipad"
+ ReferencedContainer = "container:webglstandalone-ipad.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ displayScaleIsEnabled = "NO"
+ displayScale = "1.00"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ buildConfiguration = "Release">
+ <BuildableProductRunnable>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "06D32A2B140DD02F00725E8F"
+ BuildableName = "webglstandalone-ipad.app"
+ BlueprintName = "webglstandalone-ipad"
+ ReferencedContainer = "container:webglstandalone-ipad.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
22 ...one-ipad/webglstandalone-ipad.xcodeproj/xcuserdata/tmpvar.xcuserdatad/xcschemes/xcschememanagement.plist
View
@@ -0,0 +1,22 @@
+<?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>SchemeUserState</key>
+ <dict>
+ <key>webglstandalone-ipad.xcscheme</key>
+ <dict>
+ <key>orderHint</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <key>SuppressBuildableAutocreation</key>
+ <dict>
+ <key>06D32A2B140DD02F00725E8F</key>
+ <dict>
+ <key>primary</key>
+ <true/>
+ </dict>
+ </dict>
+</dict>
+</plist>
36 project/webglstandalone-ipad/webglstandalone-ipad/EAGLView.h
View
@@ -0,0 +1,36 @@
+//
+// EAGLView.h
+// OpenGLES_iPhone
+//
+// Created by mmalc Crawford on 11/18/10.
+// Copyright 2010 Apple Inc. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import <OpenGLES/ES1/gl.h>
+#import <OpenGLES/ES1/glext.h>
+#import <OpenGLES/ES2/gl.h>
+#import <OpenGLES/ES2/glext.h>
+
+@class EAGLContext;
+
+// This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
+// The view content is basically an EAGL surface you render your OpenGL scene into.
+// Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
+@interface EAGLView : UIView {
+@private
+ // The pixel dimensions of the CAEAGLLayer.
+ GLint framebufferWidth;
+ GLint framebufferHeight;
+
+ // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view.
+ GLuint defaultFramebuffer, colorRenderbuffer;
+}
+
+@property (nonatomic, retain) EAGLContext *context;
+
+- (void)setFramebuffer;
+- (BOOL)presentFramebuffer;
+
+@end
145 project/webglstandalone-ipad/webglstandalone-ipad/EAGLView.m
View
@@ -0,0 +1,145 @@
+//
+// EAGLView.m
+// OpenGLES_iPhone
+//
+// Created by mmalc Crawford on 11/18/10.
+// Copyright 2010 Apple Inc. All rights reserved.
+//
+
+#import <QuartzCore/QuartzCore.h>
+
+#import "EAGLView.h"
+
+#include "WebGL.h"
+
+@interface EAGLView (PrivateMethods)
+- (void)createFramebuffer;
+- (void)deleteFramebuffer;
+@end
+
+@implementation EAGLView
+
+@synthesize context;
+
+// You must implement this method
++ (Class)layerClass
+{
+ return [CAEAGLLayer class];
+}
+
+//The EAGL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:.
+- (id)initWithCoder:(NSCoder*)coder
+{
+ // TODO: remove this, as it is just a sanity check
+ int i = test();
+
+ self = [super initWithCoder:coder];
+ if (self) {
+ CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
+
+ eaglLayer.opaque = TRUE;
+ eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
+ [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking,
+ kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat,
+ nil];
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [self deleteFramebuffer];
+ [context release];
+
+ [super dealloc];
+}
+
+- (void)setContext:(EAGLContext *)newContext
+{
+ if (context != newContext) {
+ [self deleteFramebuffer];
+
+ [context release];
+ context = [newContext retain];
+
+ [EAGLContext setCurrentContext:nil];
+ }
+}
+
+- (void)createFramebuffer
+{
+ if (context && !defaultFramebuffer) {
+ [EAGLContext setCurrentContext:context];
+
+ // Create default framebuffer object.
+ glGenFramebuffers(1, &defaultFramebuffer);
+ glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
+
+ // Create color render buffer and allocate backing store.
+ glGenRenderbuffers(1, &colorRenderbuffer);
+ glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
+ [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:(CAEAGLLayer *)self.layer];
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &framebufferWidth);
+ glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &framebufferHeight);
+
+ glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, colorRenderbuffer);
+
+ if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
+ NSLog(@"Failed to make complete framebuffer object %x", glCheckFramebufferStatus(GL_FRAMEBUFFER));
+ }
+}
+
+- (void)deleteFramebuffer
+{
+ if (context) {
+ [EAGLContext setCurrentContext:context];
+
+ if (defaultFramebuffer) {
+ glDeleteFramebuffers(1, &defaultFramebuffer);
+ defaultFramebuffer = 0;
+ }
+
+ if (colorRenderbuffer) {
+ glDeleteRenderbuffers(1, &colorRenderbuffer);
+ colorRenderbuffer = 0;
+ }
+ }
+}
+
+- (void)setFramebuffer
+{
+ if (context) {
+ [EAGLContext setCurrentContext:context];
+
+ if (!defaultFramebuffer)
+ [self createFramebuffer];
+
+ glBindFramebuffer(GL_FRAMEBUFFER, defaultFramebuffer);
+
+ glViewport(0, 0, framebufferWidth, framebufferHeight);
+ }
+}
+
+- (BOOL)presentFramebuffer
+{
+ BOOL success = FALSE;
+
+ if (context) {
+ [EAGLContext setCurrentContext:context];
+
+ glBindRenderbuffer(GL_RENDERBUFFER, colorRenderbuffer);
+
+ success = [context presentRenderbuffer:GL_RENDERBUFFER];
+ }
+
+ return success;
+}
+
+- (void)layoutSubviews
+{
+ // The framebuffer will be re-created at the beginning of the next setFramebuffer method call.
+ [self deleteFramebuffer];
+}
+
+@end
14 project/webglstandalone-ipad/webglstandalone-ipad/Shaders/Shader.fsh
View
@@ -0,0 +1,14 @@
+//
+// Shader.fsh
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+varying lowp vec4 colorVarying;
+
+void main()
+{
+ gl_FragColor = colorVarying;
+}
22 project/webglstandalone-ipad/webglstandalone-ipad/Shaders/Shader.vsh
View
@@ -0,0 +1,22 @@
+//
+// Shader.vsh
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+attribute vec4 position;
+attribute vec4 color;
+
+varying vec4 colorVarying;
+
+uniform float translate;
+
+void main()
+{
+ gl_Position = position;
+ gl_Position.y += sin(translate) / 2.0;
+
+ colorVarying = color;
+}
2  project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/InfoPlist.strings
View
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
239 project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/MainWindow.xib
View
@@ -0,0 +1,239 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">800</int>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1248</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">106</string>
+ </object>
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>IBUIWindow</string>
+ <string>IBUICustomObject</string>
+ <string>IBUIViewController</string>
+ <string>IBUIView</string>
+ <string>IBProxyObject</string>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBProxyObject" id="841351856">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ </object>
+ <object class="IBProxyObject" id="606714003">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ </object>
+ <object class="IBUIWindow" id="62075450">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">292</int>
+ <object class="NSMutableArray" key="NSSubviews">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBUIView" id="693292207">
+ <reference key="NSNextResponder" ref="62075450"/>
+ <int key="NSvFlags">274</int>
+ <string key="NSFrameSize">{768, 1004}</string>
+ <reference key="NSSuperview" ref="62075450"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <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">IBIPadFramework</string>
+ </object>
+ </object>
+ <string key="NSFrameSize">{768, 1004}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="693292207"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MSAxIDEAA</bytes>
+ </object>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClearsContextBeforeDrawing">NO</bool>
+ <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ <bool key="IBUIVisibleAtLaunch">YES</bool>
+ <bool key="IBUIResizesToFullScreen">YES</bool>
+ </object>
+ <object class="IBUICustomObject" id="250404236">
+ <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ </object>
+ <object class="IBUIViewController" id="160346751">
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
+ <int key="IBUIStatusBarStyle">2</int>
+ </object>
+ <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+ <int key="IBUIInterfaceOrientation">1</int>
+ <int key="interfaceOrientation">1</int>
+ </object>
+ <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+ <bool key="IBUIHorizontal">NO</bool>
+ </object>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">window</string>
+ <reference key="source" ref="250404236"/>
+ <reference key="destination" ref="62075450"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">delegate</string>
+ <reference key="source" ref="841351856"/>
+ <reference key="destination" ref="250404236"/>
+ </object>
+ <int key="connectionID">8</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">viewController</string>
+ <reference key="source" ref="250404236"/>
+ <reference key="destination" ref="160346751"/>
+ </object>
+ <int key="connectionID">12</int>
+ </object>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="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="606714003"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">2</int>
+ <reference key="object" ref="62075450"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="693292207"/>
+ </object>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="250404236"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="693292207"/>
+ <reference key="parent" ref="62075450"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">11</int>
+ <reference key="object" ref="160346751"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>11.CustomClassName</string>
+ <string>11.IBPluginDependency</string>
+ <string>2.IBEditorWindowLastContentRect</string>
+ <string>2.IBPluginDependency</string>
+ <string>6.CustomClassName</string>
+ <string>6.IBPluginDependency</string>
+ <string>9.CustomClassName</string>
+ <string>9.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>UIApplication</string>
+ <string>UIResponder</string>
+ <string>webglstandalone_ipadViewController</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>{{185, 50}, {783, 806}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>webglstandalone_ipadAppDelegate</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string>EAGLView</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">12</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">EAGLView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./classes-xjh84/EAGLView.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
+ <integer value="800" key="NS.object.0"/>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <string key="IBDocument.LastKnownRelativeProjectPath">OpenGLES_iPad.xcodeproj</string>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">106</string>
+ </data>
+</archive>
155 project/webglstandalone-ipad/webglstandalone-ipad/en.lproj/webglstandalone_ipadViewController.xib
View
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
+ <data>
+ <int key="IBDocument.SystemTarget">1056</int>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1248</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">106</string>
+ </object>
+ <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>IBProxyObject</string>
+ <string>IBUIView</string>
+ </object>
+ <object class="NSArray" key="IBDocument.PluginDependencies">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys" id="0">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <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"/>
+ <reference key="NSNextKeyView"/>
+ <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>
+ </object>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <object class="NSMutableArray" key="connectionRecords">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <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>
+ </object>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <object class="NSArray" key="orderedObjects">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <reference key="object" ref="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>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="flattenedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>-1.CustomClassName</string>
+ <string>-2.CustomClassName</string>
+ <string>1.CustomClassName</string>
+ <string>1.IBEditorWindowLastContentRect</string>
+ <string>1.IBPluginDependency</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>webglstandalone_ipadViewController</string>
+ <string>UIResponder</string>
+ <string>EAGLView</string>
+ <string>{{514, 109}, {768, 1024}}</string>
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="unlocalizedProperties">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <nil key="activeLocalization"/>
+ <object class="NSMutableDictionary" key="localizations">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference key="dict.sortedKeys" ref="0"/>
+ <reference key="dict.values" ref="0"/>
+ </object>
+ <nil key="sourceID"/>
+ <int key="maxID">3</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <object class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="IBPartialClassDescription">
+ <string key="className">EAGLView</string>
+ <string key="superclassName">UIView</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./classes-xjh84/EAGLView.h</string>
+ </object>
+ </object>
+ </object>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string>
+ <integer value="3100" key="NS.object.0"/>
+ </object>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <nil key="IBDocument.LastKnownRelativeProjectPath"/>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <string key="IBCocoaTouchPluginVersion">106</string>
+ </data>
+</archive>
17 project/webglstandalone-ipad/webglstandalone-ipad/main.m
View
@@ -0,0 +1,17 @@
+//
+// main.m
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}
41 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone-ipad-Info.plist
View
@@ -0,0 +1,41 @@
+<?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>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.tmpvar.webglstandalone.${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>NSMainNibFile</key>
+ <string>MainWindow</string>
+ <key>UIStatusBarHidden</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
14 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone-ipad-Prefix.pch
View
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'webglstandalone-ipad' target in the 'webglstandalone-ipad' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iPhone SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
21 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadAppDelegate.h
View
@@ -0,0 +1,21 @@
+//
+// webglstandalone_ipadAppDelegate.h
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@class webglstandalone_ipadViewController;
+
+@interface webglstandalone_ipadAppDelegate : NSObject <UIApplicationDelegate> {
+
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+
+@property (nonatomic, retain) IBOutlet webglstandalone_ipadViewController *viewController;
+
+@end
78 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadAppDelegate.m
View
@@ -0,0 +1,78 @@
+//
+// webglstandalone_ipadAppDelegate.m
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import "webglstandalone_ipadAppDelegate.h"
+
+#import "EAGLView.h"
+
+#import "webglstandalone_ipadViewController.h"
+
+@implementation webglstandalone_ipadAppDelegate
+
+
+@synthesize window=_window;
+
+@synthesize viewController=_viewController;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ // Override point for customization after application launch.
+ self.window.rootViewController = self.viewController;
+ 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.
+ */
+ [self.viewController stopAnimation];
+}
+
+- (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.
+ */
+ [self.viewController startAnimation];
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ /*
+ Called when the application is about to terminate.
+ Save data if appropriate.
+ See also applicationDidEnterBackground:.
+ */
+ [self.viewController stopAnimation];
+}
+
+- (void)dealloc
+{
+ [_window release];
+ [_viewController release];
+ [super dealloc];
+}
+
+@end
34 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadViewController.h
View
@@ -0,0 +1,34 @@
+//
+// webglstandalone_ipadViewController.h
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import <OpenGLES/EAGL.h>
+
+#import <OpenGLES/ES1/gl.h>
+#import <OpenGLES/ES1/glext.h>
+#import <OpenGLES/ES2/gl.h>
+#import <OpenGLES/ES2/glext.h>
+
+@interface webglstandalone_ipadViewController : UIViewController {
+@private
+ EAGLContext *context;
+ GLuint program;
+
+ BOOL animating;
+ NSInteger animationFrameInterval;
+ CADisplayLink *displayLink;
+}
+
+@property (readonly, nonatomic, getter=isAnimating) BOOL animating;
+@property (nonatomic) NSInteger animationFrameInterval;
+
+- (void)startAnimation;
+- (void)stopAnimation;
+
+@end
383 project/webglstandalone-ipad/webglstandalone-ipad/webglstandalone_ipadViewController.m
View
@@ -0,0 +1,383 @@
+//
+// webglstandalone_ipadViewController.m
+// webglstandalone-ipad
+//
+// Created by Elijah Insua on 8/30/11.
+// Copyright 2011 __MyCompanyName__. All rights reserved.
+//
+
+#import <QuartzCore/QuartzCore.h>
+
+#import "webglstandalone_ipadViewController.h"
+#import "EAGLView.h"
+
+// Uniform index.
+enum {
+ UNIFORM_TRANSLATE,
+ NUM_UNIFORMS
+};
+GLint uniforms[NUM_UNIFORMS];
+
+// Attribute index.
+enum {
+ ATTRIB_VERTEX,
+ ATTRIB_COLOR,
+ NUM_ATTRIBUTES
+};
+
+@interface webglstandalone_ipadViewController ()
+@property (nonatomic, retain) EAGLContext *context;
+@property (nonatomic, assign) CADisplayLink *displayLink;
+- (BOOL)loadShaders;
+- (BOOL)compileShader:(GLuint *)shader type:(GLenum)type file:(NSString *)file;
+- (BOOL)linkProgram:(GLuint)prog;
+- (BOOL)validateProgram:(GLuint)prog;
+@end
+
+@implementation webglstandalone_ipadViewController
+
+@synthesize animating, context, displayLink;
+
+- (void)awakeFromNib
+{
+ EAGLContext *aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+
+ if (!aContext) {
+ aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1];
+ }
+
+ if (!aContext)
+ NSLog(@"Failed to create ES context");
+ else if (![EAGLContext setCurrentContext:aContext])
+ NSLog(@"Failed to set ES context current");
+
+ self.context = aContext;
+ [aContext release];
+
+ [(EAGLView *)self.view setContext:context];
+ [(EAGLView *)self.view setFramebuffer];
+
+ if ([context API] == kEAGLRenderingAPIOpenGLES2)
+ [self loadShaders];
+
+ animating = FALSE;
+ animationFrameInterval = 1;
+ self.displayLink = nil;
+}
+
+- (void)dealloc
+{
+ if (program) {
+ glDeleteProgram(program);
+ program = 0;
+ }
+
+ // Tear down context.
+ if ([EAGLContext currentContext] == context)
+ [EAGLContext setCurrentContext:nil];
+
+ [context release];
+
+ [super dealloc];
+}
+
+- (void)didReceiveMemoryWarning
+{
+ // Releases the view if it doesn't have a superview.
+ [super didReceiveMemoryWarning];
+
+ // Release any cached data, images, etc. that aren't in use.
+}
+
+- (void)viewWillAppear:(BOOL)animated
+{
+ [self startAnimation];
+
+ [super viewWillAppear:animated];
+}
+
+- (void)viewWillDisappear:(BOOL)animated
+{
+ [self stopAnimation];
+
+ [super viewWillDisappear:animated];
+}
+
+- (void)viewDidUnload
+{
+ [super viewDidUnload];
+
+ if (program) {
+ glDeleteProgram(program);
+ program = 0;
+ }
+
+ // Tear down context.
+ if ([EAGLContext currentContext] == context)
+ [EAGLContext setCurrentContext:nil];
+ self.context = nil;
+}
+
+- (NSInteger)animationFrameInterval
+{
+ return animationFrameInterval;
+}
+
+- (void)setAnimationFrameInterval:(NSInteger)frameInterval
+{
+ /*
+ Frame interval defines how many display frames must pass between each time the display link fires.
+ The display link will only fire 30 times a second when the frame internal is two on a display that refreshes 60 times a second. The default frame interval setting of one will fire 60 times a second when the display refreshes at 60 times a second. A frame interval setting of less than one results in undefined behavior.
+ */
+ if (frameInterval >= 1) {
+ animationFrameInterval = frameInterval;
+
+ if (animating) {
+ [self stopAnimation];
+ [self startAnimation];
+ }
+ }
+}
+
+- (void)startAnimation
+{
+ if (!animating) {
+ CADisplayLink *aDisplayLink = [[UIScreen mainScreen] displayLinkWithTarget:self selector:@selector(drawFrame)];
+ [aDisplayLink setFrameInterval:animationFrameInterval];
+ [aDisplayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ self.displayLink = aDisplayLink;
+
+ animating = TRUE;
+ }
+}
+
+- (void)stopAnimation
+{
+ if (animating) {
+ [self.displayLink invalidate];
+ self.displayLink = nil;
+ animating = FALSE;
+ }
+}
+
+- (void)drawFrame
+{
+ [(EAGLView *)self.view setFramebuffer];
+
+ // Replace the implementation of this method to do your own custom drawing.
+ static const GLfloat squareVertices[] = {
+ -0.5f, -0.33f,
+ 0.5f, -0.33f,
+ -0.5f, 0.33f,
+ 0.5f, 0.33f,
+ };
+
+ static const GLubyte squareColors[] = {
+ 255, 255, 0, 255,
+ 0, 255, 255, 255,
+ 0, 0, 0, 0,
+ 255, 0, 255, 255,
+ };
+
+ static float transY = 0.0f;
+
+ glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ if ([context API] == kEAGLRenderingAPIOpenGLES2) {
+ // Use shader program.
+ glUseProgram(program);
+
+ // Update uniform value.
+ glUniform1f(uniforms[UNIFORM_TRANSLATE], (GLfloat)transY);
+ transY += 0.075f;
+
+ // Update attribute values.
+ glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_FLOAT, 0, 0, squareVertices);
+ glEnableVertexAttribArray(ATTRIB_VERTEX);
+ glVertexAttribPointer(ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, 1, 0, squareColors);
+ glEnableVertexAttribArray(ATTRIB_COLOR);
+
+ // Validate program before drawing. This is a good check, but only really necessary in a debug build.
+ // DEBUG macro must be defined in your debug configurations if that's not already the case.
+#if defined(DEBUG)
+ if (![self validateProgram:program]) {
+ NSLog(@"Failed to validate program: %d", program);
+ return;
+ }
+#endif
+ } else {
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0f, (GLfloat)(sinf(transY)/2.0f), 0.0f);
+ transY += 0.075f;
+
+ glVertexPointer(2, GL_FLOAT, 0, squareVertices);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glColorPointer(4, GL_UNSIGNED_BYTE, 0, squareColors);
+ glEnableClientState(GL_COLOR_ARRAY);
+ }
+
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ [(EAGLView *)self.view presentFramebuffer];
+}
+
+- (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 FALSE;
+ }
+
+ *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 FALSE;
+ }
+
+ return TRUE;
+}
+
+- (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 FALSE;
+
+ return TRUE;
+}
+
+- (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 FALSE;
+
+ return TRUE;
+}
+
+- (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 FALSE;
+ }
+
+ // 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 FALSE;
+ }
+
+ // 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_COLOR, "color");
+
+ // 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 FALSE;
+ }
+
+ // Get uniform locations.
+ uniforms[UNIFORM_TRANSLATE] = glGetUniformLocation(program, "translate");
+
+ // Release vertex and fragment shaders.
+ if (vertShader)
+ glDeleteShader(vertShader);
+ if (fragShader)
+ glDeleteShader(fragShader);
+
+ return TRUE;
+}
+
+@end
16 src/arch/wrapper.h
View
@@ -1,16 +1,20 @@
#ifndef _INCLIDE_ARCH_WRAPPER_
#define _INCLUDE_ARCH_WRAPPER_
- #include <iostream>
#include <assert.h>
- using namespace std;
+
#define BUFFER_OFFSET(i) ((char*)NULL + (i))
- #ifdef __APPLE__
- #include "../../deps/glfw/include/GL/glfw.h"
- #include <OpenGL/OpenGL.h>
- #include <OpenGL/gl.h>
+ #ifdef TARGET_OS_MAC
+ #ifndef TARGET_OS_IPHONE
+ #include "../../deps/glfw/include/GL/glfw.h"
+ #include <OpenGL/OpenGL.h>
+ #include <OpenGL/gl.h>
+ #endif
#else
+ #include <iostream>
+ using namespace std;
+
#ifdef _WIN32
#include <windows.h>
#endif
2  src/js/spidermonkey.cc
View
@@ -1,6 +1,8 @@
#include "spidermonkey.h"
#include "../arch/wrapper.h"
+
+
JSBool webgl_rendering_context_getContextAttributes(JSContext *cx, uintN argc, jsval *argv) {
JS_ReportError(cx, "method not implemented");
return JS_FALSE;
Please sign in to comment.
Something went wrong with that request. Please try again.