Path: chuka.playstation.co.uk!news From: Alex Herbert Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Scrolling backgrounds Date: Thu, 09 Jul 1998 17:57:16 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 42 Message-ID: <35A4F66B.72C93CB6@ndirect.co.uk> References: <6nvfvm$9o1@chuka.playstation.co.uk> Reply-To: aherbert@ndirect.co.uk NNTP-Posting-Host: dialin2-36.ndirect.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) Mark Green wrote: > I am trying to create a 2D scrolling cloud-type background that is > automatically generated by an algorithm. I have the algorithm to generate > the next line to be scrolled on given the previous line, but I am having > some problem making the scrolling itself happen. > It would seem to make sense that I should hold the background somewhere > in video RAM, scroll and update it there then copy it to the frame buffer. > Unfortunately this seems to be very inefficient (requiring two full-screen > blits per frame, one to scroll the buffer and another to copy it to the frame > buffer) and will not work with the non-blocking operations anyway since the > scroll must be assured complete before the copy can take place. > I am sure that there is a more efficient way of doing this type of thing > but it is eluding me at the moment :) Can anyoone give me any pointers? Just a thought... You may want to try an old scrolling technique to get the same effect, but with only one full screen blit. For this example, imagine that the screen resolution is 256x256 and you are scrolling 1 pixel (or column) at a time to the left. I'll assume that 256 columns (0-255) have been pre-drawn. What you do is set up a drawing area in VRAM which is twice as wide as the screen (512 column). Draw your next column at 256, and ALSO at 0. Now copy the are (1,0)-(256,255) to the screen area, and you've now got your image scrolled 1 column to the left. Repeat for 256 frames. The idea is that you draw 1 column ahead, but you also duplicate that column, 1 column behind the screen. After 256 frames, you'll have reached the right hand extent of your scroll image (remember it was twice the width of the screen), but you should also have an identical copy in the left half of this area, so you can jump back to the begining (columns 0-255) and start the whole process again. Get that? Did that make sense? Hope this is of some help. If not, maybe I can explain again. Herbs