Path: chuka.playstation.co.uk!news From: James Shaughnessy Newsgroups: scee.yaroze.programming.2d_graphics Subject: Speed of ClearImage & MoveImage as putpixels Date: Thu, 05 Feb 1998 21:35:37 +0000 Organization: Bacardi Ferrari V12 Lines: 49 Message-ID: <34DA30A9.1AE@manc.u-net.com> NNTP-Posting-Host: manc.u-net.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (Win95; I) Ok, putpixels went out with the Ark considering what the GPU can do but I use them for my 2D game, Gravitation, to get pixel-perfect collision-detection (a necessity for the type of game, although I do most putpixels in the D-Cache). As you will no-doubt know a pixel can be defined as a RECT with a width and height of 1, so assuming I have globally defined: RECT pixel, clutpixel; pixel.w = 1; pixel.h = 1; clutpixel.x = CLUTxpos; // vertical clut (y variable) clutpixel.w = 1; // used to point to location clutpixel.h = 1; // of your clut on frame buffer Compare these two functions which for simpicity put only black pixel at x, y: (assuming that the first pixel in your clut line is black) void PutBlackPixel_1(short x, short y) { pixel.x = x; pixel.y = y; ClearImage(&pixel, 0, 0, 0); } void PutBlackPixel_2(short x, short y) { clutpixel.y = 0; MoveImage(&clutpixel, x, y); } The thing is I have found that for single pixels a MoveImage is about 10% FASTER than an equivalent ClearImage, so always try and use the second type above (of course you can have a CLUT of as many colours as you like if you make it yourself, NOT limited to 256). The bad news is that I have found that a single call to Move/ClearImage takes a whole HSYNC, even when it's only a pixel. Which means your limited to about 240 NTSC or 290 PAL putpixels, so don't even think about using it for bitmaps. If you think it means you can't use putpixels to make a fast running game then check out my demo below which uses NO GPU GsSPRITES or Ordering Tables. I had to limit the onscreen bullets to about 120 but it's still plays at max frame rate. Jim -- Get Gravitation from here: ----------------------------------------- James Shaughnessy james@manc.u-net.com http://www.netyaroze-europe.com/~shaughnj -----------------------------------------