| 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 #ifndef GL_GLEXT_PROTOTYPES | 5 #ifndef GL_GLEXT_PROTOTYPES |
| 6 #define GL_GLEXT_PROTOTYPES | 6 #define GL_GLEXT_PROTOTYPES |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "examples/spinning_cube/gles2_client_impl.h" | 9 #include "examples/spinning_cube/gles2_client_impl.h" |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 break; | 128 break; |
| 129 } | 129 } |
| 130 default: | 130 default: |
| 131 break; | 131 break; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) { | 135 void GLES2ClientImpl::ContextCreated(mojo::CommandBufferPtr command_buffer) { |
| 136 context_ = MGLCreateContext( | 136 context_ = MGLCreateContext( |
| 137 MGL_API_VERSION_GLES2, | 137 MGL_API_VERSION_GLES2, |
| 138 command_buffer.PassInterface().PassHandle().release().value(), | 138 command_buffer.PassInterfaceHandle().PassHandle().release().value(), |
| 139 MGL_NO_CONTEXT, &ContextLostThunk, this, | 139 MGL_NO_CONTEXT, &ContextLostThunk, this, |
| 140 mojo::Environment::GetDefaultAsyncWaiter()); | 140 mojo::Environment::GetDefaultAsyncWaiter()); |
| 141 MGLMakeCurrent(context_); | 141 MGLMakeCurrent(context_); |
| 142 cube_.Init(); | 142 cube_.Init(); |
| 143 WantToDraw(); | 143 WantToDraw(); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void GLES2ClientImpl::ContextLost() { | 146 void GLES2ClientImpl::ContextLost() { |
| 147 cube_.OnGLContextLost(); | 147 cube_.OnGLContextLost(); |
| 148 MGLDestroyContext(context_); | 148 MGLDestroyContext(context_); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 174 float delta = static_cast<float>(offset) / 1000000.; | 174 float delta = static_cast<float>(offset) / 1000000.; |
| 175 last_time_ = now; | 175 last_time_ = now; |
| 176 cube_.UpdateForTimeDelta(delta); | 176 cube_.UpdateForTimeDelta(delta); |
| 177 cube_.Draw(); | 177 cube_.Draw(); |
| 178 | 178 |
| 179 MGLSwapBuffers(); | 179 MGLSwapBuffers(); |
| 180 WantToDraw(); | 180 WantToDraw(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace examples | 183 } // namespace examples |
| OLD | NEW |