| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/ozone/demo/gl_renderer.h" | 5 #include "ui/ozone/demo/gl_renderer.h" |
| 6 | 6 |
| 7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
| 8 #include "ui/gl/gl_context.h" | 8 #include "ui/gl/gl_context.h" |
| 9 #include "ui/gl/gl_surface.h" | 9 #include "ui/gl/gl_surface.h" |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 LOG(ERROR) << "Failed to make GL context current"; | 37 LOG(ERROR) << "Failed to make GL context current"; |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 | 40 |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void GlRenderer::RenderFrame() { | 44 void GlRenderer::RenderFrame() { |
| 45 float fraction = NextFraction(); | 45 float fraction = NextFraction(); |
| 46 | 46 |
| 47 context_->MakeCurrent(surface_.get()); |
| 48 |
| 47 glViewport(0, 0, size_.width(), size_.height()); | 49 glViewport(0, 0, size_.width(), size_.height()); |
| 48 glClearColor(1 - fraction, fraction, 0.0, 1.0); | 50 glClearColor(1 - fraction, fraction, 0.0, 1.0); |
| 49 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | 51 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
| 50 | 52 |
| 51 if (!surface_->SwapBuffers()) | 53 if (!surface_->SwapBuffers()) |
| 52 LOG(FATAL) << "Failed to swap buffers"; | 54 LOG(FATAL) << "Failed to swap buffers"; |
| 53 } | 55 } |
| 54 | 56 |
| 55 } // namespace ui | 57 } // namespace ui |
| OLD | NEW |