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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_renderer.cc

Issue 2891243002: VR: Loading DD controller model after GL is initialized (Closed)
Patch Set: doing texture patching on background task Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_renderer.h" 5 #include "chrome/browser/android/vr_shell/vr_shell_renderer.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/trace_event/trace_event.h"
12 #include "chrome/browser/android/vr_shell/vr_gl_util.h" 13 #include "chrome/browser/android/vr_shell/vr_gl_util.h"
13 14
14 namespace { 15 namespace {
15 16
16 static constexpr float kHalfSize = 0.5f; 17 static constexpr float kHalfSize = 0.5f;
17 /* clang-format off */ 18 /* clang-format off */
18 static constexpr float kTextureQuadVertices[30] = { 19 static constexpr float kTextureQuadVertices[30] = {
19 // x y z, u, v 20 // x y z, u, v
20 -kHalfSize, kHalfSize, 0.0f, 0.0f, 0.0f, 21 -kHalfSize, kHalfSize, 0.0f, 0.0f, 0.0f,
21 -kHalfSize, -kHalfSize, 0.0f, 0.0f, 1.0f, 22 -kHalfSize, -kHalfSize, 0.0f, 0.0f, 1.0f,
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 texture_handles_(VrControllerModel::STATE_COUNT) { 590 texture_handles_(VrControllerModel::STATE_COUNT) {
590 model_view_proj_matrix_handle_ = 591 model_view_proj_matrix_handle_ =
591 glGetUniformLocation(program_handle_, "u_ModelViewProjMatrix"); 592 glGetUniformLocation(program_handle_, "u_ModelViewProjMatrix");
592 tex_uniform_handle_ = glGetUniformLocation(program_handle_, "u_Texture"); 593 tex_uniform_handle_ = glGetUniformLocation(program_handle_, "u_Texture");
593 opacity_handle_ = glGetUniformLocation(program_handle_, "u_Opacity"); 594 opacity_handle_ = glGetUniformLocation(program_handle_, "u_Opacity");
594 } 595 }
595 596
596 ControllerRenderer::~ControllerRenderer() = default; 597 ControllerRenderer::~ControllerRenderer() = default;
597 598
598 void ControllerRenderer::SetUp(std::unique_ptr<VrControllerModel> model) { 599 void ControllerRenderer::SetUp(std::unique_ptr<VrControllerModel> model) {
600 TRACE_EVENT0("gpu", "ControllerRenderer::SetUp");
599 glGenBuffersARB(1, &indices_buffer_); 601 glGenBuffersARB(1, &indices_buffer_);
600 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_); 602 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indices_buffer_);
601 glBufferData(GL_ELEMENT_ARRAY_BUFFER, model->IndicesBufferSize(), 603 glBufferData(GL_ELEMENT_ARRAY_BUFFER, model->IndicesBufferSize(),
602 model->IndicesBuffer(), GL_STATIC_DRAW); 604 model->IndicesBuffer(), GL_STATIC_DRAW);
603 605
604 glGenBuffersARB(1, &vertex_buffer_); 606 glGenBuffersARB(1, &vertex_buffer_);
605 glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_); 607 glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer_);
606 glBufferData(GL_ARRAY_BUFFER, model->ElementsBufferSize(), 608 glBufferData(GL_ARRAY_BUFFER, model->ElementsBufferSize(),
607 model->ElementsBuffer(), GL_STATIC_DRAW); 609 model->ElementsBuffer(), GL_STATIC_DRAW);
608 610
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 GradientGridRenderer* VrShellRenderer::GetGradientGridRenderer() { 852 GradientGridRenderer* VrShellRenderer::GetGradientGridRenderer() {
851 Flush(); 853 Flush();
852 return gradient_grid_renderer_.get(); 854 return gradient_grid_renderer_.get();
853 } 855 }
854 856
855 void VrShellRenderer::Flush() { 857 void VrShellRenderer::Flush() {
856 textured_quad_renderer_->Flush(); 858 textured_quad_renderer_->Flush();
857 } 859 }
858 860
859 } // namespace vr_shell 861 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698