From: "Arthur" To: Subject: RE: Dirty Rectangles Date: Sun, 11 Oct 1998 12:24:44 +0100 Message-ID: <000101bdf509$becc1b00$f24e08c3@arthur> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal In-Reply-To: <6vp6lc$g71$1@otis.netspace.net.au> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Reply-To: djgpp AT delorie DOT com > In the allegro demo game, one of the displaying method is dirty > rectangles. > I have read the code quite a few times, but since I am a beginner I still > don't understand it completely, can someone explain it to me how it works. No offence to Shawn Hargreaves (who wrote the game), but the code has pretty poor style. For one it has no comments; and secondly it has no structure. Dirty rectangles involves working out which bits of the previous frame are going to change, and recording them in a list. Then you draw the stuff on to the screen. After that screen has been displayed, you copy the data which is in the list back to the screen. This has the advantage of not having to completly redraw the screen from scratch, and hence saves time in most cases. If you have a lot of elements in your list (ie, have a lot of moving stuff on screen), however, you will find that the frame rate will drop below the equivalent double-buffering method (without vsync). You will notice that the framerate is much higher on dirty rectangles mode, than any other mode. This is because there is no vsync. You will also notice that shearing does not become apparant. This is because most of the screen remains exactly the same colour (black). As soon as you add a moving background to the game, you will find that shearing does occur - you just didn't notice it before. Using dirty rectangles does not mean that you can avoid using a vsync in all cases. James Arthur jaa AT arfa DOT clara DOT net ICQ#15054819