discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Painting gnustep-gui into OpenGL


From: David Chisnall
Subject: Re: Painting gnustep-gui into OpenGL
Date: Wed, 27 Apr 2011 10:08:58 +0100

On 27 Apr 2011, at 10:01, Ivan Vučica wrote:

> On Wed, Apr 27, 2011 at 10:47, David Chisnall <theraven@sucs.org> wrote:
> 
>> Depending on the performance that you need, this can be trivial.  You can, 
>> for example, paint a view hierarchy into an NSImage and then point OpenGL at 
>> this texture.
>> 
> Can I paint windows that way too? What backend should I use to prevent them 
> from actually appearing on the screen?

Probably, if you use the view class that GNUstep uses when not using a window 
manager.  The simplest thing to do is create the views in a window that you 
don't draw, then call the draw method on the root view in your hierarchy after 
locking focus on the destination NSImage.  

This should all be back-end independent (should work on OS X too - I think 
there is an example on CocoaDev for rendering a view hierarchy to a texture, 
but I may have imagined it).

>> The difficult part is event handling.  You will need to construct NSEvent 
>> instances and inject them into your view hierarchy, after performing some 
>> transforms from the OpenGL coordinate space.
> 
> Calculating NSEvents that need to be injected isn't really a big deal once I 
> know how to paint stuff. :-)

Don't forget that you'll also be responsible for handling the redraws too.

If you're interested in working on this, then some of the code would actually 
be helpful for implementing CoreAnimation.  We have the ability with Opal to 
draw into layers (off-screen textures), but we're still doing the compositing 
with Cairo.  It might be better to use OpenGL for the compositing of layers, so 
we can move them around and do things like the CoreImage effects with some 
OpenGL shaders.

David

-- Sent from my IBM 1620


reply via email to

[Prev in Thread] Current Thread [Next in Thread]