Outils pour utilisateurs

Outils du site


back2root:archives:denthor:part-02

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
back2root:archives:denthor:part-02 [2023/05/18 20:30] – [How do I stop the "fuzz" that appears on my screen when I change the pallette?] fraterback2root:archives:denthor:part-02 [2023/05/20 23:28] (Version actuelle) – [How do I stop the "fuzz" that appears on my screen when I change the pallette?] frater
Ligne 1: Ligne 1:
 ===== PART 02 : Colors palette ===== ===== PART 02 : Colors palette =====
  
-Hi there again! This is Grant Smith, AKA Denthor of ASPHYXIA. This is the second part of my Training Program for new programmers. I have only had a lukewarm response to my first part of the trainer series ... remember, if +Hi there again! This is Grant Smith, AKA Denthor of ASPHYXIA. This is the second part of my Training Program for new programmers. I have only had a lukewarm response to my first part of the trainer series ...  
-I don't hear from you, I will assume that you are all dead and will stop writing the series ;-). Also, if you do get in contact with me I will give  you some of our fast assembly routines which will speed up your demos no + 
-end. So go on, leave mail to GRANT SMITH in the main section of the MailBox BBS, start up a discussion or ask a few questions in this Conference, leave mail to ASPHYXIA on the ASPHYXIA BBS, leave mail to Denthor on +remember, if I don't hear from you, I will assume that you are all dead and will stop writing the series ;-).  
-Connectix, or write to  + 
 +Also, if you do get in contact with me I will give  you some of our fast assembly routines which will speed up your demos no end. So go on, leave mail to GRANT SMITH in the main section of the MailBox BBS, start up a discussion or ask a few questions in this Conference, leave mail to ASPHYXIA on the ASPHYXIA BBS, leave mail to Denthor on Connectix, or write to  
 <code> <code>
 Grant Smith, Grant Smith,
Ligne 18: Ligne 19:
 Most of these quesions will be answered in this, the second part of my Trainer Series for Pascal. Most of these quesions will be answered in this, the second part of my Trainer Series for Pascal.
  
-==== What is the Pallette? ====+==== What is the Palette? ====
  
 A few weeks ago a friend of mine was playing a computer game. In the game there was a machine with stripes of blue running across it. When the machine was activated, while half of the the blue stripes stayed the same, the other half started to change color and glow. He asked me how two stripes of the same color suddenly become different like that. The answer is simple:  A few weeks ago a friend of mine was playing a computer game. In the game there was a machine with stripes of blue running across it. When the machine was activated, while half of the the blue stripes stayed the same, the other half started to change color and glow. He asked me how two stripes of the same color suddenly become different like that. The answer is simple: 
  
-the program was changing the pallette. As you know from Part 1, there are 256 colors in MCGA mode, numbered 0 to 255. What you don't know is that each if those colors is made up of different intensities of Red, Green and Blue, the primary colors (you should have learned about the primary colors at school). These intensities are numbers between 0 and 63. The color of bright red would for example be obtained by setting red intensity to 63, +the program was changing the palette. As you know from Part 1, there are 256 colors in MCGA mode, numbered 0 to 255.  
-green intensity to 0, and blue intensity to 0. This means that two colors can look exactly the same, eg you can set color 10 to bright red and color 78 to color bright red. If you draw a picture using both of those colors, + 
-no-one will be able to tell the difference between the two.. It is only when you again change the pallette of either of them will they be able to tell the difference. Also, by changing the whole pallette, you can obtain +What you don't know is that each if those colors is made up of different intensities of Red, Green and Blue, the primary colors (you should have learned about the primary colors at school). 
-the "Fade in" and "Fade out" effects found in many demos and games.+ 
 +These intensities are numbers between 0 and 63. The color of bright red would for example be obtained by setting red intensity to 63, green intensity to 0, and blue intensity to 0.  
 + 
 +This means that two colors can look exactly the same, eg you can set color 10 to bright red and color 78 to color bright red.  
 + 
 +If you draw a picture using both of those colors, no-one will be able to tell the difference between the two..  
 + 
 +It is only when you again change the palette of either of them will they be able to tell the difference.  
 + 
 +Also, by changing the whole palette, you can obtain the "Fade in" and "Fade out" effects found in many demos and games.
  
-Pallette manipulation can become quite confusing to some people, because colors that look the same are in fact totally seperate.+Palette manipulation can become quite confusing to some people, because colors that look the same are in fact totally separate.
  
 ==== How do I read in the pallette value of a color? ==== ==== How do I read in the pallette value of a color? ====
Ligne 69: Ligne 79:
 The way we counter this is as follows : There is an elctron beam on your monitor that is constantly updating your screen from top to bottom. As it gets to the bottom of the screen, it takes a while for it to get back up to the top of the screen to start updating the screen again. The period where it moves from the bottom to the top is called the Verticle Retrace. During the verticle retrace you may change the pallette without affecting what is on the screen. What we do is that we wait until a verticle retrace has started by calling a certain procedure; this means that everything we do now will only be shown after the verticle retrace, so we can do all sorts of strange and unusual things to the screen during this retrace and only the results will be shown when the retrace is finished. This is way cool, as it means that when we change the pallette, the fuzz doesn't appear on the screen, only the result (the changed pallette), is seen after the retrace! Neat, huh? ;-) I have put the purely assembler WaitRetrace routine in the sample code that follows this message. Use it wisely, my son. The way we counter this is as follows : There is an elctron beam on your monitor that is constantly updating your screen from top to bottom. As it gets to the bottom of the screen, it takes a while for it to get back up to the top of the screen to start updating the screen again. The period where it moves from the bottom to the top is called the Verticle Retrace. During the verticle retrace you may change the pallette without affecting what is on the screen. What we do is that we wait until a verticle retrace has started by calling a certain procedure; this means that everything we do now will only be shown after the verticle retrace, so we can do all sorts of strange and unusual things to the screen during this retrace and only the results will be shown when the retrace is finished. This is way cool, as it means that when we change the pallette, the fuzz doesn't appear on the screen, only the result (the changed pallette), is seen after the retrace! Neat, huh? ;-) I have put the purely assembler WaitRetrace routine in the sample code that follows this message. Use it wisely, my son.
  
-<WRAP center round info 80%>+<WRAP round info>
 WaitRetrace can be a great help to your coding ...  WaitRetrace can be a great help to your coding ... 
  
back2root/archives/denthor/part-02.1684434601.txt.gz · Dernière modification : 2023/05/18 20:30 de frater