home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!cs.utexas.edu!torn!maccs!xenidis
- From: xenidis@maccs.dcss.mcmaster.ca (Jimi X)
- Subject: Re: Simple page-flipping animation on X-Windows
- Message-ID: <1992Sep11.185357.5467@maccs.dcss.mcmaster.ca>
- Organization: Department of Computer Science, McMaster University
- References: <1992Sep8.223544.20768@cbnewsl.cb.att.com>
- Date: Fri, 11 Sep 1992 18:53:57 GMT
- Lines: 52
-
- In article <1992Sep8.223544.20768@cbnewsl.cb.att.com> conty@cbnewsl.cb.att.com (OtakuRoach) writes:
- >
- >I didn't see this on the 600+ backlogged postings, neither did I see a
- >FAQ, sooo:
- >
- > As a project for a CompGraphics course, I need to animate some
- > lines converging into a wireframe image. The program is already
- > written, but I'm drawing everything to the same GC, which can be
- > rather annoying if I have to erase and redraw the screen several
- > times per second. I was thinking of perhaps creating another GC,
- > and do a GC-flipping routine. Now, how do I go about determining
- > which GC is displayed on the screen? My professor wasn't of any
- > help. He doesn't use X for his work, and the class assignments
- > assume MS-DOS with VGA graphics (I'm the weird guy doing his
- > assignments on X because he doesn't have a PC).
- >
- >If you can help, please e-mail at the address below. Thank you.
- >No, I'm not a regular reader of comp.windows.x.
- >--
- > E n r i q u e C o n t y
- > The Incredible Man-with-no-Life
- > jester@ihlpl.att.com
- > Disclaimer: You're not dealing with AT&T
-
- The best way to do this, at least from what I have used, is to create two GC's
- one GC is for drawing and another GC for "undrawing".
-
- Draw your figure using the XDrawLines() Xlib functions that draws more than
- one line in a single X Protocol Routine then XFlush() your display.
-
- To animate use the XDrawLines() again with your undraw GC and then
- XDrawLines() with your draw GC and then flush.
-
- This emulates page flipping because after a draw request you only see that
- figure when you:
-
- a) fill up the Request Queue
- b) force the queue to be flushed [XFlush]
-
- This Works wonders with machines that have a large Request Queue ( >= 64k )
-
- To REALLY SPEED things up. get a hold of the Source for these Xlib Functions
- and cat them together excluding the commands that flush sync and do thing that
- is not necessary between them and then flush at the end.
-
- It may also be better to calculate the horizontal and vertical span and use
- XClearArea() but I doubt it.
-
-
- GOOD LUCK
- -jimi x
-
-