[webkit-dev] Question about OpenGL and NPAPI plugins
dchavarria at divxcorp.com
Fri Mar 30 12:05:24 PDT 2007
Ye almighty gods of teh WebKit,
I am writing a web browser plugin for Mac (Firefox, Safari, ..) so I
built a .plugin bundle using the oldish NPAPI and Carbon. Everything is
going rather fine but my problem is that my plugin uses OpenGL (AGL) to
draw its contents.
I implement some logic the NPP_SetWindow() method that the browser is
calling on my plugin to determine where I need to draw in the browser
window and how I need to clip by looking at the clipRect and the port x
and y in the structure I receive. Since the OpenGL surface is above
pretty much everything on the window I need to be careful not to
overwrite anything when the contents are scrolled.
While my code seems to work fine with Firefox and Camino, I can't get it
to behave ok in Safari. What happens is that when I scroll the page
(using the mouse wheel or the scrollbars) my plugin leaves artifacts on
the rest of the HTML page in Safari. It doesn't go "out" of the HTML
scrolled viewport frame but leaves slices of it's content around where
it's been moved.
I used AGL_BUFFER_RECT and glScissor() in my OpenGL rendering to place
and clip the contents of the plugin UI.
I don't know if they are other browser plugins out there that still use
the older NPAPI and are able to render OpenGL contents in Safari or if
there is a workaround I could experiment. I think I have the option to
write a NSView-based .webplugin to fix this but if there is a shorter
term fix that could help me quite a bit.
I have tried my plugin with the latest WebKit nighlty and it still shows
the problem so I am turning to you guys for help :)
Let me know if you need more details.
More information about the webkit-dev