Index: remoting/client/ios/app/example_view_controller.mm |
diff --git a/remoting/client/ios/example_view_controller.mm b/remoting/client/ios/app/example_view_controller.mm |
similarity index 56% |
rename from remoting/client/ios/example_view_controller.mm |
rename to remoting/client/ios/app/example_view_controller.mm |
index 64fd9ac678507e7b0ce1e1106a22e9d0b700f695..a4e3b382aee47a50eb56d190ef99b9f36a5f90da 100644 |
--- a/remoting/client/ios/example_view_controller.mm |
+++ b/remoting/client/ios/app/example_view_controller.mm |
@@ -1,4 +1,4 @@ |
-// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Copyright 2017 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. |
@@ -6,11 +6,16 @@ |
#error "This file requires ARC support." |
#endif |
-#import "remoting/client/ios/example_view_controller.h" |
+#import "remoting/client/ios/app/example_view_controller.h" |
#import "remoting/client/display/sys_opengl.h" |
-@interface ExampleViewController() |
+#include "base/message_loop/message_loop.h" |
+#include "remoting/protocol/frame_stats.h" |
+#include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
+#include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
+ |
+@interface ExampleViewController () |
// Helper functions dealing with the GL Context. |
- (void)setupGL; |
@@ -24,10 +29,12 @@ |
- (void)viewDidLoad { |
[super viewDidLoad]; |
- |
- _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2]; |
+ _gestures = [[ClientGestures alloc] initWithView:self.view]; |
+ // TODO(nicholss): For prod code, make sure to check for ES3 support and |
+ // fall back to ES2 if needed. |
+ _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; |
+ _runtime = new remoting::ios::AppRuntime(); |
static_cast<GLKView*>(self.view).context = _context; |
- |
[self setupGL]; |
} |
@@ -42,11 +49,12 @@ |
} |
- (void)setupGL { |
- [EAGLContext setCurrentContext:_context]; |
+ _display_handler = [[GlDisplayHandler alloc] initWithRuntime:_runtime]; |
+ [_display_handler created]; |
} |
- (void)tearDownGL { |
- [EAGLContext setCurrentContext:_context]; |
+ // TODO(nicholss): Implement this in a real application. |
} |
- (void)viewWillAppear:(BOOL)animated { |
@@ -54,6 +62,9 @@ |
} |
- (void)viewDidAppear:(BOOL)animated { |
+ _video_renderer = |
+ (remoting::SoftwareVideoRenderer*)[_display_handler CreateVideoRenderer] |
+ .get(); |
} |
- (void)viewWillDisappear:(BOOL)animated { |
@@ -68,9 +79,9 @@ |
// 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); |
+ if (_display_handler) { |
+ [_display_handler glkView:view drawInRect:rect]; |
+ } |
} |
@end |