From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro BITMAPS Date: Thu, 27 Feb 1997 20:03:39 +0000 Organization: None Distribution: world Message-ID: <9wOMLMAbieFzEw4m@talula.demon.co.uk> References: <857038254 DOT 13120 AT dejanews DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 48 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp >questions about Allegro BITMAPS. First of all, with non screen >memory BITMAPS, are the lines just pointers to an allocated >peice of memory, or is each line allocated individually to >different spots? They are just offsets into a single block of memory. The only times when the lines may not be contiguous in memory is if it is an SVGA screen bitmap or a sub-bitmap of something else... > Secondly, In the demo program I get 25 fps SVGA 640x480 page >flipping and and double buffered in the same mode I get 32 fps. >Does anyone know why I would get higher frame rates here double >buffered? My guess would be that you have a fairly fast CPU and a very slow graphics card (are you using VESA 1.x mode, by any chance?). In such a situation, the most expensive task is transfering data to the video memory. With double buffered drawing, each pixel is written to video memory exactly once, wheras with page flipping some areas get overwritten (first they are cleared to black, then a sprite is drawn on top of them). In my experience page flipping is usually faster, but if video memory is a lot slower than main memory, double buffering will win out... > And does anyone have any ideas or hints on how to optimize >the 640x480 SVGA mode? Thanks for your help. The main 'trick' with any optimisation task is not to do any work that isnt' required. Don't draw any more than you absolutely have to, and try to make use of image coherency from one frame to the next to minimise the amount of screen space that needs updating. Getting more technical, use linear framebuffers if at all possible. Try to draw large things rather than small (a 32 pixel wide horizontal line is a lot faster than 32 putpixels). Blitting and drawing sprites is faster if the destination X coordinate is a multiple of four. And if you are using a banked video mode, things will go much faster if you draw things in bank-order, ie. sort all your objects by Y position before the draw. If you have 200 sprites at random positions on the screen, the chances are that it will take nearly 200 bank switches to draw them all, but if you draw all the ones at the top of the screen first, Allegro will be able to output several without having to switch banks, which saves a lot of time... /* * Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ * Beauty is a French phonetic corruption of a short cloth neck ornament. */