Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: remoting/client/ios/example_view_controller.mm

Issue 1763783002: Staging an example iOS project to be the dummy target for CRD iOS App. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct comment label. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/ios/example_view_controller.h ('k') | remoting/client/ios/main.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/ios/example_view_controller.mm
diff --git a/remoting/client/ios/example_view_controller.mm b/remoting/client/ios/example_view_controller.mm
new file mode 100644
index 0000000000000000000000000000000000000000..43651d2454d3762a744ae677ceaf39757e985eeb
--- /dev/null
+++ b/remoting/client/ios/example_view_controller.mm
@@ -0,0 +1,76 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+#import "remoting/client/ios/example_view_controller.h"
+
+#import "remoting/client/opengl_wrapper.h"
+
+@interface ExampleViewController()
+
+// Helper functions dealing with the GL Context.
+- (void)setupGL;
+- (void)tearDownGL;
+
+@end
+
+@implementation ExampleViewController
+
+#pragma mark - UIViewController
+
+- (void)viewDidLoad {
+ [super viewDidLoad];
+
+ _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ static_cast<GLKView*>(self.view).context = _context;
+
+ [self setupGL];
+}
+
+- (void)viewDidUnload {
+ [super viewDidUnload];
+ [self tearDownGL];
+
+ if ([EAGLContext currentContext] == _context) {
+ [EAGLContext setCurrentContext:nil];
+ }
+ _context = nil;
+}
+
+- (void)setupGL {
+ [EAGLContext setCurrentContext:_context];
+}
+
+- (void)tearDownGL {
+ [EAGLContext setCurrentContext:_context];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+ [super viewWillAppear:animated];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+ [super viewWillDisappear:NO];
+}
+
+- (void)viewDidLayoutSubviews {
+ [super viewDidLayoutSubviews];
+}
+
+#pragma mark - GLKViewDelegate
+
+// In general, avoid expensive work in this function to maximize frame rate.
+- (void)glkView:(GLKView*)view drawInRect:(CGRect)rect {
+ // Clear to give the background color.
+ glClearColor(0.0, 40.0, 0.0, 1.0);
+ glClear(GL_COLOR_BUFFER_BIT);
+}
+
+@end
« no previous file with comments | « remoting/client/ios/example_view_controller.h ('k') | remoting/client/ios/main.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698