This repository was archived by the owner on May 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 800
Expand file tree
/
Copy pathHelloGLKit.mm
More file actions
66 lines (55 loc) · 2.13 KB
/
Copy pathHelloGLKit.mm
File metadata and controls
66 lines (55 loc) · 2.13 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//******************************************************************************
//
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "GLRenderer.h"
@interface HelloGLKitApp : NSObject {
UIWindow* _mainWindow;
GLRenderer* _renderer;
}
@end
@implementation HelloGLKitApp
-(void) applicationDidFinishLaunching: (UIApplication *) app {
CGRect bounds = [[UIScreen mainScreen] bounds];
_mainWindow = [[UIWindow alloc] initWithFrame: bounds];
EAGLContext* ctx = [[EAGLContext alloc] initWithAPI: kEAGLRenderingAPIOpenGLES2];
[EAGLContext setCurrentContext: ctx];
_renderer = [[GLRenderer alloc] init];
[_renderer initGLData];
GLKView* view = [[GLKView alloc] initWithFrame: bounds];
view.context = ctx;
view.delegate = _renderer;
view.drawableDepthFormat = GLKViewDrawableDepthFormat16;
GLKViewController* ctl = [[GLKViewController alloc] initWithNibName: nil bundle: nil];
ctl.view = view;
ctl.delegate = _renderer;
ctl.preferredFramesPerSecond = 60;
_mainWindow.rootViewController = ctl;
[_mainWindow makeKeyAndVisible];
}
@end
#ifdef WINOBJC
// Tell the WinObjC runtime how large to render the application
@implementation UIApplication(UIApplicationInitialStartupMode)
+(void) setStartupDisplayMode: (WOCDisplayMode *) mode {
mode.autoMagnification = TRUE;
mode.sizeUIWindowToFit = TRUE;
mode.fixedWidth = 0;
mode.fixedHeight = 0;
mode.magnification = 1.0;
}
@end
#endif