使用NPAPI + D3D编写插件。它可以在Firefox上运行,但浏览器不可用。为什么? [英] Writing a plugin using NPAPI + D3D. It works on Firefox, but the browser blacks out. Why?

查看:99
本文介绍了使用NPAPI + D3D编写插件。它可以在Firefox上运行,但浏览器不可用。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用NPAPI和D3D编写插件。我只是简单地将DXSDK和NPAPI的D3D样本放在一起。插件启动时,我收到HWND,然后将其传递给D3D进行绘制。

I'm writing a plugin, using NPAPI and D3D. I just simply put a D3D sample from DXSDK and NPAPI together. I receive a HWND when the plugin starts up, and I passed it to D3D to draw.

虽然可以。测试页上的控件(400 * 300矩形)确实显示了我的期望。

It works though. the control(a 400 * 300 rectangle) on the test page DOES show what I expected.

但是FireFox窗口中的所有其他区域都是黑色的,包括菜单栏。测试页上的所有其他内容都看不到。

But all other area in FireFox window is black, including the menu bar. All other contents on the test page cannot be seen.

我只尝试了带有HWND的InitDevice(D3D),并且根本不进行渲染。但是仍然有同样的问题。

I tried just InitDevice(D3D) with the HWND and do NO rendering at all. But still got the same problem.

有人可以在这里帮助我吗?

Can anyone help me out here plz?

推荐答案

我已经见过几次这种情况。我遇到过两种不同的情况。首先是当我在D3D初始化中遇到一些奇怪的问题时,这似乎与firefox发生了冲突-但我仍然不确定要进行什么更改才能使其正常工作。

I've seen this happen a few times before; there are two different situations where I encountered it. The first is when I had something weird with my D3D initialization which aparently conflicted with firefox -- but I'm still not sure what I changed to get it working.

第二,我希望是您遇到的,是当我初始化D3D并尝试在主线程上绘制时。我的理论(未经证实)是Firefox实际上正在创建自己的某种DX上下文,因此在同一线程冲突上创建另一个DX上下文。当我们将init和绘图代码移到另一个线程时,所有这些都开始工作。

The second, which I hope is what you are encountering, is when I was initializing D3D and attempting to draw on the main thread. My theory (unproven) is that Firefox is actually creating its own DX context of some sort and so creating another one on the same thread conflicts. When we moved the init and drawing code to another thread it all started working.

这是 FireBreath 具有如此多的代码来帮助使事情变得线程安全,并允许跨线程调用javascript-每次我尝试使用OGL或DX在主线程上绘图时,

This is one reason that FireBreath has so much code to help make things threadsafe and allow cross-thread calls back to javascript -- every time I've tried to do drawing on the main thread with OGL or DX I've run into problems somewhere.

希望有帮助!

这篇关于使用NPAPI + D3D编写插件。它可以在Firefox上运行,但浏览器不可用。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆