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

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

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: Trying to fix android. Created 3 years, 11 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
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/display/gl_canvas.h" 5 #include "remoting/client/display/gl_canvas.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "remoting/client/display/gl_helpers.h" 8 #include "remoting/client/display/gl_helpers.h"
9 #include "remoting/client/display/gl_math.h" 9 #include "remoting/client/display/gl_math.h"
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 GlCanvas::~GlCanvas() { 89 GlCanvas::~GlCanvas() {
90 DCHECK(thread_checker_.CalledOnValidThread()); 90 DCHECK(thread_checker_.CalledOnValidThread());
91 glDisable(GL_BLEND); 91 glDisable(GL_BLEND);
92 glDisableVertexAttribArray(tex_cord_location_); 92 glDisableVertexAttribArray(tex_cord_location_);
93 glDisableVertexAttribArray(position_location_); 93 glDisableVertexAttribArray(position_location_);
94 glDeleteProgram(program_); 94 glDeleteProgram(program_);
95 glDeleteShader(vertex_shader_); 95 glDeleteShader(vertex_shader_);
96 glDeleteShader(fragment_shader_); 96 glDeleteShader(fragment_shader_);
97 } 97 }
98 98
99 void GlCanvas::Clear() {
100 #ifndef NDEBUG
101 // Set the background clear color to bright green for debugging purposes.
102 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
103 #else
104 // Set the background clear color to black.
105 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
106 #endif
107 glClear(GL_COLOR_BUFFER_BIT);
108 }
109
99 void GlCanvas::SetTransformationMatrix(const std::array<float, 9>& matrix) { 110 void GlCanvas::SetTransformationMatrix(const std::array<float, 9>& matrix) {
100 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
101 std::array<float, 9> transposed_matrix = matrix; 112 std::array<float, 9> transposed_matrix = matrix;
102 TransposeTransformationMatrix(&transposed_matrix); 113 TransposeTransformationMatrix(&transposed_matrix);
103 glUniformMatrix3fv(transform_location_, 1, GL_FALSE, 114 glUniformMatrix3fv(transform_location_, 1, GL_FALSE,
104 transposed_matrix.data()); 115 transposed_matrix.data());
105 transformation_set_ = true; 116 transformation_set_ = true;
106 } 117 }
107 118
108 void GlCanvas::SetViewSize(int width, int height) { 119 void GlCanvas::SetViewSize(int width, int height) {
(...skipping 21 matching lines...) Expand all
130 glVertexAttribPointer(position_location_, kVertexSize, GL_FLOAT, GL_FALSE, 0, 141 glVertexAttribPointer(position_location_, kVertexSize, GL_FLOAT, GL_FALSE, 0,
131 0); 142 0);
132 glVertexAttribPointer(tex_cord_location_, kVertexSize, GL_FLOAT, GL_FALSE, 0, 143 glVertexAttribPointer(tex_cord_location_, kVertexSize, GL_FLOAT, GL_FALSE, 0,
133 static_cast<float*>(0) + kVertexSize * kVertexCount); 144 static_cast<float*>(0) + kVertexSize * kVertexCount);
134 145
135 glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount); 146 glDrawArrays(GL_TRIANGLE_STRIP, 0, kVertexCount);
136 glBindBuffer(GL_ARRAY_BUFFER, 0); 147 glBindBuffer(GL_ARRAY_BUFFER, 0);
137 glBindTexture(GL_TEXTURE_2D, 0); 148 glBindTexture(GL_TEXTURE_2D, 0);
138 } 149 }
139 150
140 int GlCanvas::GetGlVersion() const { 151 int GlCanvas::GetVersion() const {
141 return gl_version_; 152 return gl_version_;
142 } 153 }
143 154
144 int GlCanvas::GetMaxTextureSize() const { 155 int GlCanvas::GetMaxTextureSize() const {
145 return max_texture_size_; 156 return max_texture_size_;
146 } 157 }
147 158
148 } // namespace remoting 159 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698