Hello Lucas,

drawing should happen inside the FLTK widgets virtual draw() function and 
in the main thread.

You could write:
class Irrlicht_Fltk : public Fl_Window
{
   public:
   // some needed initialisation
   ...
   Irrlicht_Fltk( int X, int Y, const char * title) , Fl_Window(X,Y,title)
   {};

   draw()
   {
                device->getVideoDriver()->beginScene();
                device->getSceneManager()->drawAll();
                device->getVideoDriver()->endScene();
   };
}

   Irrlicht_Fltk * win = new Irrlicht_Fltk(340,180,"muh");
   ...

FLTK will call your Irrlicht_Fltk::draw() function to draw the window.
If that works, you need a timeout to ping FLTK to redraw.

kind regards
Kai-Uwe Behrmann
-- 
developing for colour management 
www.behrmann.name + www.oyranos.org


Am 31.03.11, 13:44 -0700 schrieb Lucas:
> Hi guys,
>
> I'm trying to combine Irrlicht and FLTK into one window.
>
> This works well on a Windows machine, but when I try it on a Mac I have some 
> problems.
> I can get it to work when using Irrlicht's software renderer, but when using 
> the OpenGL renderer it doesn't work and I get an "invalid drawable" error (I 
> also get this error with the software renderer, although it works).
>
> I hope someone on this Forums use both libraries and can help me.
>
> Thank you in advance,
> -Lu
>
>
>
> PS:
> Here is the code that works (although using the software renderer):
>
> [code]
> #include "FL/Fl.H"
> #include <FL/Fl_Window.H>
> #include "FL/x.H"
> #include "irrlicht.h"
>
> int main(int argc,char** argv)
> {
>       //Create FLTK window
>       Fl_Window* win = new Fl_Window(340,180,"muh");
>       win->end();
>       win->show(argc, argv);
>
>       //Create Irrlicht device
>       irr::SIrrlichtCreationParameters params;
>       params.WindowId = (void*)fl_xid( win );
>       params.DriverType = irr::video::EDT_SOFTWARE;
>       params.WindowSize = irr::core::dimension2du(340,180);
>
>       irr::IrrlichtDevice* device = irr::createDeviceEx(params);
>
>       //Update FLTK and Irrlicht
>       while(Fl::check()) {
>               device->getVideoDriver()->beginScene();
>               device->getSceneManager()->drawAll();
>               device->getVideoDriver()->endScene();
>       }
>
>       return 0;
> }
> [/code]

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to