Thread View: comp.sys.amiga.tech
2 messages
2 total messages
Started by Kenneth D Jordan
Mon, 15 Apr 1991 13:22
Question re. double buffering / Intuition
Author: Kenneth D Jordan
Date: Mon, 15 Apr 1991 13:22
Date: Mon, 15 Apr 1991 13:22
32 lines
2563 bytes
2563 bytes
In the course of writing various scientific applications I've often required double buffering for my animations. The problem is that I've never been able to successfully attach gadgets to the active window nor have I been able to open another window or requester. In the past I simply avoided the problem by restricting user interation to menu bars (which was consistent with those applications). Now, however, I want and need the other features of Intuition. Briefly, my code allocates and initializes two RastPorts and BitMaps ala the RKM, opens a custom screen with the CUSTOMBITMAP flag set, and opens a window on that screen. (The actual code is quite large, and extracting the relevant portions into a small test case is rather painful.) Maintaining a pointer to the RastPort to be used for rendering is sufficient to make use of the various graphics and Intuition system functions which require a pointer to a RastPort. My problem arises when calling other functions such as OpenRequester, OpenWindow, and AddGadget, which require something other than the RastPort. These end up appearing anywhere: on the correct RastPort, on the alternate RastPort, or (I think) somewhere else altogether. When opening requesters the border often ends up on the correct RastPort but the gadgets never appear. Letting rp be a pointer to the rendering RastPort (which works for functions which require a ptr to a RastPort) and win be a pointer to the window, I've tried things like win->RPort = rp and win->BorderRPort = rp before opening a requester, but there's no apparent effect. Any suggestions (including pointers to PD code which exhibits gadgets or requesters on double buffered screens) would be greatly appreciated. Please send mail to nystrom@a.psc.edu. Thanks! -------------------------------------------------------------------------------- Nick Nystrom Chemistry Department University of Pittsburgh nystrom@a.psc.edu --------------------------------------------------------------------------------
Re: Question re. double buffering / Intuition
Author: Jean-Michel Forgeas
Date: Tue, 16 Apr 1991 10:21
Date: Tue, 16 Apr 1991 10:21
55 lines
2813 bytes
2813 bytes
In article <115475@unix.cis.pitt.edu>, Kenneth D Jordan writes:
> My problem arises when calling other functions such as OpenRequester,
> [..] When opening requesters
> the border often ends up on the correct RastPort but the gadgets never appear.
> Letting rp be a pointer to the rendering RastPort (which works for functions
> which require a ptr to a RastPort) and win be a pointer to the window, I've
> tried things like win->RPort = rp and win->BorderRPort = rp before opening a
> requester, but there's no apparent effect.
RastPorts are not the thing, just the bitplanes of the display.
You need only to swap pointers to the new set of bitplanes into
the window/screen bitmap, and call MakeVPort() and MrgCop().
Or you can directly swap the copper lists if you want.
If you don't want Intuition to draw into your imagery, lock one
or all the layers which are into the screen. Intuition will not
even move prop gadgets while swaping, and will do it nicely after.
Call all your rendering routines inside the 'swap' routine.
For example to open a requester:
Swap( myOpenRequest );
and here is the myOpenRequest() function:
myOpenRequest()
{
if (Request( Req, WorkWindow ))
WaitIDCMP( WorkWindow, REQSET );
}
Swap( func )
VOID (*func)();
{
LockLayer(); // lock the display
BltBitMap(); // copy the display to hidden bitmap
WorkWindow->RPort->BitMap = bm; // swap the bitplanes
sc->BitMap.Planes[...] = bm->Planes[...];
if (func) (*func)(); // your rendering to hidden bitmap
MakeVPort(); // the hidden becomes the display
MrgCop();
UnlockLayer(); // unlock the display
}
That's just the beginning, you have work to do!
And think about the fact that the modification of these pointers
is perhaps not supported under 2.0 or 5.0...
Perhaps Peter Cherna have a better solution ?
--
\___/
Jean-Michel Forgeas \-/
cbmvax!cbmehq!cbmfra!swinjm!forgeas | The Software Winery
-^-
And, where is the universe ?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads