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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 pp::Module* module_; | 78 pp::Module* module_; |
79 | 79 |
80 // Owned data. | 80 // Owned data. |
81 pp::Graphics3D* context_; | 81 pp::Graphics3D* context_; |
82 bool fullscreen_; | 82 bool fullscreen_; |
83 }; | 83 }; |
84 | 84 |
85 GLES2DemoInstance::GLES2DemoInstance(PP_Instance instance, pp::Module* module) | 85 GLES2DemoInstance::GLES2DemoInstance(PP_Instance instance, pp::Module* module) |
86 : pp::Instance(instance), pp::Graphics3DClient(this), | 86 : pp::Instance(instance), pp::Graphics3DClient(this), |
87 callback_factory_(this), | 87 callback_factory_(this), |
| 88 gles2_if_(static_cast<const PPB_OpenGLES2*>( |
| 89 module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE))), |
88 module_(module), | 90 module_(module), |
89 context_(NULL), | 91 context_(NULL), |
90 fullscreen_(false) { | 92 fullscreen_(false) { |
91 assert((gles2_if_ = static_cast<const PPB_OpenGLES2*>( | 93 assert(gles2_if_); |
92 module->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)))); | |
93 RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); | 94 RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE); |
94 } | 95 } |
95 | 96 |
96 GLES2DemoInstance::~GLES2DemoInstance() { | 97 GLES2DemoInstance::~GLES2DemoInstance() { |
97 delete context_; | 98 delete context_; |
98 } | 99 } |
99 | 100 |
100 void GLES2DemoInstance::DidChangeView( | 101 void GLES2DemoInstance::DidChangeView( |
101 const pp::Rect& position, const pp::Rect& clip_ignored) { | 102 const pp::Rect& position, const pp::Rect& clip_ignored) { |
102 if (position.width() == 0 || position.height() == 0) | 103 if (position.width() == 0 || position.height() == 0) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 171 } |
171 | 172 |
172 } // anonymous namespace | 173 } // anonymous namespace |
173 | 174 |
174 namespace pp { | 175 namespace pp { |
175 // Factory function for your specialization of the Module object. | 176 // Factory function for your specialization of the Module object. |
176 Module* CreateModule() { | 177 Module* CreateModule() { |
177 return new GLES2DemoModule(); | 178 return new GLES2DemoModule(); |
178 } | 179 } |
179 } // namespace pp | 180 } // namespace pp |
OLD | NEW |