On 13 Jan 2013, at 20:59, Christopher James Huff wrote:

> Is there a recommended approach to drawing FLTK widgets inside or on 
> top of an OpenGL window?

Not as such... 

> I see a few ways to approach this. The simplest way to get quick 
> results seems to be to subclass widgets to provide OpenGL draw() 
> methods and write an OpenGL window draw method that draws its children. 

And indeed Matthias has a demo doing exactly that, erm... somewhere... I can't 
find the link right now.

This was code he put up years ago, but AFAIK it ought to still work fine with 
fltk-1.3.


> A more general but also more complex approach would be write an OpenGL 
> output driver (has anyone else written such a thing already?),


Which would be the preferred way, at least with fltk-1.3, if anyone could ever 
get around to writing the code...

With fltk-1.3, the driver layer was abstracted away, with the specific intent 
of making it easier to implement alternate low-level code; obviously the 
initial intent was to make it easier to have the X11/WinXX/Cocoa and printing 
layers work, but the idea was always to make a GL layer (and others, e.g. 
framebuffer, whatever,) possible.

But so far no one has had the time...

A volunteer, they say, is worth 10 pressed men... (that's a hint, by the way, 
just in case you have a little time to throw at this - we'd appreciate it!)


> or 
> somehow draw widgets to an image which is then drawn in OpenGL (could 
> an existing driver easily be modified to do this?). Are there other 
> options, or anything in particular to watch out for when doing one of 
> these?

This is also feasible, you'd use the existing drawing mechanisms to render to 
an off-screen buffer, then pass that buffer to the GL context for display, I 
guess.

Note that *some* platforms (I think OSX for sure and maybe, IIRC, X11 in fltk2) 
use essentially this technique to render font faces in GL contexts, by drawing 
the glyphs (or in the OSX case entire strings) into a buffer then passing that 
to GL for rendering into the scene.

But I think an actual GL driver layer would work better... Though handling of 
fonts might always be problematic - drawing TT fonts in Windows GL is actually 
easier. MS did do some useful things after all!



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

Reply via email to