| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "examples/spinning_cube/gles2_client_impl.h" | 5 #include "examples/spinning_cube/gles2_client_impl.h" |
| 6 | 6 |
| 7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
| 8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 WantToDraw(); | 100 WantToDraw(); |
| 101 break; | 101 break; |
| 102 } | 102 } |
| 103 default: | 103 default: |
| 104 break; | 104 break; |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) { | 108 void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) { |
| 109 context_ = MojoGLES2CreateContext( | 109 context_ = MojoGLES2CreateContext( |
| 110 command_buffer.PassMessagePipe().release().value(), &ContextLostThunk, | 110 command_buffer.PassInterface().PassHandle().release().value(), |
| 111 this, mojo::Environment::GetDefaultAsyncWaiter()); | 111 &ContextLostThunk, this, mojo::Environment::GetDefaultAsyncWaiter()); |
| 112 MojoGLES2MakeCurrent(context_); | 112 MojoGLES2MakeCurrent(context_); |
| 113 cube_.Init(); | 113 cube_.Init(); |
| 114 WantToDraw(); | 114 WantToDraw(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void GLES2ClientImpl::ContextLost() { | 117 void GLES2ClientImpl::ContextLost() { |
| 118 cube_.OnGLContextLost(); | 118 cube_.OnGLContextLost(); |
| 119 MojoGLES2DestroyContext(context_); | 119 MojoGLES2DestroyContext(context_); |
| 120 context_ = nullptr; | 120 context_ = nullptr; |
| 121 context_provider_->Create(nullptr, | 121 context_provider_->Create(nullptr, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 145 float delta = static_cast<float>(offset) / 1000000.; | 145 float delta = static_cast<float>(offset) / 1000000.; |
| 146 last_time_ = now; | 146 last_time_ = now; |
| 147 cube_.UpdateForTimeDelta(delta); | 147 cube_.UpdateForTimeDelta(delta); |
| 148 cube_.Draw(); | 148 cube_.Draw(); |
| 149 | 149 |
| 150 MojoGLES2SwapBuffers(); | 150 MojoGLES2SwapBuffers(); |
| 151 WantToDraw(); | 151 WantToDraw(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace examples | 154 } // namespace examples |
| OLD | NEW |