Quoting Sorin Otescu:
> Anyway, why does the layer need 2 surfaces? It seems one of them is 
> never used and it just eats up memory - or am I wrong?

See below :)

> >It depends on which layer context is bound to the layer interface. If the
> >interface is in SHARED or ADMINISTRATIVE mode, it's the primary layer 
> >context,
> >i.e. the shared context (window stack). If the interface is put in 
> >EXCLUSIVE
> >mode, a new (private) layer context is created and activated. The primary 
> >layer
> >context's region is unrealized and the private one is realized.
> >
> > 
> >
> Ok, so how can I apply the changes in ADMINISTRATIVE mode?

See below :)

> >Do you call GetDisplayLayer() more than once? Are you using 
> >CreateSurface(PRIMARY)
> >in conjunction with the layer interface?
> >
> > 
> >
> I call CreateSurface(PRIMARY | DOUBLE) before I call GetDisplayLayer() 
> (which I only call once).

CreateSurface(PRIMARY) is an API shortcut and creates its own exclusive
layer context or creates a window on the shared layer context, depending
on the cooperative level of IDirectFB. This is a nice simplification of
the APIs and allows the user to choose between windowed and fullscreen
mode. But it's not meant to be used by sophisticated applications. Mostly
games, demos and libraries for such should use it.

I guess you set DFSCL_FULLSCREEN before calling CreateSurface(),
so that is 'expanding' to:
- GetDisplayLayer()
- SetCooperativeLevel(EXCLUSIVE)
- SetConfiguration()
- GetSurface()

So your primary surface has an implicitly created private layer context (#1)
over which you don't have any control, i.e. no interface.

Using GetDisplayLayer() afterwards, you get the shared layer context (#2).

You should remove the IDirectFB based initialization and use:

- GetDisplayLayer()
- SetCooperativeLevel(EXCLUSIVE)
- SetConfiguration()
- GetSurface()
- SetScreenRectangle()
- ...


This way you have one IDirectFBDisplayLayer with a private context under your
full control and the corresponding IDirectFBSurface.

If you want to use windows on the layer instead of using its surface directly,
just change EXCLUSIVE to ADMINISTRATIVE and use CreateWindow() instead of
GetSurface(). If you don't need control over the layer and just want to create
windows, you only need to call CreateWindow() after GetDisplayLayer().

Hope this isn't too confusing...

-- 
Best regards,
  Denis Oliver Kropp
 
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to