我正在使用以下示例ppapi插件,它使用openGL:cube呈现旋转立方体。
我能够将它嵌入到运行在Chrome中的网页中,一切都如预期的那样工作得很好。我的html页面的代码与这里相同:cube.html
但是,如果我添加另一个embed html元素来在同一个页面上加载相同的插件两次,那么只有第二个embed显示旋转的多维数据集。第一个嵌入在停止之前呈现单个帧。
<embed id="plugin" type="application/x-ppapi-example-gles2-spinning-cube" width="800" height="600"/>
<embed id="plugin2" type="application/x-ppapi-example-gles2-spinning-cube" width="800" height="600"/>Chrome是否支持同一网页上的多个ppapi插件?如果这个应该很好的话,那么有人能帮我找出为什么会发生这种情况吗?这是因为我有多个OpenGL上下文吗?Fwiw,我在Ubuntu上,如果需要的话,我可以在Windows/Mac上进行比较。我在用Chrome注册花椒插件。
最终,我想在CEF (https://bitbucket.org/chromiumembedded/cef)中使用它,但由于Chrome不起作用,我想先弄清这个问题的真相,然后再转到CEF上。
发布于 2015-07-21 19:36:23
是的,Chrome确实支持同一页面上的多个ppapi插件,这是因为在ppapi示例代码中缺少了对glSetCurrentContextPPAPI的调用。应该是这样的:
void DemoInstance::Paint(int32_t result) {
if (result != PP_OK || !context_)
return;
glSetCurrentContextPPAPI(context_->pp_resource()); // missing from example
cube_.UpdateForTimeDelta(0.02f);
cube_.Draw();
context_->SwapBuffers(callback_factory_.NewCallback(&DemoInstance::Paint));
}https://stackoverflow.com/questions/31501932
复制相似问题