├── .DS_Store
├── OpenGLES_Ch2_1
├── .DS_Store
├── OpenGLES_Ch2_1.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── zhangfangtao.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── zhangfangtao.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch2_1
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ └── LaunchScreen.storyboard
│ ├── Default-568h@2x.png
│ ├── Info.plist
│ ├── OpenGLES_Ch2_1-Prefix.pch
│ ├── OpenGLES_Ch2_1AppDelegate.h
│ ├── OpenGLES_Ch2_1AppDelegate.m
│ ├── OpenGLES_Ch2_1ViewController.h
│ ├── OpenGLES_Ch2_1ViewController.m
│ ├── OpenGLES_Ch2_1ViewController.storyboard
│ ├── OpenGL_ES_for_iOS_114x114.png
│ ├── OpenGL_ES_for_iOS_57x57.png
│ ├── OpenGL_ES_for_iOS_72x72.png
│ └── main.m
├── OpenGLES_Ch2_2
├── .DS_Store
├── OpenGLES_Ch2_2.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── zhangfangtao.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── zhangfangtao.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch2_2
│ ├── AGLKView.h
│ ├── AGLKView.m
│ ├── AGLKViewController.h
│ ├── AGLKViewController.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── Default-568h.imageset
│ │ ├── Contents.json
│ │ └── Default-568h@2x.png
│ ├── OpenGL_ES_for_iOS_114x114.imageset
│ │ ├── Contents.json
│ │ └── OpenGL_ES_for_iOS_114x114.png
│ ├── OpenGL_ES_for_iOS_57x57.imageset
│ │ ├── Contents.json
│ │ └── OpenGL_ES_for_iOS_57x57.png
│ └── OpenGL_ES_for_iOS_72x72.imageset
│ │ ├── Contents.json
│ │ └── OpenGL_ES_for_iOS_72x72.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── OpenGLES_Ch2_2AppDelegate.h
│ ├── OpenGLES_Ch2_2AppDelegate.m
│ ├── Supporting Files
│ └── OpenGLES_Ch2_2-Prefix.pch
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch2_3
├── OpenGLES_Ch2_3.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── zhangfangtao.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── zhangfangtao.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch2_3
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch3_1
├── .DS_Store
├── OpenGLES_Ch3_1.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── zhangfangtao.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── zhangfangtao.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ ├── OpenGLES_Ch3_1.xcscheme
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch3_1
│ ├── .DS_Store
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── leaves.gif
│ └── main.m
├── OpenGLES_Ch3_2
├── OpenGLES_Ch3_2.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ ├── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ │ │ └── zhangfangtao.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ ├── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ │ └── zhangfangtao.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch3_2
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKTextureLoader.h
│ ├── AGLKTextureLoader.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── leaves.gif
│ └── main.m
├── OpenGLES_Ch3_3
├── Default-568h@2x.png
├── OpenGLES_Ch3_3.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
├── OpenGLES_Ch3_3
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ ├── Contents.json
│ │ ├── grid.imageset
│ │ │ ├── Contents.json
│ │ │ └── grid.png
│ │ ├── leaves.dataset
│ │ │ ├── Contents.json
│ │ │ └── leaves.gif
│ │ └── leaves.gif
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGL_ES_for_iOS_114x114.png
├── OpenGL_ES_for_iOS_57x57.png
├── OpenGL_ES_for_iOS_72x72.png
├── beetle.png
└── trail.binary
├── OpenGLES_Ch3_4
├── OpenGLES_Ch3_4.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch3_4
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── beetle.imageset
│ │ ├── Contents.json
│ │ └── beetle.png
│ └── leaves.imageset
│ │ ├── Contents.json
│ │ └── leaves.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch3_5
├── OpenGLES_Ch3_5.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch3_5
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── beetle.imageset
│ │ ├── Contents.json
│ │ └── beetle.png
│ └── leaves.imageset
│ │ ├── Contents.json
│ │ └── leaves.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch3_6
├── OpenGLES_Ch3_6.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch3_6
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── beetle.imageset
│ │ ├── Contents.json
│ │ └── beetle.png
│ └── leaves.imageset
│ │ ├── Contents.json
│ │ └── leaves.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── Shaders
│ ├── Shader.fsh
│ └── Shader.vsh
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch4_1
├── OpenGLES_Ch4_1.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch4_1
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── README.md
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch4_2
├── OpenGLES_Ch4_2.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch4_2
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── Lighting256x256.imageset
│ │ ├── Contents.json
│ │ └── Lighting256x256.png
│ └── LightingDetail256x256.imageset
│ │ ├── Contents.json
│ │ └── LightingDetail256x256.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch5_1
├── OpenGLES_Ch5_1.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch5_1
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ └── Earth512x256.imageset
│ │ ├── Contents.json
│ │ └── Earth512x256.jpg
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── main.m
│ └── sphere.h
├── OpenGLES_Ch5_2
├── OpenGLES_Ch5_2.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch5_2
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ └── Earth512x256.imageset
│ │ ├── Contents.json
│ │ └── Earth512x256.jpg
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── main.m
│ └── sphere.h
├── OpenGLES_Ch5_3
├── OpenGLES_Ch5_3.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch5_3
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AGLKView.h
│ ├── AGLKView.m
│ ├── AGLKViewController.h
│ ├── AGLKViewController.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ └── Earth512x256.imageset
│ │ ├── Contents.json
│ │ └── Earth512x256.jpg
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── main.m
│ └── sphere.h
├── OpenGLES_Ch5_4
├── OpenGLES_Ch5_4.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch5_4
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── lowPolyAxesAndModels2.h
│ └── main.m
├── OpenGLES_Ch5_5
├── OpenGLES_Ch5_5.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch5_5
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKTextureTransformBaseEffect.h
│ ├── AGLKTextureTransformBaseEffect.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Contents.json
│ ├── beetle.imageset
│ │ ├── Contents.json
│ │ └── beetle.png
│ └── leaves.imageset
│ │ ├── Contents.json
│ │ └── leaves.png
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── Shaders
│ ├── AGLKTextureMatrix2PointLightShader.fsh
│ └── AGLKTextureMatrix2PointLightShader.vsh
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── OpenGLES_Ch6_1
├── OpenGLES_Ch6_1.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch6_1
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── SceneCar.h
│ ├── SceneCar.m
│ ├── SceneCarModel.h
│ ├── SceneCarModel.m
│ ├── SceneMesh.h
│ ├── SceneMesh.m
│ ├── SceneModel.h
│ ├── SceneModel.m
│ ├── SceneRinkModel.h
│ ├── SceneRinkModel.m
│ ├── ViewController.h
│ ├── ViewController.m
│ ├── bumperCar.h
│ ├── bumperRink.h
│ └── main.m
├── OpenGLES_Ch6_2
├── OpenGLES_Ch6_2.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ ├── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcuserdata
│ │ │ └── frank.zhang.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── frank.zhang.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
└── OpenGLES_Ch6_2
│ ├── AGLKContext.h
│ ├── AGLKContext.m
│ ├── AGLKVertexAttribArrayBuffer.h
│ ├── AGLKVertexAttribArrayBuffer.m
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── Contents.json
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ ├── SceneAnimatedMesh.h
│ ├── SceneAnimatedMesh.m
│ ├── SceneMesh.h
│ ├── SceneMesh.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
└── README.md
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/.DS_Store
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/.DS_Store
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_1.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_1.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1/Default-568h@2x.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | OpenGLES_Ch2_1ViewController
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGLES_Ch2_1-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_1-Prefix.pch
3 | // OpenGLES_Ch2_1
4 | //
5 | // Created by frank.Zhang on 11/02/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef __IPHONE_5_0
12 | #warning "This project uses features only available in iOS SDK 5.0 and later."
13 | #endif
14 |
15 | #ifdef __OBJC__
16 | #import
17 | #import
18 | #endif
19 |
20 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGLES_Ch2_1AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_1AppDelegate.h
3 | // OpenGLES_Ch2_1
4 | //
5 | // Created by frank.Zhang on 11/02/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @interface OpenGLES_Ch2_1AppDelegate : UIResponder
11 | @property (strong,nonatomic)UIWindow *window;
12 | @end
13 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGLES_Ch2_1AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_1AppDelegate.m
3 | // OpenGLES_Ch2_1
4 | //
5 | // Created by frank.Zhang on 11/02/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import "OpenGLES_Ch2_1AppDelegate.h"
10 | #import "OpenGLES_Ch2_1ViewController.h"
11 | @implementation OpenGLES_Ch2_1AppDelegate
12 | @synthesize window = _window;
13 |
14 | //- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
15 | // self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
16 | // OpenGLES_Ch2_1ViewController * mainVc = [[OpenGLES_Ch2_1ViewController alloc]initWithNibName:@"OpenGLES_Ch2_1ViewController" bundle:nil];
17 | // UINavigationController *navVc = [[UINavigationController alloc]initWithRootViewController:mainVc];
18 | // navVc.title = @"OpenGLES_Ch2_1ViewController";
19 | // self.window.rootViewController = navVc;
20 | // [self.window makeKeyAndVisible];
21 | // return YES;
22 | //}
23 | -(void)applicationWillResignActive:(UIApplication *)application{
24 |
25 | }
26 |
27 | -(void)applicationDidEnterBackground:(UIApplication *)application{
28 |
29 | }
30 |
31 | -(void)applicationWillEnterForeground:(UIApplication *)application{
32 |
33 | }
34 |
35 | -(void)applicationDidBecomeActive:(UIApplication *)application{
36 |
37 | }
38 |
39 | -(void)applicationWillTerminate:(UIApplication *)application{
40 |
41 | }
42 | @end
43 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGLES_Ch2_1ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_1ViewController.h
3 | // OpenGLES_Ch2_1
4 | //
5 | // Created by frank.Zhang on 11/02/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface OpenGLES_Ch2_1ViewController : GLKViewController
12 | {
13 | GLuint vertexBufferID;
14 | }
15 | @property(nonatomic,strong) GLKBaseEffect *baseEffect;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_114x114.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_57x57.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_1/OpenGLES_Ch2_1/OpenGL_ES_for_iOS_72x72.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_1/OpenGLES_Ch2_1/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch2_1
4 | //
5 | // Created by frank.Zhang on 11/02/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "OpenGLES_Ch2_1AppDelegate.h"
11 | /*
12 | *main()函数使用Objective-C的@autoreleacepool关键字来开启自动引用计数,main()还会调用UIApplicationMain()函数,这个函数创建了包含UIApplication实例在内的应用的关键对象,同时开始处理用户事件。NSSTringFromClass([OpenGLES_Ch2_AppDelegate class])表达式指定了与新创建的UIApplication实例一起使用的应用委托类的名字。UIApplication创建了一个充满整个显示屏的UIWindow,同时加载了一个或者多个storyboard文件来构建应用的用户界面。UIApplicationMain()函数不会干涉IUApplication的执行,直到用户退出才会返回。
13 | **/
14 | int main(int argc, char * argv[]) {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([OpenGLES_Ch2_1AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/.DS_Store
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_2.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_2.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/AGLKView.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKView.h
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 20/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @class EAGLContext;
14 | @protocol AGLKViewDelegate;
15 |
16 | typedef enum {
17 | AGLKViewDrawableDepthFormatNone = 0,
18 | AGLKViewDrawableDepthFormat16,
19 | }AGLKViewDrawableDepthFormat;
20 |
21 | @interface AGLKView : UIView
22 | {
23 | EAGLContext *context;
24 | GLuint defaultFrameBuffer;
25 | GLuint colorRenderbuffer;
26 | GLuint depthRenderBuffer;
27 | GLint drawableWidth;
28 | GLint drawableheight;
29 | }
30 |
31 | @property (nonatomic, weak) IBOutlet id delegate;
32 | @property (nonatomic, strong) EAGLContext *context;
33 | @property (nonatomic, readonly) NSInteger drawableWidth;
34 | @property (nonatomic, readonly) NSInteger drawableHeight;
35 | @property (nonatomic) AGLKViewDrawableDepthFormat drawableDepthFormat;
36 |
37 | -(void)display;
38 |
39 | @end
40 | #pragma mark - AGLKViewDelegate
41 | /*
42 | *AGLKViewDelegate协议指定了一个任何AGLKView的委托都必须实现的方法。如果AGLKView实例的委托属性不等于nil,每个AGLKView实例都会向它的委托发送“-glkView:drawInRect:”消息。
43 | AGLKView的实现比较简单,但重写了来自View的多个方法并添加了一些用于支持OpenGL ES绘图的方法。
44 | **/
45 | @protocol AGLKViewDelegate
46 | @required
47 | -(void)glkView:(AGLKView *)view drawInRect:(CGRect)rect;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/AGLKViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKViewController.h
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //这个类除了在显示GLKit类的运行机制时使用了AGLKView和AGLKViewController类而不是GLKit类之外,OpenGLES_Ch2_2和OpenGLES_Ch2_1是相同的。
8 | //与GLKit的GLKViewController类相似,AGLKViewController使用一个Core Animation CADisplaylink对象调度和执行与控制器相关联的视图的周期性的重绘。CADisplayLink本质上是一个用于显示更新的同步计时器,它能够被设置用来在每个显示更新或者其他更新时发送一个消息。CADisplayLink计时器的周期是以显示更新来计量的。
9 |
10 | #import
11 | #import "AGLKView.h"
12 |
13 | @interface AGLKViewController : UIViewController
14 | {
15 | CADisplayLink *displayLink;
16 | NSInteger preferredFramesPreSecond;
17 | }
18 | @property(nonatomic)NSInteger preferredFramesPerSecond;
19 | @property(nonatomic,readonly) NSInteger framesPerSecond;
20 | @property(nonatomic,getter= isPaused) BOOL paused;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 20/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/Default-568h.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Default-568h@2x.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/Default-568h.imageset/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/Default-568h.imageset/Default-568h@2x.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_114x114.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "OpenGL_ES_for_iOS_114x114.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_114x114.imageset/OpenGL_ES_for_iOS_114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_114x114.imageset/OpenGL_ES_for_iOS_114x114.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_57x57.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "OpenGL_ES_for_iOS_57x57.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_57x57.imageset/OpenGL_ES_for_iOS_57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_57x57.imageset/OpenGL_ES_for_iOS_57x57.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_72x72.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "OpenGL_ES_for_iOS_72x72.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_72x72.imageset/OpenGL_ES_for_iOS_72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Assets.xcassets/OpenGL_ES_for_iOS_72x72.imageset/OpenGL_ES_for_iOS_72x72.png
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/OpenGLES_Ch2_2AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_2AppDelegate.h
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface OpenGLES_Ch2_2AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/OpenGLES_Ch2_2AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_2AppDelegate.m
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import "OpenGLES_Ch2_2AppDelegate.h"
10 |
11 | @implementation OpenGLES_Ch2_2AppDelegate
12 | @synthesize window = _window;
13 |
14 | -(void)applicationWillResignActive:(UIApplication *)application{
15 |
16 | }
17 |
18 | -(void)applicationDidEnterBackground:(UIApplication *)application{
19 |
20 | }
21 |
22 | -(void)applicationWillEnterForeground:(UIApplication *)application{
23 |
24 | }
25 |
26 | -(void)applicationDidBecomeActive:(UIApplication *)application{
27 |
28 | }
29 |
30 | -(void)applicationWillTerminate:(UIApplication *)application{
31 |
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/Supporting Files/OpenGLES_Ch2_2-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // OpenGLES_Ch2_2-Prefix.pch
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 20/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef __IPHONE_5_0
12 | #warning "This project uses features only available in iOS SDK 5.0 and later."
13 | #endif
14 |
15 | #ifdef __OBJC__
16 | #import
17 | #import
18 | #endif
19 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 20/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AGLKViewController.h"
11 | #import
12 | @interface ViewController : AGLKViewController
13 | {
14 | GLuint vertexBufferID;
15 | }
16 |
17 | @property(nonatomic,strong) GLKBaseEffect *baseEffect;
18 | @end
19 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_2/OpenGLES_Ch2_2/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch2_2
4 | //
5 | // Created by frank.Zhang on 20/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "OpenGLES_Ch2_2AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([OpenGLES_Ch2_2AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_3.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch2_3.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch2_3
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 | #import
9 | #import
10 | @interface AGLKContext : EAGLContext
11 | //AGLKCntext类是一个在例子OpenGLES_Ch2_1中使用的內建EAGLContext类的简单子类,对于本例来说,AGLKContext仅仅添加了一个clearColor属性和一个用来告诉OpenGL ES去设置在上下文的帧缓存中的每一个像素颜色为clearColor的元素值的“-clear”方法。
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite)
17 | GLKVector4 clearColor;
18 |
19 | - (void)clear:(GLbitfield)mask;
20 | - (void)enable:(GLenum)capability;
21 | - (void)disable:(GLenum)capability;
22 | - (void)setBlendSourceFunction:(GLenum)sfactor
23 | destinationFunction:(GLenum)dfactor;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch2_3
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch2_3
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @class AGLKVertexAttribArrayBuffer;
12 | @interface ViewController : GLKViewController
13 | {
14 | AGLKVertexAttribArrayBuffer *vertexBuffer;
15 | }
16 |
17 | @property (strong, nonatomic) GLKBaseEffect
18 | *baseEffect;
19 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer
20 | *vertexBuffer;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch2_3/OpenGLES_Ch2_3/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch2_3
4 | //
5 | // Created by frank.Zhang on 21/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 | //总结
18 | /*
19 | *所有的图形iOS应用都包含Core Animation层。所有的绘图都发生在层之上。Core Aniamtion合成器会混合当前应用与操作系统的层,从而在OpenGL ES 后帧缓存中产生最终的像素颜色,之后Core Animation合成器切换前后缓存以便把合成的内容显示到屏幕上。
20 | 原生iOS应用程序使用的是苹果的Cocoa Touch框架,并且Xcode IDE组建而成,由Xcode生成的main.m文件包含Cocoa Touch应用结构和从storyboard文件中加载的用户界面代码。一个标准的Cocoa Touch对象集合会提供iOS应用的所有功能,特定于某一个应用的功能是通过修改在标准应用结构中的应用委托或者根视图控制器对象来实现的,复杂的应用会向Xcode工程添加很多额外文件。
21 | 使用OpenGL ES 的Cocoa Touch应用要么使用Core Animation层配置一个与一个OpenGL ES 的帧缓存分享内容的自定义UIView以处理细节,因此开发者很少会从新创建UIView的子类,一个OpenGL ES 上下文会存储当前OpenGL ES 的状态,并控制GPU硬件,每个GLKView实例都需要一个上下文。
22 | 本章中的OpenGLES_Ch2_1例子为接下来的例子奠定了基础,所有本例专有的代码都是在OpenGLES_Ch2_1ViewController类中实现的。应用的storyboard文件指定了GLKView实例,这个实例使用根视图控制器作为委托。委托会接受来自其他对象的消息。并在响应中执行特定应用的操作或者控制其他对象。
23 | 例子中OpenGLES_Ch2_1ViewControlle类的实现包含3个方法:一个会在视图从storyboard文件中加载时被自动调用,一个会在每次视图需要被重绘时被自动调用,还有一个会在视图卸载时被自动调用,这三个方法分别通过创建必要的上下文和顶点缓存来初始化OpenGL ES,使用上下而未能和顶点缓存在GLKView的与Core Animation层分享内存的帧缓存中绘图,并删除上下文和顶点缓存。
24 | GLKBaseEffect类隐藏了iOS所支持的OpenGL ES 版本之间的很多不同,当使用OpenGL ES 2.0的时候,GLKBaseEffect会生成直接在GPU上运行的Shanding Language程序GLKBaseEffect使程序员专注于应用的功能和图形概念,而无需学习Shanding Language。
25 | 本例子把OpenGL_Ch2_1例子中的OpenGL ES 函数调用重构AGLKVertexAttribArrayBuffer类和AGLKContext类。
26 | **/
27 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_1/.DS_Store
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_1.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_1.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1E8D8AB1206381630005DFA0
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_1/OpenGLES_Ch3_1/.DS_Store
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_1
4 | //
5 | // Created by frank.Zhang on 22/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite)
16 | GLKVector4 clearColor;
17 | -(void)clear:(GLbitfield)mask;
18 | -(void)enable:(GLenum)capability;
19 | -(void)disable:(GLenum)capability;
20 | -(void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
21 |
22 | @end
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch3_1
4 | //
5 | // Created by frank.Zhang on 22/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 |
13 | -(void)setClearColor:(GLKVector4)clearColorRGBA{
14 | clearColor = clearColorRGBA;
15 | NSAssert(self == [[self class] currentContext],
16 | @"Receiving context required to be current context");
17 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
18 | }
19 |
20 | -(GLKVector4)clearColor{
21 | return clearColor;
22 | }
23 |
24 | -(void)clear:(GLbitfield)mask{
25 | NSAssert(self == [[self class] currentContext],
26 | @"Receiving context required to be current context");
27 | glClear(mask);
28 | }
29 |
30 | -(void)enable:(GLenum)capability{
31 | NSAssert(self == [[self class] currentContext],
32 | @"Receiving context required to be current context");
33 | glDisable(capability);
34 | }
35 |
36 | -(void)disable:(GLenum)capability{
37 | NSAssert(self == [[self class] currentContext],
38 | @"Receiving context required to be current context");
39 | glDisable(capability);
40 | }
41 |
42 | -(void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
43 | glBlendFunc(sfactor, dfactor);
44 | }
45 | @end
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_1
4 | //
5 | // Created by frank.Zhang on 22/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_1
4 | //
5 | // Created by frank.Zhang on 22/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | @class AGLKVertexAttribArrayBuffer;
12 | @interface ViewController : GLKViewController
13 | {
14 |
15 | }
16 |
17 | @property (strong, nonatomic) GLKBaseEffect
18 | *baseEffect;
19 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer
20 | *vertexBuffer;
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/leaves.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_1/OpenGLES_Ch3_1/leaves.gif
--------------------------------------------------------------------------------
/OpenGLES_Ch3_1/OpenGLES_Ch3_1/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_1
4 | //
5 | // Created by frank.Zhang on 22/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/project.xcworkspace/xcuserdata/zhangfangtao.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_2.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2.xcodeproj/xcuserdata/zhangfangtao.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_2.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @interface AGLKContext : EAGLContext
11 | {
12 | GLKVector4 clearColor;
13 | }
14 | @property(nonatomic,assign,readwrite) GLKVector4 clearColor;
15 | -(void)clear:(GLbitfield)mask;
16 | -(void)enable:(GLenum)captibility;
17 | -(void)disable:(GLenum)captibility;
18 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
19 | @end
20 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | -(void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext],
15 | @"Receiving context required to be current context");
16 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
17 | }
18 |
19 | -(GLKVector4)clearColor{
20 | return clearColor;
21 | }
22 |
23 | -(void)clear:(GLbitfield)mask{
24 | NSAssert(self == [[self class] currentContext],
25 | @"Receiving context required to be current context");
26 | glClear(mask);
27 | }
28 |
29 | -(void)enable:(GLenum)captibility{
30 | NSAssert(self == [[self class] currentContext],
31 | @"Receiving context required to be current context");
32 | glEnable(captibility);
33 | }
34 |
35 | -(void)disable:(GLenum)captibility{
36 | NSAssert(self == [[self class] currentContext],
37 | @"Receiving context required to be current context");
38 | glDisable(captibility);
39 | }
40 |
41 | -(void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
42 | glBlendFunc(sfactor, dfactor);
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/AGLKTextureLoader.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKTextureLoader.h
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #pragma mark -AGLKTextureInfo
12 | /*
13 | AGLKTextureInfo是一个封装了纹理缓存的有用信息的简单类,例如响应的OpenGL ES 纹理缓存的标识符以及纹理的图像尺寸。AGLKTextureLoader只声明了一个方法:"+ (AGLKTextureInfo *)textureWithCGImage:(CGImageRef)cgImage options:(NSDictionary *)options error:(NSError **)outError;"
14 | */
15 | @interface AGLKTextureInfo: NSObject
16 | {
17 | @private
18 | GLuint name;
19 | GLenum target;
20 | GLuint width;
21 | GLuint height;
22 | }
23 |
24 | @property (nonatomic, readwrite) GLuint name;
25 | @property (nonatomic, readwrite) GLenum target;
26 | @property (nonatomic, readwrite) GLuint width;
27 | @property (nonatomic, readwrite) GLuint height;
28 | @end
29 |
30 | #pragma mark -AGLKTextureLoader
31 | @interface AGLKTextureLoader : NSObject
32 | + (AGLKTextureInfo *)textureWithCGImage:(CGImageRef)cgImage options:(NSDictionary *)options error:(NSError **)outError;
33 | @end
34 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @interface ViewController : GLKViewController
12 | {
13 |
14 | }
15 | @property (nonatomic, strong) GLKBaseEffect*baseEffect;
16 | @property (nonatomic,strong) AGLKVertexAttribArrayBuffer *vertexBuffer;
17 | @end
18 |
19 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/leaves.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_2/OpenGLES_Ch3_2/leaves.gif
--------------------------------------------------------------------------------
/OpenGLES_Ch3_2/OpenGLES_Ch3_2/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_2
4 | //
5 | // Created by frank.Zhang on 23/03/2018.
6 | // Copyright © 2018 Frank.Zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/Default-568h@2x.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_3.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_3
4 | //
5 | // Created by frank.zhang on 2019/1/16.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite)
17 | GLKVector4 clearColor;
18 |
19 | - (void)clear:(GLbitfield)mask;
20 | - (void)enable:(GLenum)capability;
21 | - (void)disable:(GLenum)capability;
22 | - (void)setBlendSourceFunction:(GLenum)sfactor
23 | destinationFunction:(GLenum)dfactor;
24 | @end
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_3
4 | //
5 | // Created by frank.zhang on 2019/1/16.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/grid.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "grid.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/grid.imageset/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/grid.imageset/grid.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/leaves.dataset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | },
6 | "data" : [
7 | {
8 | "idiom" : "universal",
9 | "filename" : "leaves.gif"
10 | }
11 | ]
12 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/leaves.dataset/leaves.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/leaves.dataset/leaves.gif
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/leaves.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Assets.xcassets/leaves.gif
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_3
4 | //
5 | // Created by frank.zhang on 2019/1/16.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @interface ViewController : GLKViewController
12 |
13 | {
14 | }
15 |
16 | @property (strong, nonatomic) GLKBaseEffect
17 | *baseEffect;
18 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer
19 | *vertexBuffer;
20 | @property (nonatomic) BOOL
21 | shouldUseLinearFilter;
22 | @property (nonatomic) BOOL
23 | shouldAnimate;
24 | @property (nonatomic) BOOL
25 | shouldRepeatTexture;
26 | @property (nonatomic) GLfloat
27 | sCoordinateOffset;
28 | @end
29 |
30 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGLES_Ch3_3/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_3
4 | //
5 | // Created by frank.zhang on 2019/1/16.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_114x114.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_57x57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_57x57.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/OpenGL_ES_for_iOS_72x72.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/beetle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/beetle.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_3/trail.binary:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_3/trail.binary
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_4.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_4
4 | //
5 | // Created by frank.zhang on 2019/1/17.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic,assign, readwrite) GLKVector4 clearColor;
16 | - (void)clear:(GLbitfield)mask;
17 | - (void)enable:(GLenum)capability;
18 | - (void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor
20 | destinationFunction:(GLenum)dfactor;
21 | @end
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch3_4
4 | //
5 | // Created by frank.zhang on 2019/1/17.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext],
15 | @"Receiving context required to be current context");
16 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
17 | }
18 |
19 | - (GLKVector4)clearColor{
20 | return clearColor;
21 | }
22 |
23 | - (void)clear:(GLbitfield)mask{
24 | NSAssert(self == [[self class] currentContext],
25 | @"Receiving context required to be current context");
26 | glClear(mask);
27 | }
28 |
29 | - (void)enable:(GLenum)capability{
30 | NSAssert(self == [[self class] currentContext],
31 | @"Receiving context required to be current context");
32 | glEnable(capability);
33 | }
34 |
35 | - (void)disable:(GLenum)capability{
36 | NSAssert(self == [[self class] currentContext],
37 | @"Receiving context required to be current context");
38 | glDisable(capability);
39 | }
40 |
41 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
42 | glBlendFunc(sfactor, dfactor);
43 | }
44 | @end
45 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_4
4 | //
5 | // Created by frank.zhang on 2019/1/17.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/beetle.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "beetle.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/beetle.imageset/beetle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/beetle.imageset/beetle.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/leaves.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "leaves.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/leaves.imageset/leaves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Assets.xcassets/leaves.imageset/leaves.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_4
4 | //
5 | // Created by frank.zhang on 2019/1/17.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : GLKViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_4/OpenGLES_Ch3_4/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_4
4 | //
5 | // Created by frank.zhang on 2019/1/17.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_5.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_5
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
16 | -(void)clear:(GLbitfield)mask;
17 | -(void)enable:(GLenum)capability;
18 | -(void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
20 | @end
21 |
22 |
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch3_5
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext],
34 | @"Receiving context required to be current context");
35 | glDisable(capability);
36 | }
37 |
38 | -(void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
39 | glBlendFunc(sfactor, dfactor);
40 | }
41 |
42 | @end
43 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_5
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/beetle.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "beetle.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/beetle.imageset/beetle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/beetle.imageset/beetle.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/leaves.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "leaves.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/leaves.imageset/leaves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Assets.xcassets/leaves.imageset/leaves.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_5
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @interface ViewController : GLKViewController
12 | {
13 |
14 | }
15 | @property (nonatomic, strong) GLKBaseEffect *baseEffect;
16 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexBuffer;
17 |
18 | @end
19 |
20 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_5/OpenGLES_Ch3_5/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_5
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch3_6.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite)
17 | GLKVector4 clearColor;
18 |
19 | - (void)clear:(GLbitfield)mask;
20 | - (void)enable:(GLenum)capability;
21 | - (void)disable:(GLenum)capability;
22 | - (void)setBlendSourceFunction:(GLenum)sfactor
23 | destinationFunction:(GLenum)dfactor;
24 |
25 | @end
26 |
27 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 |
13 | - (void)setClearColor:(GLKVector4)clearColorRGBA
14 | {
15 | clearColor = clearColorRGBA;
16 |
17 | NSAssert(self == [[self class] currentContext],
18 | @"Receiving context required to be current context");
19 |
20 | glClearColor(
21 | clearColorRGBA.r,
22 | clearColorRGBA.g,
23 | clearColorRGBA.b,
24 | clearColorRGBA.a);
25 | }
26 |
27 | - (GLKVector4)clearColor
28 | {
29 | return clearColor;
30 | }
31 |
32 | - (void)clear:(GLbitfield)mask
33 | {
34 | NSAssert(self == [[self class] currentContext],
35 | @"Receiving context required to be current context");
36 |
37 | glClear(mask);
38 | }
39 |
40 | - (void)enable:(GLenum)capability;
41 | {
42 | NSAssert(self == [[self class] currentContext],
43 | @"Receiving context required to be current context");
44 |
45 | glEnable(capability);
46 | }
47 |
48 |
49 | - (void)disable:(GLenum)capability;
50 | {
51 | NSAssert(self == [[self class] currentContext],
52 | @"Receiving context required to be current context");
53 |
54 | glDisable(capability);
55 | }
56 |
57 |
58 | - (void)setBlendSourceFunction:(GLenum)sfactor
59 | destinationFunction:(GLenum)dfactor;
60 | {
61 | glBlendFunc(sfactor, dfactor);
62 | }
63 |
64 | @end
65 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/beetle.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "beetle.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/beetle.imageset/beetle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/beetle.imageset/beetle.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/leaves.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "leaves.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/leaves.imageset/leaves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Assets.xcassets/leaves.imageset/leaves.png
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Shaders/Shader.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // Shader.fsh
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 | /*
9 | 一个片元着色器是一个由GPU执行的,用来完成计算当前渲染缓存中的每个片元的最终红颜色所需要的运算的间断程序。包含偏远着色器程序的文件通常使用".fsh"文件扩展名。
10 | 相比其他的文离婚和配置方法,GL Shading Language程序往往是既剪短又更加自文档化的。但是,OpenGL ES Shading Language是一个复杂到值得用整本书来论述的主题。
11 | */
12 | // UNIFORMS
13 | uniform sampler2D uSampler0;
14 | uniform sampler2D uSampler1;
15 |
16 | // Varyings
17 | varying lowp vec4 vColor;
18 | varying lowp vec2 vTextureCoord0;
19 | varying lowp vec2 vTextureCoord1;
20 |
21 | void main()
22 | {
23 | lowp vec4 color0 = texture2D(uSampler0, vTextureCoord0);
24 | lowp vec4 color1 = texture2D(uSampler1, vTextureCoord1);
25 |
26 | gl_FragColor = mix(color0, color1, color1.a) * vColor;
27 | }
28 |
29 |
30 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/Shaders/Shader.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // Shader.vsh
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 | /*
9 | 多重纹理的强大和灵活性在使用自定义的利用OpenGL ES Shading Language的OpenGL ES 2.0片元程序时会变得更加明显。一个额外的例子,在OpenGLES_Ch3_6中,首先使用一个由GLKit的GLKBaseEffect在后台自动生成的Shading Language程序绘制一个立方体,然后使用下面的自定义定点和片元的Shading Language程序绘制第二个立方体,现在不用担心没有学过Shading Language(截止到目前为止,我对于Shading Language也是不熟悉)。
10 | */
11 |
12 | // VERTEX ATTRIBUTES
13 | attribute vec4 aPosition;
14 | attribute vec3 aNormal;
15 | attribute vec2 aTextureCoord0;
16 | attribute vec2 aTextureCoord1;
17 |
18 | // Varyings
19 | varying lowp vec4 vColor;
20 | varying lowp vec2 vTextureCoord0;
21 | varying lowp vec2 vTextureCoord1;
22 |
23 | // UNIFORMS
24 | uniform mat4 uModelViewProjectionMatrix;
25 | uniform mat3 uNormalMatrix;
26 |
27 | void main()
28 | {
29 | vec3 eyeNormal = normalize(uNormalMatrix * aNormal);
30 | vec3 lightPosition = vec3(0.0, 0.0, 1.0);
31 | vec4 diffuseColor = vec4(0.7, 0.7, 0.7, 1.0);
32 |
33 | float nDotVP = max(0.0, dot(eyeNormal, lightPosition));
34 | vColor = vec4((diffuseColor * nDotVP).xyz, diffuseColor.a);
35 |
36 | vTextureCoord0 = aTextureCoord0.st;
37 | vTextureCoord1 = aTextureCoord1.st;
38 |
39 | gl_Position = uModelViewProjectionMatrix * aPosition;
40 | }
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 |
12 | @interface ViewController : GLKViewController
13 | {
14 | GLuint _program;
15 |
16 | GLKMatrix4 _modelViewProjectionMatrix;
17 | GLKMatrix3 _normalMatrix;
18 | GLfloat _rotation;
19 |
20 | GLuint _vertexArray;
21 | GLuint _vertexBuffer;
22 | GLuint _texture0ID;
23 | GLuint _texture1ID;
24 | }
25 |
26 | @property (strong, nonatomic) GLKBaseEffect
27 | *baseEffect;
28 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer
29 | *vertexBuffer;
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/OpenGLES_Ch3_6/OpenGLES_Ch3_6/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch3_6
4 | //
5 | // Created by frank.zhang on 2019/1/18.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch4_1.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch4_1
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite)
17 | GLKVector4 clearColor;
18 |
19 | - (void)clear:(GLbitfield)mask;
20 | - (void)enable:(GLenum)capability;
21 | - (void)disable:(GLenum)capability;
22 | - (void)setBlendSourceFunction:(GLenum)sfactor
23 | destinationFunction:(GLenum)dfactor;
24 |
25 | @end
26 |
27 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch4_1
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | glDisable(capability);
35 | }
36 |
37 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
38 | glBlendFunc(sfactor, dfactor);
39 | }
40 | @end
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch4_1
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/README.md:
--------------------------------------------------------------------------------
1 | `GLKitde1GLKVector3Normalize(GLKVector3 vectorA)`函数需要多点解释。这个函数的目的是返回一个与矢量A方向相同但是大小等于1.0的单位向量。一个矢量的大小是这个矢量的长度,这个长度可以用标准距离公式$$\sqrt{vectorA.x^2 + vectorA.y^2 + vectorA.z^2}$$计算得到。
2 | 下面的对于`SceneVector3Length()`和`SceneVector3Normalize()`函数的实现与对应的`GLKVector3Length()`和`GLKVector3Normalize()`
3 |
4 |
5 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch4_1
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @interface ViewController : GLKViewController
12 | @property (nonatomic, strong) GLKBaseEffect *baseEffect;
13 | @property (nonatomic, strong) GLKBaseEffect *extraEffect;
14 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexBuffer;
15 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *extraBuffer;
16 | @property (nonatomic, assign) GLfloat centerVertexHeight;
17 | @property (nonatomic, assign) BOOL shouldUseFaceNormals;
18 | @property (nonatomic, assign) BOOL shouldDrawNormals;
19 |
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_1/OpenGLES_Ch4_1/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch4_1
4 | //
5 | // Created by frank.zhang on 2019/1/21.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch4_2.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch4_2
4 | //
5 | // Created by frank.zhang on 2019/1/22.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @interface AGLKContext : EAGLContext
11 | {
12 | GLKVector4 clearColor;
13 | }
14 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
15 | - (void)clear:(GLbitfield)mask;
16 | - (void)enable:(GLenum)capability;
17 | - (void)disable:(GLenum)capability;
18 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
19 | @end
20 |
21 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch4_2
4 | //
5 | // Created by frank.zhang on 2019/1/22.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA
13 | {
14 | clearColor = clearColorRGBA;
15 |
16 | NSAssert(self == [[self class] currentContext],
17 | @"Receiving context required to be current context");
18 |
19 | glClearColor(
20 | clearColorRGBA.r,
21 | clearColorRGBA.g,
22 | clearColorRGBA.b,
23 | clearColorRGBA.a);
24 | }
25 |
26 | - (GLKVector4)clearColor
27 | {
28 | return clearColor;
29 | }
30 |
31 | - (void)clear:(GLbitfield)mask
32 | {
33 | NSAssert(self == [[self class] currentContext],
34 | @"Receiving context required to be current context");
35 |
36 | glClear(mask);
37 | }
38 |
39 | - (void)enable:(GLenum)capability;
40 | {
41 | NSAssert(self == [[self class] currentContext],
42 | @"Receiving context required to be current context");
43 |
44 | glEnable(capability);
45 | }
46 |
47 | - (void)disable:(GLenum)capability;
48 | {
49 | NSAssert(self == [[self class] currentContext],
50 | @"Receiving context required to be current context");
51 |
52 | glDisable(capability);
53 | }
54 |
55 | - (void)setBlendSourceFunction:(GLenum)sfactor
56 | destinationFunction:(GLenum)dfactor;
57 | {
58 | glBlendFunc(sfactor, dfactor);
59 | }
60 |
61 | @end
62 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch4_2
4 | //
5 | // Created by frank.zhang on 2019/1/22.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/Lighting256x256.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Lighting256x256.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/Lighting256x256.imageset/Lighting256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/Lighting256x256.imageset/Lighting256x256.png
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/LightingDetail256x256.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "LightingDetail256x256.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/LightingDetail256x256.imageset/LightingDetail256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Assets.xcassets/LightingDetail256x256.imageset/LightingDetail256x256.png
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch4_2
4 | //
5 | // Created by frank.zhang on 2019/1/22.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 |
12 | @interface ViewController : GLKViewController
13 | @property (strong, nonatomic) GLKBaseEffect *baseEffect;
14 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer *vertexBuffer;
15 | @property (strong, nonatomic) GLKTextureInfo *blandTextureInfo;
16 | @property (strong, nonatomic) GLKTextureInfo *interestingTextureInfo;
17 | @property (nonatomic) BOOL shouldUseDetailLighting;
18 | @end
19 |
20 |
--------------------------------------------------------------------------------
/OpenGLES_Ch4_2/OpenGLES_Ch4_2/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch4_2
4 | //
5 | // Created by frank.zhang on 2019/1/22.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch5_1.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch5_1
4 | //
5 | // Created by frank.zhang on 2019/1/24.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
17 | - (void)clear:(GLbitfield)mask;
18 | - (void)enable:(GLenum)capability;
19 | - (void)disable:(GLenum)capability;
20 | - (void)setBlendSourceFunction:(GLenum)sfactor
21 | destinationFunction:(GLenum)dfactor;
22 | @end
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch5_1
4 | //
5 | // Created by frank.zhang on 2019/1/24.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert([[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert([[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | }
35 |
36 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
37 | glBlendFunc(sfactor, dfactor);
38 | }
39 | @end
40 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch5_1
4 | //
5 | // Created by frank.zhang on 2019/1/24.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Assets.xcassets/Earth512x256.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Earth512x256.jpg",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch5_1
4 | //
5 | // Created by frank.zhang on 2019/1/24.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 |
12 | @interface ViewController : GLKViewController
13 | @property (nonatomic, strong) GLKBaseEffect *baseEffect;
14 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexPositionBuffer;
15 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexNormalBuffer;
16 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexTextureCoordBuffer;
17 |
18 |
19 | @end
20 |
21 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_1/OpenGLES_Ch5_1/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch5_1
4 | //
5 | // Created by frank.zhang on 2019/1/24.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch5_2.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch5_2
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
16 | - (void)clear:(GLbitfield)mask;
17 | - (void)enable:(GLenum)capability;
18 | - (void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch5_2
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | glDisable(capability);
35 | }
36 |
37 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
38 | glBlendFunc(sfactor, dfactor);
39 | }
40 | @end
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch5_2
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Assets.xcassets/Earth512x256.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Earth512x256.jpg",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch5_2
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @interface ViewController : GLKViewController
12 | @property (nonatomic, strong) GLKBaseEffect *baseEffect;
13 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexPositionBuffer;
14 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexNormalBuffer;
15 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexTextureCoordBuffer;
16 |
17 | @end
18 |
19 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_2/OpenGLES_Ch5_2/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch5_2
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch5_3.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 |
16 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
17 | - (void)clear:(GLbitfield)mask;
18 | - (void)enable:(GLenum)capability;
19 | - (void)disable:(GLenum)capability;
20 | - (void)setBlendSourceFunction:(GLenum)sfactor
21 | destinationFunction:(GLenum)dfactor;
22 | @end
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | glDisable(capability);
35 | }
36 |
37 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
38 | glBlendFunc(sfactor, dfactor);
39 | }
40 | @end
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/AGLKView.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKView.h
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | @class EAGLContext;
13 | @protocol AGLKViewDelegate;
14 | typedef enum
15 | {
16 | AGLKViewDrawableDepthFormatNone = 0,
17 | AGLKViewDrawableDepthFormat16,
18 | } AGLKViewDrawableDepthFormat;
19 |
20 | @interface AGLKView : UIView
21 | {
22 | EAGLContext *context;
23 | GLuint defaultFrameBuffer;
24 | GLuint colorRenderBuffer;
25 | GLuint depthRenderBuffer;
26 | GLint drawableWidth;
27 | GLint drawableHeight;
28 | }
29 |
30 | @property (nonatomic, weak) IBOutlet id
31 | delegate;
32 | @property (nonatomic, strong) EAGLContext *context;
33 | @property (nonatomic, readonly) NSInteger drawableWidth;
34 | @property (nonatomic, readonly) NSInteger drawableHeight;
35 | @property (nonatomic) AGLKViewDrawableDepthFormat
36 | drawableDepthFormat;
37 |
38 | - (void)display;
39 |
40 | @end
41 |
42 |
43 | #pragma mark - AGLKViewDelegate
44 |
45 | @protocol AGLKViewDelegate
46 |
47 | @required
48 | - (void)glkView:(AGLKView *)view drawInRect:(CGRect)rect;
49 |
50 | @end
51 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/AGLKViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKViewController.h
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AGLKView.h"
11 |
12 | @class CADisplayLink;
13 |
14 |
15 | @interface AGLKViewController : UIViewController
16 |
17 | {
18 | CADisplayLink *displayLink;
19 | NSInteger preferredFramesPerSecond;
20 | }
21 |
22 | @property (nonatomic) NSInteger preferredFramesPerSecond;
23 | @property (nonatomic, readonly) NSInteger framesPerSecond;
24 | @property (nonatomic, getter=isPaused) BOOL paused;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Assets.xcassets/Earth512x256.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "Earth512x256.jpg",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Assets.xcassets/Earth512x256.imageset/Earth512x256.jpg
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AGLKViewController.h"
11 |
12 | @class AGLKVertexAttribArrayBuffer;
13 | @interface ViewController : AGLKViewController
14 | @property (strong, nonatomic) GLKBaseEffect *baseEffect;
15 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer *vertexPositionBuffer;
16 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer *vertexNormalBuffer;
17 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer *vertexTextureCoordBuffer;
18 |
19 | @end
20 |
21 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_3/OpenGLES_Ch5_3/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch5_3
4 | //
5 | // Created by frank.zhang on 2019/1/25.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch5_4.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch5_4
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
16 | -(void)clear:(GLbitfield)mask;
17 | -(void)enable:(GLenum)capability;
18 | -(void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
20 | @end
21 |
22 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch5_4
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self ==[[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | glDisable(capability);
35 | }
36 |
37 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
38 | glBlendFunc(sfactor, dfactor);
39 | }
40 | @end
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch5_4
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch5_4
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | typedef enum {
12 | SceneTranslate = 0,
13 | SceneRotate,
14 | SceneScale,
15 | }SceneTransformationSelector;
16 |
17 | typedef enum {
18 | SceneXAxis = 0,
19 | SceneYAxis,
20 | SceneZAxis,
21 | }SceneTransformationAxisSelector;
22 |
23 | @interface ViewController : GLKViewController
24 | {
25 | SceneTransformationSelector transform1Type;
26 | SceneTransformationAxisSelector transform1Axis;
27 | float transform1Value;
28 | SceneTransformationSelector transform2Type;
29 | SceneTransformationAxisSelector transform2Axis;
30 | float transform2Value;
31 | SceneTransformationSelector transform3Type;
32 | SceneTransformationAxisSelector transform3Axis;
33 | float transform3Value;
34 | }
35 | @property (nonatomic, strong) GLKBaseEffect *baseEffect;
36 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexPositionBuffer;
37 | @property (nonatomic, strong) AGLKVertexAttribArrayBuffer *vertexNormalBuffer;
38 |
39 | @end
40 |
41 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_4/OpenGLES_Ch5_4/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch5_4
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_5/OpenGLES_Ch5_5.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch5_5.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
16 | - (void)clear:(GLbitfield)mask;
17 | - (void)enable:(GLenum)capability;
18 | - (void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor;
20 | @end
21 |
22 |
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
15 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
16 | }
17 |
18 | - (GLKVector4)clearColor{
19 | return clearColor;
20 | }
21 |
22 | - (void)clear:(GLbitfield)mask{
23 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
24 | glClear(mask);
25 | }
26 |
27 | - (void)enable:(GLenum)capability{
28 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
29 | glEnable(capability);
30 | }
31 |
32 | - (void)disable:(GLenum)capability{
33 | NSAssert(self == [[self class] currentContext], @"Receiving context required to be current context");
34 | glDisable(capability);
35 | }
36 |
37 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
38 | glBlendFunc(sfactor, dfactor);
39 | }
40 |
41 | @end
42 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/AGLKTextureTransformBaseEffect.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKTextureTransformBaseEffect.h
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKTextureTransformBaseEffect : GLKBaseEffect
12 | @property (assign) GLKVector4 light0Position;
13 | @property (assign) GLKVector3 light0SpotDirection;
14 | @property (assign) GLKVector4 light1Position;
15 | @property (assign) GLKVector3 light1SpotDirection;
16 | @property (assign) GLKVector4 light2Position;
17 | @property (nonatomic, assign) GLKMatrix4 textureMatrix2d0;
18 | @property (nonatomic, assign) GLKMatrix4 textureMatrix2d1;
19 | - (void)prepareToDrawMultitextures;
20 | @end
21 |
22 | @interface GLKEffectPropertyTexture (AGLKAdditions)
23 | - (void)aglkSetParameter:(GLenum)parameterID
24 | value:(GLint)value;
25 | @end
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/beetle.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "beetle.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/beetle.imageset/beetle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/beetle.imageset/beetle.png
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/leaves.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "scale" : "1x"
6 | },
7 | {
8 | "idiom" : "universal",
9 | "filename" : "leaves.png",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "version" : 1,
19 | "author" : "xcode"
20 | }
21 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/leaves.imageset/leaves.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Assets.xcassets/leaves.imageset/leaves.png
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @class AGLKTextureTransformBaseEffect;
12 | @interface ViewController : GLKViewController
13 | @property (strong, nonatomic) AGLKTextureTransformBaseEffect
14 | *baseEffect;
15 | @property (strong, nonatomic) AGLKVertexAttribArrayBuffer
16 | *vertexBuffer;
17 | @property (nonatomic) float
18 | textureScaleFactor;
19 | @property (nonatomic) float
20 | textureAngle;
21 | @property (nonatomic) GLKMatrixStackRef
22 | textureMatrixStack;
23 |
24 | @end
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch5_5/OpenGLES_Ch5_5/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch5_5
4 | //
5 | // Created by frank.zhang on 2019/1/28.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch6_1/OpenGLES_Ch6_1.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch6_1.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, assign, readwrite) GLKVector4 clearColor;
16 | - (void)clear:(GLbitfield)mask;
17 | - (void)enable:(GLenum)capability;
18 | - (void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor
20 | destinationFunction:(GLenum)dfactor;
21 | @end
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | -(void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext],
15 | @"Receiving context required to be current context");
16 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
17 | }
18 |
19 | - (GLKVector4)clearColor{
20 | return clearColor;
21 | }
22 |
23 | - (void)clear:(GLbitfield)mask{
24 | NSAssert(self == [[self class] currentContext],
25 | @"Receiving context required to be current context");
26 | glClear(mask);
27 | }
28 |
29 | - (void)enable:(GLenum)capability{
30 | NSAssert(self == [[self class] currentContext],
31 | @"Receiving context required to be current context");
32 | glEnable(capability);
33 | }
34 |
35 | - (void)disable:(GLenum)capability{
36 | NSAssert(self == [[self class] currentContext],
37 | @"Receiving context required to be current context");
38 | glDisable(capability);
39 | }
40 |
41 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
42 | glBlendFunc(sfactor, dfactor);
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneCarModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneCarModel.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "SceneModel.h"
10 |
11 |
12 | @interface SceneCarModel : SceneModel
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneCarModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SceneCarModel.m
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "SceneCarModel.h"
10 | #import "SceneMesh.h"
11 | #import "bumperCar.h"
12 | #import "AGLKVertexAttribArrayBuffer.h"
13 | @implementation SceneCarModel
14 | - (id)init
15 | {
16 | SceneMesh *carMesh = [[SceneMesh alloc]
17 | initWithPositionCoords:bumperCarVerts
18 | normalCoords:bumperCarNormals
19 | texCoords0:NULL
20 | numberOfPositions:bumperCarNumVerts
21 | indices:NULL
22 | numberOfIndices:0];
23 | if(nil != (self = [super initWithName:@"bumberCar"
24 | mesh:carMesh
25 | numberOfVertices:bumperCarNumVerts]))
26 | {
27 | [self updateAlignedBoundingBoxForVertices:bumperCarVerts
28 | count:bumperCarNumVerts];
29 | }
30 |
31 | return self;
32 | }
33 | @end
34 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneMesh.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneMesh.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | typedef struct {
11 | GLKVector3 position;
12 | GLKVector3 normal;
13 | GLKVector2 texCoords0;
14 | }SceneMeshVertex;
15 | @interface SceneMesh : NSObject
16 |
17 | - (id)initWithVertexAttributeData:(NSData *)vertexAttributes
18 | indexData:(NSData *)indices;
19 |
20 | - (id)initWithPositionCoords:(const GLfloat *)somePositions
21 | normalCoords:(const GLfloat *)someNormals
22 | texCoords0:(const GLfloat *)someTexCoords0
23 | numberOfPositions:(size_t)countPositions
24 | indices:(const GLushort *)someIndices
25 | numberOfIndices:(size_t)countIndices;
26 |
27 | - (void)prepareToDraw;
28 |
29 | - (void)drawUnidexedWithMode:(GLenum)mode
30 | startVertexIndex:(GLint)first
31 | numberOfVertices:(GLsizei)count;
32 |
33 | - (void)makeDynamicAndUpdateWithVertices:
34 | (const SceneMeshVertex *)someVerts
35 | numberOfVertices:(size_t)count;
36 | @end
37 |
38 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneModel.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | @class AGLKVertexAttribArrayBuffer;
11 | @class SceneMesh;
12 | typedef struct {
13 | GLKVector3 min;
14 | GLKVector3 max;
15 | }SceneAxisAllignedBoundingBox;
16 | @interface SceneModel : NSObject
17 | @property (nonatomic, copy, readonly) NSString *name;
18 | @property (nonatomic, assign, readonly) SceneAxisAllignedBoundingBox axisAlignedBoundingBox;
19 | - (id)initWithName:(NSString *)aName mesh:(SceneMesh *)aMesh numberOfVertices:(GLsizei)aCount;
20 | - (void)draw;
21 | - (void)updateAlignedBoundingBoxForVertices:(float *)verts count:(unsigned int)aCount;
22 | @end
23 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneRinkModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneRinkModel.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "SceneModel.h"
10 |
11 | @interface SceneRinkModel : SceneModel
12 |
13 | @end
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/SceneRinkModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SceneRinkModel.m
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "SceneRinkModel.h"
10 | #import "SceneMesh.h"
11 | #import "bumperRink.h"
12 | #import "AGLKVertexAttribArrayBuffer.h"
13 |
14 | @implementation SceneRinkModel
15 | - (id)init
16 | {
17 | SceneMesh *rinkMesh = [[SceneMesh alloc]
18 | initWithPositionCoords:bumperRinkVerts
19 | normalCoords:bumperRinkNormals
20 | texCoords0:NULL
21 | numberOfPositions:bumperRinkNumVerts
22 | indices:NULL
23 | numberOfIndices:0];
24 | if(nil != (self = [super initWithName:@"bumberRink"
25 | mesh:rinkMesh
26 | numberOfVertices:bumperRinkNumVerts]))
27 | {
28 | [self updateAlignedBoundingBoxForVertices:bumperRinkVerts
29 | count:bumperRinkNumVerts];
30 | }
31 | return self;
32 | }
33 | @end
34 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SceneCar.h"
11 | @interface ViewController : GLKViewController
12 | @property (nonatomic, strong, readonly) NSArray *cars;
13 | @property (nonatomic, assign, readonly) SceneAxisAllignedBoundingBox rinkBoundingBox;
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_1/OpenGLES_Ch6_1/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch6_1
4 | //
5 | // Created by frank.zhang on 2019/2/12.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhangfangtaozft/OpenGL-ES-iOS/739d91b8f0a778c2dc1feef021dce98a1f66b3e0/OpenGLES_Ch6_2/OpenGLES_Ch6_2.xcodeproj/project.xcworkspace/xcuserdata/frank.zhang.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2.xcodeproj/xcuserdata/frank.zhang.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | OpenGLES_Ch6_2.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/AGLKContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.h
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AGLKContext : EAGLContext
12 | {
13 | GLKVector4 clearColor;
14 | }
15 | @property (nonatomic, readwrite) GLKVector4 clearColor;
16 | - (void)clear:(GLbitfield)mask;
17 | - (void)enable:(GLenum)capability;
18 | - (void)disable:(GLenum)capability;
19 | - (void)setBlendSourceFunction:(GLenum)sfactor
20 | destinationFunction:(GLenum)dfactor;
21 | @end
22 |
23 |
24 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/AGLKContext.m:
--------------------------------------------------------------------------------
1 | //
2 | // AGLKContext.m
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "AGLKContext.h"
10 |
11 | @implementation AGLKContext
12 | - (void)setClearColor:(GLKVector4)clearColorRGBA{
13 | clearColor = clearColorRGBA;
14 | NSAssert(self == [[self class] currentContext],
15 | @"Receiving context required to be current context");
16 | glClearColor(clearColorRGBA.r, clearColorRGBA.g, clearColorRGBA.b, clearColorRGBA.a);
17 | }
18 |
19 | - (GLKVector4)clearColor{
20 | return clearColor;
21 | }
22 |
23 | - (void)clear:(GLbitfield)mask{
24 | NSAssert(self == [[self class] currentContext],
25 | @"Receiving context required to be current context");
26 | glClear(mask);
27 | }
28 |
29 | - (void)enable:(GLenum)capability{
30 | NSAssert(self == [[self class] currentContext],
31 | @"Receiving context required to be current context");
32 | glEnable(capability);
33 | }
34 |
35 | - (void)disable:(GLenum)capability{
36 | NSAssert(self == [[self class] currentContext],
37 | @"Receiving context required to be current context");
38 | glDisable(capability);
39 | }
40 |
41 | - (void)setBlendSourceFunction:(GLenum)sfactor destinationFunction:(GLenum)dfactor{
42 | glBlendFunc(sfactor, dfactor);
43 | }
44 | @end
45 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/SceneAnimatedMesh.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneAnimatedMesh.h
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import "SceneMesh.h"
10 |
11 |
12 | @interface SceneAnimatedMesh : SceneMesh
13 | - (void)drawEntireMesh;
14 | - (void)updateMeshWithDefaultPositions;
15 | - (void)updateMeshWithElapsedTime:(NSTimeInterval)anInterval;
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/SceneMesh.h:
--------------------------------------------------------------------------------
1 | //
2 | // SceneMesh.h
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | typedef struct {
12 | GLKVector3 position;
13 | GLKVector3 normal;
14 | GLKVector2 texCoords0;
15 | }SceneMeshVertex;
16 |
17 | @interface SceneMesh : NSObject
18 | - (id)initWithVertexAttributeData:(NSData *)vertexAttributes
19 | indexData:(NSData *)indices;
20 |
21 | - (id)initWithPositionCoords:(const GLfloat *)somePositions
22 | normalCoords:(const GLfloat *)someNormals
23 | texCoords0:(const GLfloat *)someTexCoords0
24 | numberOfPositions:(size_t)countPositions
25 | indices:(const GLushort *)someIndices
26 | numberOfIndices:(size_t)countIndices;
27 |
28 | - (void)prepareToDraw;
29 |
30 | - (void)drawUnidexedWithMode:(GLenum)mode
31 | startVertexIndex:(GLint)first
32 | numberOfVertices:(GLsizei)count;
33 |
34 | - (void)makeDynamicAndUpdateWithVertices:
35 | (const SceneMeshVertex *)someVerts
36 | numberOfVertices:(size_t)count;
37 | @end
38 |
39 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : GLKViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/OpenGLES_Ch6_2/OpenGLES_Ch6_2/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // OpenGLES_Ch6_2
4 | //
5 | // Created by frank.zhang on 2019/2/13.
6 | // Copyright © 2019 Frank.zhang. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OpenGL-ES-iOS
2 | 《OpenGL ES应用开发实践指南:iOS卷》代码解析,看这个就不用怎么看书了,注释特别详细,适合初学者
3 | # 简介
4 | 首先我做这个是为了自己学习用的,不过个人习惯的原因,喜欢把自己学过的东西放到网上来,让大家也可以看到。希望我整理的资料可以帮到大家。
5 | # 目录
6 | 每一个demo代码都是做什么的?下面给大家介绍一下,当然,我后期打算把自己学到的东西再加上博客说明。
7 |
--------------------------------------------------------------------------------