Path: chuka.playstation.co.uk!news From: Alex Herbert Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Speed of ClearImage & MoveImage as putpixels Date: Fri, 06 Feb 1998 15:07:38 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 61 Message-ID: <34DB2739.6DBFCB37@ndirect.co.uk> References: <34DA30A9.1AE@manc.u-net.com> Reply-To: aherbert@ndirect.co.uk NNTP-Posting-Host: dialin1-35.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) To: James Shaughnessy Just a thought... Isn't it quicker to use a single pixel sprite or line? Alex James Shaughnessy wrote: > 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 > -----------------------------------------