Graphics Reference
In-Depth Information
A frame buffer is an interface between what are usually relatively slow graphics compu-
tations and the high data rate video image display. In the typical personal computer the
frame buffer is located on the graphics card that manages the video subsystem of the
computer. It basically used to be not much more than some extra memory. For example,
the table below describes the frame buffers used by the IBM PC family of computers:
Type
Size of frame buffer
Starting memory address (in hexadecimal)
CGA
16 K
B800:0000
Hercules
64 K
B000:0000
EGA,VGA
256 K for 16 colors
accessed via a 64 K window starting at A000:0000
super VGA
1 M or more
accessed via a 64 K window starting at A000:0000
Over time the graphics subsystems of personal computers have become more power-
ful, and the hardware is supporting more and more of the operations that one needs
to perform in graphics, such as antialiasing (Section 2.6) and the bit map operations
discussed below and in Section 2.10. They also have additional buffers, such as a z-
buffer (Chapter 7), texture buffers (Chapter 9), or stencil buffers (for masking opera-
tions). This support only used to be found on high-end graphics workstations.
As indicated above, displaying objects on the computer screen involves writing to
the frame buffer. This amounts to storing values in memory. Ordinarily, a store opera-
tion replaces the value that was there. In the case of frame buffers one has more
options. If A is a location in memory, then let [A] denote the content of A. Frame buffers
typically support store operations of the form (V op [A]) Æ [A], where V is a new value
and op is a binary logical operator that operates on a bit-by-bit basis. Typical binary
logical operations on bits are or , and , xor , and replace . The statement (V replace [A])
Æ [A] corresponds to the standard store operation where the new value replaces the
old one. When a frame buffer uses a store operation corresponding to an operator op ,
we shall say that it is in op mode . For example, we may talk about being in xor mode.
As a simple example of how having various modes for a frame buffer can be useful,
consider how the standard quick and dirty method used to move a cursor around on
the screen without destroying the background uses the xor mode. The method relies
on xor 's well-known property that
(
) =
b
xor
b
xor
a
a
.
What this means is that if one xor 's the same value to a memory location twice in a
row, then that memory location will hold its original value at the end. Now, a straight-
forward way to move a cursor on the screen without erasing what is there would be
to save the area first before writing the cursor to it and then restoring the old value
after the cursor has moved. This would be very time consuming. There is a much
better way of using the xor mode. Assume that the cursor starts out at some initial
position defined by a variable oldA. Now switch into xor mode and repeat the fol-
lowing three steps as often as desired:
Draw cursor at oldA (this will erase the cursor)
Draw cursor at new position newA
Replace the value in oldA with that in newA
Search WWH ::




Custom Search