Sign in to follow this  

Nehe Contest [FireFox Plugin] Accepting Theme Ideas!

This topic is 4659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey look ||v||atrix. Nehe posted the winamp contest entries! How about another mini contest? It would be cool if we could do a IE or Firefox plugin theme. It would be really neat to be able to render OpenGL on a webpage thru an embedded plugin that we create. Similar to flash swf files. --- What do you say??? --- [Edited by - tgraupmann on March 15, 2005 9:39:20 AM]

Share this post


Link to post
Share on other sites
I'm not sure the kind of plugin you're talking about. Do you mean embedded 3D graphics on a web page (like flash or java), or an add-in that displays 3D graphics in a side-bar (like google bar and-the-like) ? Would love clicking google buttons with fancy 2D/3D effects :)

Share this post


Link to post
Share on other sites
Quote:

Hey look ||v||atrix. Nehe posted the winamp contest entries!

How about another mini contest?

It would be cool if we could do a IE or Firefox plugin theme. It would be really neat to be able to render OpenGL on a webpage thru an embedded plugin that we create. Similar to flash swf files.

--- What do you say??? ---


To be honest, I really dont have the time anymore. I have a few other projects that I have to finish first before I can do anything else. I'll keep checking the forum and help where ever I can.

Cheers,
- llvllatrix

Share this post


Link to post
Share on other sites
It shouldn't be tough. We would start from basecode that draws a triangle in something like an iframe, but it's an embedded OpenGL plugin. It would be really cool if the plugin had access to the DOM, so you could grab vb and js variables off the page and use them in your OpenGL app. This would enable newbie programmers to do semi-network programming with a simple base code.

Hey there is an IE SDK:
[MSFT IE SDK]

[Edited by - tgraupmann on March 12, 2005 12:00:07 AM]

Share this post


Link to post
Share on other sites
Actually, I like the idea of doing a Firefox plugin. It seems like Firefox has [better documentation].

And this page has several plugin samples and examples.

Luckily there is a plugin SDK. And this nice HowTO on [Plug-in Basics].

The plugin SDK comes with several examples:


Basic plug-in:
Shows the bare bones of the plugin DLL. It does not do anything more than a 'Hello, World' for plug-ins. The basic plug-in demonstrates how the plugin DLL is invoked and how NPAPI methods are called. It can be used as a starting template for writing your own plug-in.


Simple plug-in :
This plugin example illustrates specific for Mozilla code base features. It is scriptable via javascript and uses services provided by the browser.

XPCOM interfaces are implemented in the simple plug-in so the Mozilla browser is aware of its capabilities. The plugin does not draw in the native window but rather uses javascript box to display the result of its work. Therefore, there are no separate projects for different platforms in this sample.


Scriptable plug-in:
Yet another example of plug-in scriptability. The scriptable plug-in implements two native methods callable from the javascript, and it draws in a native window, so it uses different projects for the different major platforms.


Windowless plug-in:
The windowless plug-in is an example of a plugin which does not use native window messaging mechanism and relies exclusively on NPP_HandleEvent to receive GUI messages for painting and other tasks. This plug-in simply draws a gray rectangle in the occupied area.


The technical aspects appear to be already worked out. And Firefox has really good documentation. The contest would be to run OpenGL code from within a Firefox plugin. The "Windowless" demo from the Gecko Plugin SDK uses Win32 calls to draw, so it shouldn't hard to get OpenGL to work. Here is a picture of the "Windowless Plugin":


Which was generated from code like this:

uint16 nsPluginInstance::HandleEvent(void* aEvent)
{
NPEvent * event = (NPEvent *)aEvent;
switch (event->event) {
case WM_PAINT:
{
if(!mWindow)
break;

// get the dirty rectangle to update or repaint the whole window
RECT * drc = (RECT *)event->lParam;
if(drc)
FillRect((HDC)event->wParam, drc, (HBRUSH)(COLOR_ACTIVECAPTION+1));
else {
RECT rc;
rc.bottom = mWindow->y + mWindow->height;
rc.left = mWindow->x;
rc.right = mWindow->x + mWindow->width;
rc.top = mWindow->y;
FillRect((HDC)event->wParam, &rc, (HBRUSH)(COLOR_ACTIVECAPTION+1));
}
break;
}
case WM_KEYDOWN:
{
Beep(1000,100);
break;
}
default:
return 0;
}
return 1;
}



All that needs to be done is render OpenGL to the RECT objects above.

[Edited by - tgraupmann on March 12, 2005 5:33:36 PM]

Share this post


Link to post
Share on other sites
With the help of shadowwz, we got the plugin working in Firefox.


Here is the [updated source] and posted a [test page].

You'll need the [Gecko Win32 SDK].

Unpack to the c:\ folder.

Unpack [Winless OpenGL Plugin] into the C:\GeckoPluginSDK-samples\Win32SDK\sdk\samples folder.

Compile the C:\GeckoPluginSDK-samples\Win32SDK\sdk\samples\winlessopengl\windows\npwinlessopengl.dsw workspace.

Share this post


Link to post
Share on other sites

This topic is 4659 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this