| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/android/vr_shell/vr_shell.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "chrome/browser/android/vr_shell/ui_elements.h" | 8 #include "chrome/browser/android/vr_shell/ui_elements.h" |
| 9 #include "chrome/browser/android/vr_shell/ui_interface.h" | 9 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 10 #include "chrome/browser/android/vr_shell/ui_scene.h" | 10 #include "chrome/browser/android/vr_shell/ui_scene.h" |
| 11 #include "chrome/browser/android/vr_shell/vr_compositor.h" | 11 #include "chrome/browser/android/vr_shell/vr_compositor.h" |
| 12 #include "chrome/browser/android/vr_shell/vr_controller.h" | 12 #include "chrome/browser/android/vr_shell/vr_controller.h" |
| 13 #include "chrome/browser/android/vr_shell/vr_gl_util.h" | 13 #include "chrome/browser/android/vr_shell/vr_gl_util.h" |
| 14 #include "chrome/browser/android/vr_shell/vr_input_manager.h" | 14 #include "chrome/browser/android/vr_shell/vr_input_manager.h" |
| 15 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" | 15 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h" |
| 16 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h" | 16 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h" |
| 17 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" | 17 #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
| 20 #include "content/public/browser/render_widget_host.h" | 20 #include "content/public/browser/render_widget_host.h" |
| 21 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/common/referrer.h" | 23 #include "content/public/common/referrer.h" |
| 24 #include "content/public/common/screen_info.h" | 24 #include "content/public/common/screen_info.h" |
| 25 #include "device/vr/android/gvr/gvr_device_provider.h" |
| 25 #include "jni/VrShellImpl_jni.h" | 26 #include "jni/VrShellImpl_jni.h" |
| 26 #include "ui/android/view_android.h" | 27 #include "ui/android/view_android.h" |
| 27 #include "ui/android/window_android.h" | 28 #include "ui/android/window_android.h" |
| 28 #include "ui/base/page_transition_types.h" | 29 #include "ui/base/page_transition_types.h" |
| 29 #include "ui/gl/gl_bindings.h" | 30 #include "ui/gl/gl_bindings.h" |
| 30 #include "ui/gl/init/gl_factory.h" | 31 #include "ui/gl/init/gl_factory.h" |
| 31 | 32 |
| 32 using base::android::JavaParamRef; | 33 using base::android::JavaParamRef; |
| 33 | 34 |
| 34 namespace { | 35 namespace { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 177 } |
| 177 | 178 |
| 178 VrShell::~VrShell() { | 179 VrShell::~VrShell() { |
| 179 g_instance = nullptr; | 180 g_instance = nullptr; |
| 180 gl::init::ClearGLBindings(); | 181 gl::init::ClearGLBindings(); |
| 181 } | 182 } |
| 182 | 183 |
| 183 void VrShell::SetDelegate(JNIEnv* env, | 184 void VrShell::SetDelegate(JNIEnv* env, |
| 184 const base::android::JavaParamRef<jobject>& obj, | 185 const base::android::JavaParamRef<jobject>& obj, |
| 185 const base::android::JavaParamRef<jobject>& delegate) { | 186 const base::android::JavaParamRef<jobject>& delegate) { |
| 186 delegate_ = VrShellDelegate::getNativeDelegate(env, delegate); | 187 delegate_ = VrShellDelegate::GetNativeDelegate(env, delegate); |
| 187 } | 188 } |
| 188 | 189 |
| 189 enum class ViewerType | 190 enum class ViewerType { |
| 190 { | |
| 191 UNKNOWN_TYPE = 0, | 191 UNKNOWN_TYPE = 0, |
| 192 CARDBOARD = 1, | 192 CARDBOARD = 1, |
| 193 DAYDREAM = 2, | 193 DAYDREAM = 2, |
| 194 VIEWER_TYPE_MAX, | 194 VIEWER_TYPE_MAX, |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 void VrShell::GvrInit(JNIEnv* env, | 197 void VrShell::GvrInit(JNIEnv* env, |
| 198 const JavaParamRef<jobject>& obj, | 198 const JavaParamRef<jobject>& obj, |
| 199 jlong native_gvr_api) { | 199 jlong native_gvr_api) { |
| 200 gvr_api_ = | 200 gvr_api_ = |
| 201 gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(native_gvr_api)); | 201 gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(native_gvr_api)); |
| 202 | 202 |
| 203 if (delegate_) | 203 if (delegate_) |
| 204 delegate_->OnVrShellReady(this); | 204 delegate_->OnVrShellReady(this); |
| 205 controller_.reset( | 205 controller_.reset( |
| 206 new VrController(reinterpret_cast<gvr_context*>(native_gvr_api))); | 206 new VrController(reinterpret_cast<gvr_context*>(native_gvr_api))); |
| 207 content_input_manager_ = new VrInputManager(main_contents_); | 207 content_input_manager_ = new VrInputManager(main_contents_); |
| 208 ui_input_manager_ = new VrInputManager(ui_contents_); | 208 ui_input_manager_ = new VrInputManager(ui_contents_); |
| 209 | 209 |
| 210 ViewerType viewerType; | 210 ViewerType viewerType; |
| 211 switch (gvr_api_->GetViewerType()) | 211 switch (gvr_api_->GetViewerType()) { |
| 212 { | |
| 213 case gvr::ViewerType::GVR_VIEWER_TYPE_DAYDREAM: | 212 case gvr::ViewerType::GVR_VIEWER_TYPE_DAYDREAM: |
| 214 viewerType = ViewerType::DAYDREAM; | 213 viewerType = ViewerType::DAYDREAM; |
| 215 break; | 214 break; |
| 216 case gvr::ViewerType::GVR_VIEWER_TYPE_CARDBOARD: | 215 case gvr::ViewerType::GVR_VIEWER_TYPE_CARDBOARD: |
| 217 viewerType = ViewerType::CARDBOARD; | 216 viewerType = ViewerType::CARDBOARD; |
| 218 break; | 217 break; |
| 219 default: | 218 default: |
| 220 NOTREACHED(); | 219 NOTREACHED(); |
| 221 viewerType = ViewerType::UNKNOWN_TYPE; | 220 viewerType = ViewerType::UNKNOWN_TYPE; |
| 222 break; | 221 break; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 new gvr::BufferViewport(gvr_api_->CreateBufferViewport())); | 263 new gvr::BufferViewport(gvr_api_->CreateBufferViewport())); |
| 265 buffer_viewport_list_->GetBufferViewport(GVR_RIGHT_EYE, | 264 buffer_viewport_list_->GetBufferViewport(GVR_RIGHT_EYE, |
| 266 headlocked_right_viewport_.get()); | 265 headlocked_right_viewport_.get()); |
| 267 headlocked_right_viewport_->SetSourceBufferIndex(kFrameHeadlockedBuffer); | 266 headlocked_right_viewport_->SetSourceBufferIndex(kFrameHeadlockedBuffer); |
| 268 headlocked_right_viewport_->SetReprojection(GVR_REPROJECTION_NONE); | 267 headlocked_right_viewport_->SetReprojection(GVR_REPROJECTION_NONE); |
| 269 } | 268 } |
| 270 | 269 |
| 271 void VrShell::UpdateController(const gvr::Vec3f& forward_vector) { | 270 void VrShell::UpdateController(const gvr::Vec3f& forward_vector) { |
| 272 controller_->UpdateState(); | 271 controller_->UpdateState(); |
| 273 | 272 |
| 273 #if defined(ENABLE_VR_SHELL) |
| 274 // Note that button up/down state is transient, so IsButtonUp only returns |
| 275 // true for a single frame (and we're guaranteed not to miss it). |
| 276 if (controller_->IsButtonUp( |
| 277 gvr::ControllerButton::GVR_CONTROLLER_BUTTON_APP)) { |
| 278 if (html_interface_->GetMode() == UiInterface::Mode::MENU) { |
| 279 // Temporary: Hit app button a second time to exit menu mode. |
| 280 if (webvr_mode_) { |
| 281 html_interface_->SetMode(UiInterface::Mode::WEB_VR); |
| 282 delegate_->GetDeviceProvider()->OnDisplayFocus(); |
| 283 } else { |
| 284 html_interface_->SetMode(UiInterface::Mode::STANDARD); |
| 285 } |
| 286 } else { |
| 287 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { |
| 288 delegate_->GetDeviceProvider()->OnDisplayBlur(); |
| 289 } |
| 290 html_interface_->SetMode(UiInterface::Mode::MENU); |
| 291 // TODO(mthiesse): The page is no longer visible here. We should unfocus |
| 292 // or otherwise let it know it's hidden. |
| 293 } |
| 294 } |
| 295 #endif |
| 296 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { |
| 297 return; |
| 298 } |
| 299 |
| 274 gvr::Vec3f ergo_neutral_pose; | 300 gvr::Vec3f ergo_neutral_pose; |
| 275 if (!controller_->IsConnected()) { | 301 if (!controller_->IsConnected()) { |
| 276 // No controller detected, set up a gaze cursor that tracks the | 302 // No controller detected, set up a gaze cursor that tracks the |
| 277 // forward direction. | 303 // forward direction. |
| 278 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; | 304 ergo_neutral_pose = {0.0f, 0.0f, -1.0f}; |
| 279 controller_quat_ = GetRotationFromZAxis(forward_vector); | 305 controller_quat_ = GetRotationFromZAxis(forward_vector); |
| 280 } else { | 306 } else { |
| 281 ergo_neutral_pose = {0.0f, -sin(kErgoAngleOffset), -cos(kErgoAngleOffset)}; | 307 ergo_neutral_pose = {0.0f, -sin(kErgoAngleOffset), -cos(kErgoAngleOffset)}; |
| 282 controller_quat_ = controller_->Orientation(); | 308 controller_quat_ = controller_->Orientation(); |
| 283 } | 309 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 void VrShell::SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) { | 447 void VrShell::SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num) { |
| 422 webvr_head_pose_[pose_num % kPoseRingBufferSize] = pose; | 448 webvr_head_pose_[pose_num % kPoseRingBufferSize] = pose; |
| 423 } | 449 } |
| 424 | 450 |
| 425 uint32_t GetPixelEncodedPoseIndex() { | 451 uint32_t GetPixelEncodedPoseIndex() { |
| 426 // Read the pose index encoded in a bottom left pixel as color values. | 452 // Read the pose index encoded in a bottom left pixel as color values. |
| 427 // See also third_party/WebKit/Source/modules/vr/VRDisplay.cpp which | 453 // See also third_party/WebKit/Source/modules/vr/VRDisplay.cpp which |
| 428 // encodes the pose index, and device/vr/android/gvr/gvr_device.cc | 454 // encodes the pose index, and device/vr/android/gvr/gvr_device.cc |
| 429 // which tracks poses. | 455 // which tracks poses. |
| 430 uint8_t pixels[4]; | 456 uint8_t pixels[4]; |
| 431 // Assume we're reading from the frambebuffer we just wrote to. | 457 // Assume we're reading from the framebuffer we just wrote to. |
| 432 // That's true currently, we may need to use glReadBuffer(GL_BACK) | 458 // That's true currently, we may need to use glReadBuffer(GL_BACK) |
| 433 // or equivalent if the rendering setup changes in the future. | 459 // or equivalent if the rendering setup changes in the future. |
| 434 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); | 460 glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixels); |
| 435 return pixels[0] | (pixels[1] << 8) | (pixels[2] << 16); | 461 return pixels[0] | (pixels[1] << 8) | (pixels[2] << 16); |
| 436 } | 462 } |
| 437 | 463 |
| 438 void VrShell::DrawFrame(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 464 void VrShell::DrawFrame(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 439 buffer_viewport_list_->SetToRecommendedBufferViewports(); | 465 buffer_viewport_list_->SetToRecommendedBufferViewports(); |
| 440 | 466 |
| 441 gvr::Frame frame = swap_chain_->AcquireFrame(); | 467 gvr::Frame frame = swap_chain_->AcquireFrame(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 459 frame.BindBuffer(kFramePrimaryBuffer); | 485 frame.BindBuffer(kFramePrimaryBuffer); |
| 460 | 486 |
| 461 HandleQueuedTasks(); | 487 HandleQueuedTasks(); |
| 462 | 488 |
| 463 // Update the render position of all UI elements (including desktop). | 489 // Update the render position of all UI elements (including desktop). |
| 464 const float screen_tilt = kDesktopScreenTiltDefault * M_PI / 180.0f; | 490 const float screen_tilt = kDesktopScreenTiltDefault * M_PI / 180.0f; |
| 465 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); | 491 scene_->UpdateTransforms(screen_tilt, UiScene::TimeInMicroseconds()); |
| 466 | 492 |
| 467 UpdateController(GetForwardVector(head_pose)); | 493 UpdateController(GetForwardVector(head_pose)); |
| 468 | 494 |
| 469 if (webvr_mode_) { | 495 if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) { |
| 470 DrawWebVr(); | 496 DrawWebVr(); |
| 471 | 497 |
| 472 // When using async reprojection, we need to know which pose was used in | 498 // When using async reprojection, we need to know which pose was used in |
| 473 // the WebVR app for drawing this frame. Due to unknown amounts of | 499 // the WebVR app for drawing this frame. Due to unknown amounts of |
| 474 // buffering in the compositor and SurfaceTexture, we read the pose number | 500 // buffering in the compositor and SurfaceTexture, we read the pose number |
| 475 // from a corner pixel. There's no point in doing this for legacy | 501 // from a corner pixel. There's no point in doing this for legacy |
| 476 // distortion rendering since that doesn't need a pose, and reading back | 502 // distortion rendering since that doesn't need a pose, and reading back |
| 477 // pixels is an expensive operation. TODO(klausw): stop doing this once we | 503 // pixels is an expensive operation. TODO(klausw): stop doing this once we |
| 478 // have working no-compositor rendering for WebVR. | 504 // have working no-compositor rendering for WebVR. |
| 479 if (gvr_api_->GetAsyncReprojectionEnabled()) { | 505 if (gvr_api_->GetAsyncReprojectionEnabled()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 496 if (!rect->visible) { | 522 if (!rect->visible) { |
| 497 continue; | 523 continue; |
| 498 } | 524 } |
| 499 if (rect->lock_to_fov) { | 525 if (rect->lock_to_fov) { |
| 500 head_locked_elements.push_back(rect.get()); | 526 head_locked_elements.push_back(rect.get()); |
| 501 } else { | 527 } else { |
| 502 world_elements.push_back(rect.get()); | 528 world_elements.push_back(rect.get()); |
| 503 } | 529 } |
| 504 } | 530 } |
| 505 | 531 |
| 506 if (!webvr_mode_) { | 532 bool not_web_vr = html_interface_->GetMode() != UiInterface::Mode::WEB_VR; |
| 533 |
| 534 if (not_web_vr) { |
| 507 glEnable(GL_CULL_FACE); | 535 glEnable(GL_CULL_FACE); |
| 508 glEnable(GL_DEPTH_TEST); | 536 glEnable(GL_DEPTH_TEST); |
| 509 glEnable(GL_SCISSOR_TEST); | 537 glEnable(GL_SCISSOR_TEST); |
| 510 glClearColor(0.1f, 0.1f, 0.1f, 1.0f); | 538 glClearColor(0.1f, 0.1f, 0.1f, 1.0f); |
| 511 } | 539 } |
| 512 | 540 |
| 513 if (!world_elements.empty()) { | 541 DrawUiView(&head_pose, world_elements, not_web_vr); |
| 514 DrawUiView(&head_pose, world_elements); | |
| 515 } | |
| 516 | 542 |
| 517 if (!head_locked_elements.empty()) { | 543 if (!head_locked_elements.empty()) { |
| 518 // Switch to head-locked viewports. | 544 // Switch to head-locked viewports. |
| 519 size_t last_viewport = buffer_viewport_list_->GetSize(); | 545 size_t last_viewport = buffer_viewport_list_->GetSize(); |
| 520 buffer_viewport_list_->SetBufferViewport(last_viewport++, | 546 buffer_viewport_list_->SetBufferViewport(last_viewport++, |
| 521 *headlocked_left_viewport_); | 547 *headlocked_left_viewport_); |
| 522 buffer_viewport_list_->SetBufferViewport(last_viewport++, | 548 buffer_viewport_list_->SetBufferViewport(last_viewport++, |
| 523 *headlocked_right_viewport_); | 549 *headlocked_right_viewport_); |
| 524 | 550 |
| 525 // Bind the headlocked framebuffer. | 551 // Bind the headlocked framebuffer. |
| 526 frame.BindBuffer(kFrameHeadlockedBuffer); | 552 frame.BindBuffer(kFrameHeadlockedBuffer); |
| 527 glClear(GL_COLOR_BUFFER_BIT); | 553 glClearColor(0.0f, 0.0f, 0.0f, 0.0f); |
| 528 | 554 DrawUiView(nullptr, head_locked_elements, true); |
| 529 DrawUiView(nullptr, head_locked_elements); | |
| 530 } | 555 } |
| 531 } | 556 } |
| 532 | 557 |
| 533 void VrShell::DrawUiView(const gvr::Mat4f* head_pose, | 558 void VrShell::DrawUiView(const gvr::Mat4f* head_pose, |
| 534 const std::vector<const ContentRectangle*>& elements) { | 559 const std::vector<const ContentRectangle*>& elements, |
| 560 bool clear) { |
| 535 for (auto eye : {GVR_LEFT_EYE, GVR_RIGHT_EYE}) { | 561 for (auto eye : {GVR_LEFT_EYE, GVR_RIGHT_EYE}) { |
| 536 buffer_viewport_list_->GetBufferViewport(eye, buffer_viewport_.get()); | 562 buffer_viewport_list_->GetBufferViewport(eye, buffer_viewport_.get()); |
| 537 | 563 |
| 538 gvr::Mat4f view_matrix = gvr_api_->GetEyeFromHeadMatrix(eye); | 564 gvr::Mat4f view_matrix = gvr_api_->GetEyeFromHeadMatrix(eye); |
| 539 if (head_pose != nullptr) { | 565 if (head_pose != nullptr) { |
| 540 view_matrix = MatrixMul(view_matrix, *head_pose); | 566 view_matrix = MatrixMul(view_matrix, *head_pose); |
| 541 } | 567 } |
| 542 | 568 |
| 543 gvr::Recti pixel_rect = | 569 gvr::Recti pixel_rect = |
| 544 CalculatePixelSpaceRect(render_size_, buffer_viewport_->GetSourceUv()); | 570 CalculatePixelSpaceRect(render_size_, buffer_viewport_->GetSourceUv()); |
| 545 glViewport(pixel_rect.left, pixel_rect.bottom, | 571 glViewport(pixel_rect.left, pixel_rect.bottom, |
| 546 pixel_rect.right - pixel_rect.left, | 572 pixel_rect.right - pixel_rect.left, |
| 547 pixel_rect.top - pixel_rect.bottom); | 573 pixel_rect.top - pixel_rect.bottom); |
| 548 glScissor(pixel_rect.left, pixel_rect.bottom, | 574 glScissor(pixel_rect.left, pixel_rect.bottom, |
| 549 pixel_rect.right - pixel_rect.left, | 575 pixel_rect.right - pixel_rect.left, |
| 550 pixel_rect.top - pixel_rect.bottom); | 576 pixel_rect.top - pixel_rect.bottom); |
| 551 | 577 |
| 552 if (!webvr_mode_) { | 578 if (clear) { |
| 553 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | 579 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 554 } | 580 } |
| 555 | 581 |
| 556 const gvr::Mat4f render_matrix = MatrixMul( | 582 const gvr::Mat4f render_matrix = MatrixMul( |
| 557 PerspectiveMatrixFromView( | 583 PerspectiveMatrixFromView( |
| 558 buffer_viewport_->GetSourceFov(), kZNear, kZFar), | 584 buffer_viewport_->GetSourceFov(), kZNear, kZFar), |
| 559 view_matrix); | 585 view_matrix); |
| 560 | 586 |
| 561 DrawElements(render_matrix, elements); | 587 DrawElements(render_matrix, elements); |
| 562 if (head_pose != nullptr) { | 588 if (head_pose != nullptr && |
| 589 html_interface_->GetMode() != UiInterface::Mode::WEB_VR) { |
| 563 DrawCursor(render_matrix); | 590 DrawCursor(render_matrix); |
| 564 } | 591 } |
| 565 } | 592 } |
| 566 } | 593 } |
| 567 | 594 |
| 568 void VrShell::DrawElements( | 595 void VrShell::DrawElements( |
| 569 const gvr::Mat4f& render_matrix, | 596 const gvr::Mat4f& render_matrix, |
| 570 const std::vector<const ContentRectangle*>& elements) { | 597 const std::vector<const ContentRectangle*>& elements) { |
| 571 for (const auto& rect : elements) { | 598 for (const auto& rect : elements) { |
| 572 Rectf copy_rect; | 599 Rectf copy_rect; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 | 692 |
| 666 void VrShell::DrawWebVr() { | 693 void VrShell::DrawWebVr() { |
| 667 // Don't need face culling, depth testing, blending, etc. Turn it all off. | 694 // Don't need face culling, depth testing, blending, etc. Turn it all off. |
| 668 glDisable(GL_CULL_FACE); | 695 glDisable(GL_CULL_FACE); |
| 669 glDepthMask(GL_FALSE); | 696 glDepthMask(GL_FALSE); |
| 670 glDisable(GL_DEPTH_TEST); | 697 glDisable(GL_DEPTH_TEST); |
| 671 glDisable(GL_SCISSOR_TEST); | 698 glDisable(GL_SCISSOR_TEST); |
| 672 glDisable(GL_BLEND); | 699 glDisable(GL_BLEND); |
| 673 glDisable(GL_POLYGON_OFFSET_FILL); | 700 glDisable(GL_POLYGON_OFFSET_FILL); |
| 674 | 701 |
| 675 // Don't need to clear, since we're drawing over the entire render target. | |
| 676 glClear(GL_COLOR_BUFFER_BIT); | |
| 677 | |
| 678 glViewport(0, 0, render_size_.width, render_size_.height); | 702 glViewport(0, 0, render_size_.width, render_size_.height); |
| 679 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_); | 703 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_); |
| 680 } | 704 } |
| 681 | 705 |
| 682 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 706 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| 683 // Set a flag to handle this on the render thread at the next frame. | 707 // Set a flag to handle this on the render thread at the next frame. |
| 684 touch_pending_ = true; | 708 touch_pending_ = true; |
| 685 } | 709 } |
| 686 | 710 |
| 687 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 711 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 const JavaParamRef<jobject>& ui_web_contents, | 869 const JavaParamRef<jobject>& ui_web_contents, |
| 846 jlong ui_window_android) { | 870 jlong ui_window_android) { |
| 847 return reinterpret_cast<intptr_t>(new VrShell( | 871 return reinterpret_cast<intptr_t>(new VrShell( |
| 848 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), | 872 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), |
| 849 reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 873 reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 850 content::WebContents::FromJavaWebContents(ui_web_contents), | 874 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 851 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 875 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
| 852 } | 876 } |
| 853 | 877 |
| 854 } // namespace vr_shell | 878 } // namespace vr_shell |
| OLD | NEW |