Graphics Programming Black Book

  • Uploaded by: bagsta_contest
  • 0
  • 0
  • March 2021
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Graphics Programming Black Book as PDF for free.

More details

  • Words: 1,631
  • Pages: 1,262
Loading documents preview...
Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

The brute-force searching technique. Figure 5.1

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

a flow lo g the Gr p Controller: Data through Graphics g 5. Figure 25.1

Bit mask operation. Figure 25.2

Data

flow

Figure 25.3

during a write mode 0 write operation.

Previous

Home

Next

Previous

Home

Next

VGA data flow in write mode 2. Figure 27.1

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

f VGA Color Generation t the VGA’s 4bit to 8-bit to 18-bitcolor translation. d out how to generate a look-up table containing efault color palette. And surely they are only the ing programmers from every corner of the planet are no doubt tearingthe place up looking for a discussion of VGA color, and venting their frustration at my mailbox. Let’s have i t, they’ve said, clearly and in considerable ics might say, who is this humble writer to disagree? hope you all know what you’re getting into. To paraphrase ter (and more confusing) than the average board. There’s the basic 8-bit to 18-bit translation, there’s the EGA-compatible 4bit to 6-bit translation, there’s the 2- or 4bit color paging register that’s used to pad 6- or 4bit pixel values out to 8 bits, and then there’s 256-color mode. Fear not, it will all make sense in the end, but it may take us a couple of additional chapters to get there-so let’s get started. Before we begin, though, I must refer you to Michael Covington’s excellent article, “ColorVision and the VGA,”in the June/July 1990 issue of PC TECHNIQUES. Michael, one of the most brilliant people it has ever been my pleasure to meet, is an expert in many areas I know nothing about, including linguistics and artificial intelligence. Add to that list the topic of color perception, for his article superbly describes the mechanisms by which we perceive color and ties that information to the VGA’s capabilities. After reading Michael’s article, you’ll understand what colors the VGA is capable of generating, and why.

625

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous Home

Next

Previous

Home

Next

725

728

Chapter 39

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

e the VGA Really Get up and Dance rmative anecdotes to kick off this chapter; lotta re impatient, I can smell it. I won’t talk about the of loudly saying “$100 bill” during an animated discussion while wa ums on Market Street in San Francisco one night, context is everything. I can’t spare a word about how my daughter thinks my 11-year-old floppy-disk-based CP/M machine is more 6 with its 100-MB hard disk because the CP/M machine’s word runs twice as fast as the 386’s Windows-based word processor, rogress is not the neat exponential curve we’d like to think it is, and that features and performance are often conflicting notions. And, lord knows, I can’t take the time todiscuss the habits of small white dogs, notwithstanding that such dogs seem to be relevant to just about every aspect of computing, as Jeff Duntemann’s writings make manifest. No lighthearted fluff for us; we have real work to do, for today we animate with 256 colors in Mode X. ground to cover, g

Masked Copying Over the past two chapters, we’ve put together most of the tools needed to implement animation in the VGA’s undocumented 320x240 256-color Mode X. We now have mode set code, solid and 4x4 pattern fills, system memory-to-display memory block copies, and display memory-to-display memory block copies. The final piece

915

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

's Color Model in an Once she turned six,my daughter wanted some fairly sophisticated books read to use on the Prairie. Pretty heady stuff for one so young, her. Wind in the Willows and sometimes I wondered how much of it she really understood. As an experiment, during one reading)! stopped whenever I came to a word I thought she might not know, and asked her what it meant. One such word was “mulling.” ulling’ means?”I asked. r a while, then said, “Pondering.” e than a little surprised. She smiled and said, “But,Dad, how do you know that I know what ‘pondering’means?” “Okay,”I said, ‘What does ‘pondering’ mean?” “Mulling,”she said. What does this anecdote tell us about the universe in which we live? Well, it certainly indicates that this universe is inhabited by at least one comedian and one good straight man. Beyond that, though, it can be construed as a parable about the difficulty of defining things properly; for example, consider the complications inherent in the definition of color on a 256-color display adapter such as the VGA. Coincidentally, VGA color modeling just happens to be this chapter’s topic, and the place to start is with color modeling in general.

1033

Previous

Home

Next

Using reverse transformation to find the source pixel colol:

Figure 56.1 56.

Mapping a texture onto an untransformed polygon Figure 56.2

Previous

Home

Next

le of Experience in Implementing Fast, Mapping ning how to shear a sheep. Among other things, I the importance of selecting the proper comb for who holds the world’s record for sheep sheared in serves), and discovered, Lord help me, the many Zealand Sheep Shearing Board improves the a p ry year. The fellow giving the presentation did his n’t very interesting. If you have children, you’ll f you don’t, there’s no use explaining. one thing that stuck with me, although it may not sound particularly profound. (Actually, it sounds pretty silly, but bear with me.) He said, ‘You don’t get really good at sheep shearing for 10 years, or 10,000 sheep.” I’ll buy that. In fact, to extend that morsel of wisdom to the greater, non-ovine-centric universe, it actually takes a good chunk of experience before you get good at anything worthwhile-especially graphics, for a couple of reasons. First, performance matters a lot in graphics, and performance programming is largely a matter of experience. You can’t speed up PC graphics simply by looking in a book for a better algorithm; you have to understand the code C compilers generate, assembly language optimization, VGA hardware, and the performance implications of various graphics-programming approaches and algorithms. Second, computer graphics is a

1063

Previous

Home

Next

hole-Brain Approach to Accelerate reading several of the works of Robert A. Heinlein, a teenager-but in a different way. The first time r romance of technology married to powerful stol by The Master’s remarkable prescience. ‘‘Blowups lear power, and their effects on human psycholon had ever happened on this planet. “Solution out the unsolvable dilemma-ultimate offense, no defense941. And in Between Planets (1951), consider this minor bit of action: The doctor’s phone regretted politely that Dr. Jefferson was not at home and requested him to leave a message. He was dictating it when a warm voice interrupted: ‘I’m at home to you, Donald. Where are you, lad?’ Predicting the widespread use of answering machines is perhaps not so remarkable, but foreseeing that they would be used for call screening is; technology is much easier to extrapolate than are social patterns. Even so, Heinlein was no prophet; his crystal ball was just a little less fuzzy than ours. The aforementioned call in Between Planets was placed on a viewphone; while that technology has indeed come to pass, its widespread use has not. The ultimate weapon

1079

Previous

Home

Next

1097

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

The substance described by node E. Figure 64.3

Figure 64.4

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

Previous

Home

Next

1252

Chapter

68

Previous

Home

Next

Previous

Home

Next

Previous

matrix math, assembly routines, 992,

996-999 ModelColoffoColorIndexfunction, 1036, 1038 older processors, support for, 10071008, 1008-1023 overview, 984-985 POLYG0N.H header file, 982-984 RGB color model mapping to 256-color mode, 1036, 1037-1038, 1039 overview, 1034-1035 RotateAndMovePObject function, '

977-978

X n o r f A rn d P a o r e jc t hnction, 974 XformVec function assembly implementation, 996-997,

1017-1019 C implementation, 976 XSortAET function complex polygons, 748 monotone-vertical polygons, 769

Y Yaw angle, in polygon clipping, 1206 Y-clipping, in BSP tree rendering, 1159

Z Z-buffers performance, 1213 Quake 3-D engine, 1285-1286 vs. sorted spans, 1215 sorting moving models, 1212-1213 Z-clipping, in BSP tree rendering, 1158 Zen timer See also Long-period Zen timer. calling, 48

Index

Home

calling from C code, 69-72 and DRAM refresh, 99 and interrupts, 43 interval length, 45 overhead of, timing, 46, 72 PC compatibility, 48-49 precision, 48, 52 prefetch queue cycle-eater, 88, 92 PS/2 compatibility, 66 PZTEST.ASM listing, 49 PZTIME.BAT listing, 51 PZTIMER.ASM listing, 35-42 ReferenceZTimerOff subroutine, 41 ReferenceZTimerOn subroutine, 40 reporting results, 47 starting, 43 stopping, 46 system clock inaccuracies, 43, 45-46, 48 test-bed program, 48-52 TESTCODE listing, 50 timing 486 code, 245-246 ZTimerOff subroutine, 38-41, 46-47 2TimerOn subroutine, 37-38, 43 ZTimerReport subroutine, 41-42, 47-48 Zero-wait-state memory, 21 1 Z-order display, masked images, 872 Z-sorting, for hidden surface removal, 1220-1222 ZSortObjects function, 1201 ZTimerOff subroutine long-period Zen timer, 59-63 Zen timer, 38-41, 46-47 ZTimerOn subroutine long-period Zen timer, 58-59 Zen timer, 37-38, 43 ZTimerReport subroutine long-period Zen timer, 63-65 Zen timer, 41-42, 47-48

Related Documents