Index: remoting/client/ios/app/host_view_controller.mm |
diff --git a/remoting/client/ios/app/host_view_controller.mm b/remoting/client/ios/app/host_view_controller.mm |
index 17e1a45f1e61c6a886a9abbbcde7ab6325c1e602..99245b5ce206b75ee361d33bc43d433d6bc0e976 100644 |
--- a/remoting/client/ios/app/host_view_controller.mm |
+++ b/remoting/client/ios/app/host_view_controller.mm |
@@ -8,6 +8,8 @@ |
#import "remoting/client/ios/app/host_view_controller.h" |
+#import <GLKit/GLKit.h> |
+ |
#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" |
#import "remoting/client/ios/session/remoting_client.h" |
@@ -15,6 +17,7 @@ static const CGFloat kFabInset = 15.f; |
@interface HostViewController () { |
RemotingClient* _client; |
+ GLKView* _gl_view; |
nicholss
2017/05/01 16:20:14
Why do you need the gl view to be subview and not
Yuwei
2017/05/01 20:58:08
I just thought it is easier to reuse the UIViewCon
|
} |
@end |
@@ -48,6 +51,9 @@ static const CGFloat kFabInset = 15.f; |
self.view.frame.size.height - btnSize.height - kFabInset, |
btnSize.width, btnSize.height); |
+ _gl_view = [[GLKView alloc] initWithFrame:self.view.bounds]; |
nicholss
2017/05/01 16:20:14
Views in init should be created with CGRectZero an
Yuwei
2017/05/01 20:58:08
Done. I also needed to fix floatingButton by doing
|
+ _gl_view.enableSetNeedsDisplay = true; |
nicholss
2017/05/01 16:20:14
This should move out of the init, you do not know
Yuwei
2017/05/01 20:58:08
Done.
|
+ [self.view addSubview:_gl_view]; |
[self.view addSubview:floatingButton]; |
} |
@@ -62,20 +68,17 @@ static const CGFloat kFabInset = 15.f; |
- (void)viewDidAppear:(BOOL)animated { |
[super viewDidAppear:animated]; |
- GLKView* view = (GLKView*)self.view; |
- view.context = [_client.displayHandler GetEAGLContext]; |
+ _gl_view.context = [_client.displayHandler GetEAGLContext]; |
+ [_client.displayHandler onSurfaceCreated:_gl_view]; |
+ |
+ // TODO(yuweih): Hande new frame when screen rotated. |
+ [_client.displayHandler onSurfaceChanged:_gl_view.frame]; |
} |
- (void)viewWillDisappear:(BOOL)animated { |
[super viewWillDisappear:animated]; |
} |
-#pragma mark - GLKViewDelegate |
- |
-- (void)glkView:(GLKView*)view drawInRect:(CGRect)rect { |
- // Nothing to do that is synchronous yet. |
-} |
- |
#pragma mark - Private |
- (void)didTap:(id)sender { |