Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: gpu/demos/framework/pepper.cc

Issue 5927002: Moved the logic of maintaining the current context to gles2 helper library. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/demos/demos.gyp ('k') | ppapi/GLES2/gl2.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/demos/framework/pepper.cc
===================================================================
--- gpu/demos/framework/pepper.cc (revision 69835)
+++ gpu/demos/framework/pepper.cc (working copy)
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <GLES2/gl2.h>
+
#include "base/at_exit.h"
#include "base/scoped_ptr.h"
#include "gpu/demos/framework/demo.h"
@@ -12,6 +14,7 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
+#include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"
namespace gpu {
namespace demos {
@@ -29,9 +32,9 @@
~PluginInstance() {
if (!graphics_.is_null()) {
- graphics_.MakeCurrent();
+ glSetCurrentContextPPAPI(graphics_.pp_resource());
demo_.reset();
- pp::Graphics3D_Dev::ResetCurrent();
+ glSetCurrentContextPPAPI(0);
}
}
@@ -51,9 +54,9 @@
if (!pp::Instance::BindGraphics(graphics_))
return;
- graphics_.MakeCurrent();
+ glSetCurrentContextPPAPI(graphics_.pp_resource());
demo_->InitGL();
- pp::Graphics3D_Dev::ResetCurrent();
+ glSetCurrentContextPPAPI(0);
}
if (demo_->IsAnimated())
@@ -63,10 +66,10 @@
}
void Paint() {
- graphics_.MakeCurrent();
+ glSetCurrentContextPPAPI(graphics_.pp_resource());
demo_->Draw();
graphics_.SwapBuffers();
- pp::Graphics3D_Dev::ResetCurrent();
+ glSetCurrentContextPPAPI(0);
}
private:
@@ -85,8 +88,15 @@
class PluginModule : public pp::Module {
public:
- PluginModule() : pp::Module(), at_exit_manager_(new base::AtExitManager) {}
+ PluginModule() : at_exit_manager_(new base::AtExitManager) {}
+ ~PluginModule() {
+ glTerminatePPAPI();
+ }
+ virtual bool Init() {
+ return glInitializePPAPI(get_browser_interface()) == GL_TRUE ? true : false;
+ }
+
virtual pp::Instance* CreateInstance(PP_Instance instance) {
return new PluginInstance(instance, this);
}
« no previous file with comments | « gpu/demos/demos.gyp ('k') | ppapi/GLES2/gl2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698