Path: chuka.playstation.co.uk!news From: James Shaughnessy Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: Drawing pixels [was: 2d collision bounding box...] Date: Thu, 10 Dec 1998 16:37:41 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 85 Message-ID: <366FF8D5.FA2A6E19@manc.u-net.com> References: <366C2C7E.75028A95@club-internet.fr> <74hp72$8bc3@chuka.playstation.co.uk> <366DC77E.250F58BA@manc.u-net.com> <74mrpa$8bc14@chuka.playstation.co.uk> NNTP-Posting-Host: manc.u-net.com Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------F5A2F36D1342903EE355F2DE" X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en --------------F5A2F36D1342903EE355F2DE Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit First you will need to create the sprite on the frame buffer. You can create the actual sprite instead of loading in a pre-drawn TIM by doing a ClearImage(&rect, r, g, b); where rect = {x, y, 1, 1}; x/y are sprite image coords. There are two ways of handling the pixel colours -- either change the .r .g .b attribute values (ie. RGB brightness) for each time the colour changes (with the pixel set at r255, g255, b255), or (a potentially faster way) is to create an effective "clut" on the frame buffer (many ClearImaged colours) and change the .u or .v value to whatever offset is needed. Grav uses both these methods. Set up a single 1x1 sprite, with GsSPRITE pixel; but be careful if using 4 or 8 bit CLUT pixels (apart from possible confusion) you have to long word align the .u .values, so make your "clut" vertical (ie. use the .v to set sprite colour. The actual CLUT can still be horizontal of course). You can sort the pixel into the OT, change the .r.g.b or .u/.v settings, and sort it again as many times as you want, and this turns out to be a fast and effective way of doing putpixels. The funny thing with Grav is I don't use GsSortClear so pixels that are "put" need to be cleared in the old fashioned (and therefore stupid) way of redrawing them all as black. (The reason I do this is the background maps are permanent and only need to be drawn once on the virtual screen so split-screen mode and scrolling is extremely easy. Although if I were to re-write it I'd do it the proper way (and use BgMAPs for the maps allowing them to be much bigger than 640x512). my eventual GameBoy version has 1024x1024 maps..) Cheers, Jim Rad wrote: > How do you manipulate pixels on the yaroze? --------------F5A2F36D1342903EE355F2DE Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit First you will need to create the sprite on the frame buffer.   You can create the actual sprite instead of loading in a pre-drawn TIM by doing a ClearImage(&rect, r, g, b); where rect = {x, y, 1, 1}; x/y are sprite image coords.
There are two ways of handling the pixel colours -- either change the .r .g .b attribute values (ie. RGB brightness) for each time the colour changes (with the pixel set at r255, g255, b255), or (a potentially faster way) is to create an effective "clut" on the frame buffer (many ClearImaged colours) and change the .u or .v value to whatever offset is needed.  Grav uses both these methods.

Set up a single 1x1 sprite, with GsSPRITE pixel; but be careful if using 4 or 8 bit CLUT pixels (apart from possible confusion) you have to long word align the .u .values, so make your "clut" vertical (ie. use the .v to set sprite colour.  The actual CLUT can still be horizontal of course).   You can sort the pixel into the OT, change the .r.g.b or .u/.v settings, and sort it again as many times as you want, and this turns out to be a fast and effective way of doing putpixels.  The funny thing with Grav is I don't use GsSortClear so pixels that are "put" need to be cleared in the old fashioned (and therefore stupid) way of redrawing them all as black.  (The reason I do this is the background maps are permanent and only need to be drawn once on the virtual screen so split-screen mode and scrolling is extremely easy.  Although if I were to re-write it I'd do it the proper way (and use BgMAPs for the maps allowing them to be much bigger than 640x512). my eventual GameBoy version has 1024x1024 maps..)

Cheers,
Jim

Rad wrote:

How do you manipulate pixels on the yaroze?
--------------F5A2F36D1342903EE355F2DE--