home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!gumby!kzoo!k044477
- From: k044477@hobbes.kzoo.edu (Jamie R. McCarthy)
- Subject: Re: simulating page-flipping via cluts
- Message-ID: <1992Sep11.163135.28084@hobbes.kzoo.edu>
- Organization: Kalamazoo College
- References: <18ja83INNk53@agate.berkeley.edu> <1992Sep10.182147.25618@hobbes.kzoo.edu> <1992Sep11.030344.1@vax1.umkc.edu>
- Date: Fri, 11 Sep 1992 16:31:35 GMT
- Lines: 57
-
- tmaehl@vax1.umkc.edu writes:
- >k044477@hobbes.kzoo.edu (Jamie R. McCarthy) writes:
- >
- >> If you're clut-flipping to simulate page-flipping,
- >> [you need every single color]
- >
- >Two questions: How do you simulate page-flipping with clut-flipping??
- >
- >And second: Wouldn't this fail to accomplish anything at all on
- >a direct color screen, or am I *completely* misunderstanding (a
- >distinct possibility.)
-
- The easy one first: yes, clut-flipping does nothing on a direct-color
- screen. In fact, a direct-color screen doesn't even have a color table
- to flip.
-
- Clut flipping is a nasty little technique that lets you pretend you have
- two video pages, each of which has half as many bits per pixel as the
- real video page. In short, you split each pixel in half, and alternate
- between setting the clut so that one half is visible and the other half
- not. An example might help clarify.
-
- Let's say we're working on an 8-bit-deep screen. Conceptually, split
- each pixel into two 4-bit halves, call them left and right. To set the
- pixel at x,y on the left video page to, say, color 7, you set the high
- four bits of the actual pixel at x,y to 7, without disturbing the low
- four bits. To set the pixel on the right video page to color 4, you set
- the low four bits to 4 without disturbing the high four bits.
-
- Let's say the palette we're using is sixteen shades of gray. (Note that
- you only get sixteen colors, since each page gets only four bits per
- pixel. Note also that you can have different palettes for the left and
- the right page, and that there's actually a good use for that: there
- are glasses that sync to your monitor that use LCD shutters to give a
- decent 3-D effect. But I digress.) Then, to display the left page, you
- set colors 0x00-0x0F to black, 0x10-0x1F to dark gray, ... , 0xF0-0xFF
- to white. To display the right page, you set 0x00, 0x10, ... 0xF0 to
- black, 0x01, 0x11, ... 0xF1 to dark gray, and so on.
-
- Note that you don't have to use hi-nybble/lo-nybble for left and right
- pages; you can split up the pixel any way you want. It doesn't even
- have to be an even split, and you can split it as many ways as there are
- bits in the pixel in the first place. If you don't mind having only two
- colors and seeing the same eight frames over and over, you can do
- eight-position full-screen animation at whatever your monitor's refresh
- rate is, using just a tiny fraction of CPU power.
-
- Note also that, if the palette(s) for your virtual pages all have all
- their bits clear for white and all their bits set for black, you can
- leave those two colors where they are, and the Palette Manager will be
- usable. (Though I'll concede that there's no good reason not to use
- SetEntries instead of AnimatePalette when you're getting this
- low-level...)
- --
- Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
- "I may not understand what you say, but I'll defend to your death
- my right to deny it." - Albert, from 'Outrageously Pogo'
-