I've been doing some good stuff with the engine, but now I'd like to embed it inside Firefox, under Linux.
I got my plugin ready to be compiled, if I use the traditional createDevice function, it creates a new window and renders fine.
But if I use createDeviceEx with the params I specified, it doesn't render anything, it does something like this :
http://img25.imageshack.us/my.php?image=arghhh.jpg
This is where the X stuff create's it's own window to render inside the canvas of the firefox plugin :
Code: Select all
NPError nsPluginInstance::SetWindow(NPWindow* aWindow)
{
if(aWindow == NULL)
return FALSE;
mX = aWindow->x;
mY = aWindow->y;
mWidth = aWindow->width;
mHeight = aWindow->height;
if (mWindow == (Window) aWindow->window) {
// The page with the plugin is being resized.
// Save any UI information because the next time
// around expect a SetWindow with a new window id.
} else {
mWindow = (Window) aWindow->window;
NPSetWindowCallbackStruct *ws_info = (NPSetWindowCallbackStruct *)aWindow->ws_info;
mDisplay = ws_info->display;
mVisual = ws_info->visual;
mDepth = ws_info->depth;
mColormap = ws_info->colormap;
if (!mFontInfo) {
if (!(mFontInfo = XLoadQueryFont(mDisplay, "9x15")))
printf("Cannot open 9X15 font\n");
}
// add xt event handler
Widget xtwidget = XtWindowToWidget(mDisplay, mWindow);
if (xtwidget && mXtwidget != xtwidget) {
mXtwidget = xtwidget;
long event_mask = ExposureMask;
XSelectInput(mDisplay, mWindow, event_mask);
XtAddEventHandler(xtwidget, event_mask, False, (XtEventHandler)xt_event_handler, this);
/*
*
* Beginning of IRRLICHT Init Code!
*
*/
SIrrlichtCreationParameters param;
param.WindowId = reinterpret_cast<void*>(mWindow);
param.DriverType = EDT_SOFTWARE;
param.WindowSize = dimension2d<s32>(mWidth,mHeight);
device = createDeviceEx(param);
//device = createDevice( video::EDT_OPENGL, dimension2d<s32>(mWidth, mHeight), 32, false, false, false, 0);
driver = device->getVideoDriver();
smgr = device->getSceneManager();
guienv = device->getGUIEnvironment();
guienv->addStaticText(L"Hello World!", rect<s32>(10,10,260,22), true);
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
/*
*
* End of IRRLICHT Init Code!
*
*/
}
}
draw();
return TRUE;
}
Code: Select all
void nsPluginInstance::draw()
{
if (device->run()) {
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
/*
*
* Blah blah blah, go away X...
*/
/*unsigned int h = mHeight/2;
unsigned int w = 3 * mWidth/4;
int x = (mWidth - w)/2; // center
int y = h/2;
if (x >= 0 && y >= 0) {
GC gc = XCreateGC(mDisplay, mWindow, 0, NULL);
if (!gc)
return;
XDrawRectangle(mDisplay, mWindow, gc, x, y, w, h);
const char *string = getVersion();
if (string && *string) {
int l = strlen(string);
int fmba = mFontInfo->max_bounds.ascent;
int fmbd = mFontInfo->max_bounds.descent;
int fh = fmba + fmbd;
y += fh;
x += 32;
XDrawString(mDisplay, mWindow, gc, x, y, string, l);
}
XFreeGC(mDisplay, gc);
}*/
}
I've heard about creating a parent window inside the mWindow for Win32, but I don't know how to do that with X... Weird...Irrlicht Engine version 1.5
Linux 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686
Creating X window...
Visual chosen: : 33
X Error: BadWindow (invalid Window parameter)
From call : X_CreateWindow
X Error: BadWindow (invalid Window parameter)
From call : X_ChangeProperty
X Error: BadWindow (invalid Window parameter)
From call : X_ConfigureWindow
X Error: BadWindow (invalid Window parameter)
From call : X_MapWindow
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_GetGeometry
X Error: BadWindow (invalid Window parameter)
From call : X_GetProperty
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_CreatePixmap
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_CreatePixmap
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_CreateGC
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PolyFillRectangle
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PolyFillRectangle
X Error: BadPixmap (invalid Pixmap parameter)
From call : X_CreateCursor
X Error: BadGC (invalid GC parameter)
From call : X_FreeGC
X Error: BadPixmap (invalid Pixmap parameter)
From call : X_FreePixmap
X Error: BadPixmap (invalid Pixmap parameter)
From call : X_FreePixmap
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
X Error: BadDrawable (invalid Pixmap or Window parameter)
From call : X_PutImage
Thanks a lot for your help, I will seriously need it.