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

Side by Side Diff: remoting/client/gl_canvas.cc

Issue 2175963002: [Chromoting] Implement GlRenderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implements full transpose Created 4 years, 4 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 | « no previous file | remoting/client/gl_math.h » ('j') | 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 "remoting/client/gl_canvas.h" 5 #include "remoting/client/gl_canvas.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "remoting/client/gl_helpers.h" 8 #include "remoting/client/gl_helpers.h"
9 #include "remoting/client/gl_math.h"
9 10
10 namespace { 11 namespace {
11 12
12 const int kVertexSize = 2; 13 const int kVertexSize = 2;
13 const int kVertexCount = 4; 14 const int kVertexCount = 4;
14 15
15 const char kTexCoordToViewVert[] = 16 const char kTexCoordToViewVert[] =
16 // Region of the texture to be used (normally the whole texture). 17 // Region of the texture to be used (normally the whole texture).
17 "varying vec2 v_texCoord;\n" 18 "varying vec2 v_texCoord;\n"
18 "attribute vec2 a_texCoord;\n" 19 "attribute vec2 a_texCoord;\n"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 glDisable(GL_BLEND); 78 glDisable(GL_BLEND);
78 glDisableVertexAttribArray(tex_cord_location_); 79 glDisableVertexAttribArray(tex_cord_location_);
79 glDisableVertexAttribArray(position_location_); 80 glDisableVertexAttribArray(position_location_);
80 glDeleteProgram(program_); 81 glDeleteProgram(program_);
81 glDeleteShader(vertex_shader_); 82 glDeleteShader(vertex_shader_);
82 glDeleteShader(fragment_shader_); 83 glDeleteShader(fragment_shader_);
83 } 84 }
84 85
85 void GlCanvas::SetNormalizedTransformation(const std::array<float, 9>& matrix) { 86 void GlCanvas::SetNormalizedTransformation(const std::array<float, 9>& matrix) {
86 DCHECK(thread_checker_.CalledOnValidThread()); 87 DCHECK(thread_checker_.CalledOnValidThread());
87 glUniformMatrix3fv(transform_location_, 1, GL_TRUE, matrix.data()); 88 std::array<float, 9> transposed_matrix = matrix;
89 TransposeTransformationMatrix(&transposed_matrix);
90 glUniformMatrix3fv(transform_location_, 1, GL_FALSE,
91 transposed_matrix.data());
88 transformation_set_ = true; 92 transformation_set_ = true;
89 } 93 }
90 94
91 void GlCanvas::DrawTexture(int texture_id, 95 void GlCanvas::DrawTexture(int texture_id,
92 GLuint texture_handle, 96 GLuint texture_handle,
93 GLuint vertex_buffer, 97 GLuint vertex_buffer,
94 float alpha_multiplier) { 98 float alpha_multiplier) {
95 DCHECK(thread_checker_.CalledOnValidThread()); 99 DCHECK(thread_checker_.CalledOnValidThread());
96 if (!transformation_set_) { 100 if (!transformation_set_) {
97 return; 101 return;
(...skipping 12 matching lines...) Expand all
110 glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount); 114 glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount);
111 glBindBuffer(GL_ARRAY_BUFFER, 0); 115 glBindBuffer(GL_ARRAY_BUFFER, 0);
112 glBindTexture(GL_TEXTURE_2D, 0); 116 glBindTexture(GL_TEXTURE_2D, 0);
113 } 117 }
114 118
115 int GlCanvas::GetGlVersion() const { 119 int GlCanvas::GetGlVersion() const {
116 return gl_version_; 120 return gl_version_;
117 } 121 }
118 122
119 } // namespace remoting 123 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/client/gl_math.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698