OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <pthread.h> | 6 #include <pthread.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 printf("Calling create context....\n"); | 136 printf("Calling create context....\n"); |
137 size_ = new_size; | 137 size_ = new_size; |
138 device_context_ = pp::Graphics3D(this, PPAPIGet3DAttribs(size_.width(), | 138 device_context_ = pp::Graphics3D(this, PPAPIGet3DAttribs(size_.width(), |
139 size_.height())); | 139 size_.height())); |
140 printf("Got Context!\n"); | 140 printf("Got Context!\n"); |
141 is_context_bound_ = BindGraphics(device_context_); | 141 is_context_bound_ = BindGraphics(device_context_); |
142 printf("Context is bound=%d\n", is_context_bound_); | 142 printf("Context is bound=%d\n", is_context_bound_); |
143 | 143 |
144 // The the context regardless to make sure we have a valid one | 144 // Set the context regardless to make sure we have a valid one |
145 glSetCurrentContextPPAPI(device_context_.pp_resource()); | 145 glSetCurrentContextPPAPI(device_context_.pp_resource()); |
146 if (is_context_bound_) { | 146 if (is_context_bound_) { |
147 PPAPIBuildContext(size_.width(), size_.height()); | 147 PPAPIBuildContext(size_.width(), size_.height()); |
148 device_context_.SwapBuffers(callback_factory_.NewCallback( | 148 device_context_.SwapBuffers(callback_factory_.NewCallback( |
149 &PPAPIInstance3D::Swapped)); | 149 &PPAPIInstance3D::Swapped)); |
150 } else { | 150 } else { |
151 fprintf(stderr, "Failed to bind context for %dx%d.\n", size_.width(), | 151 fprintf(stderr, "Failed to bind context for %dx%d.\n", size_.width(), |
152 size_.height()); | 152 size_.height()); |
153 } | 153 } |
154 } | 154 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 return false; | 223 return false; |
224 } | 224 } |
225 } else { | 225 } else { |
226 if (!fullscreen_.SetFullscreen(true)) { | 226 if (!fullscreen_.SetFullscreen(true)) { |
227 printf("Could not enter fullscreen mode\n"); | 227 printf("Could not enter fullscreen mode\n"); |
228 return false; | 228 return false; |
229 } | 229 } |
230 } | 230 } |
231 return true; | 231 return true; |
232 } | 232 } |
OLD | NEW |