Skip to content

Commit

Permalink
Reland r93090, which was reverted in r93104.
Browse files Browse the repository at this point in the history
Ported pepper 3d demos to use the new graphics3d interface instead of context3d and surface3d.
BUG=86370
TBR=piman
Review URL: http://codereview.chromium.org/7470031

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94348 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
alokp@chromium.org committed Jul 27, 2011
1 parent 9b62ecf commit 319a26e
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions gpu/demos/framework/pepper.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand All @@ -11,9 +11,7 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
#include "ppapi/cpp/dev/context_3d_dev.h"
#include "ppapi/cpp/dev/graphics_3d_dev.h"
#include "ppapi/cpp/dev/surface_3d_dev.h"
#include "ppapi/lib/gl/gles2/gl2ext_ppapi.h"

namespace gpu {
Expand Down Expand Up @@ -49,21 +47,15 @@ class PluginInstance : public pp::Instance {
demo_->InitWindowSize(size_.width(), size_.height());

if (context_.is_null()) {
context_ = pp::Context3D_Dev(*this, 0, pp::Context3D_Dev(), NULL);
context_ = pp::Graphics3D_Dev(*this, 0, pp::Graphics3D_Dev(), NULL);
if (context_.is_null())
return;

pp::Instance::BindGraphics(context_);
glSetCurrentContextPPAPI(context_.pp_resource());
demo_->InitGL();
glSetCurrentContextPPAPI(0);
} else {
// Need to recreate surface. Unbind existing surface.
pp::Instance::BindGraphics(pp::Surface3D_Dev());
context_.BindSurfaces(pp::Surface3D_Dev(), pp::Surface3D_Dev());
}
surface_ = pp::Surface3D_Dev(*this, 0, NULL);
context_.BindSurfaces(surface_, surface_);
pp::Instance::BindGraphics(surface_);

Paint();
}
Expand All @@ -77,7 +69,7 @@ class PluginInstance : public pp::Instance {
glSetCurrentContextPPAPI(context_.pp_resource());
demo_->Draw();
swap_pending_ = true;
surface_.SwapBuffers(
context_.SwapBuffers(
callback_factory_.NewCallback(&PluginInstance::OnSwap));
glSetCurrentContextPPAPI(0);
}
Expand All @@ -93,8 +85,7 @@ class PluginInstance : public pp::Instance {

pp::Module* module_;
Demo* demo_;
pp::Context3D_Dev context_;
pp::Surface3D_Dev surface_;
pp::Graphics3D_Dev context_;
pp::Size size_;
bool swap_pending_;
bool paint_needed_;
Expand Down

0 comments on commit 319a26e

Please sign in to comment.