Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: convert TIM data in SPRITE Date: Mon, 03 Aug 1998 10:17:44 +0100 Organization: Sony Computer Entertainment Europe Lines: 40 Message-ID: <35C58038.8150B421@scee.sony.co.uk> References: <35C478F9.6AD5@club-internet.fr> NNTP-Posting-Host: mailgate.scee.sony.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en MAGNIER Francis wrote: > > I have a problem with a part of a code, I load in VRAM TIM data but for convert them in a sprite > I don't understand the arguments "u" and "v" A TIM file is a way of storing different rectangles of image data or colour lookup tables (CLUTs) that have to be loaded into VRAM. VRAM is divided up into 32 Texture Pages (These are visible if you load up TIMTool, which gives a representation of VRAM). The Graphics Processing Unit reads textures and sprites in relation to a particular Texture Page (called tpage for short). So when you set up a sprite, you must specify the leftmost tpage that the sprite lies in. The u,v coordinates refer to coordinates _relative_to_ the top left coordinate of that tpage. You can see the tpage number in TIMtool (under ID). For a sprite, the u,v coordinates specify where the top left of the sprite lies within its tpage. The maximum value for u or v is 255, and the smallest is 0. What gets confusing is the width of a tpage in relation to VRAM. A tpage is always 256x256 _rendered_ pixels wide. But a 4 bit image takes up 1/4th the width of a 15 bit image, and an 8 bit image takes up 1/2 the width of a 15 bit image. The _rendered_ width of these images is still what you'd expect, but the space that they actually take up in VRAM is could be 1/4, 1/2 or 1/1 of the rendered width. It is important to remember that U/V coordinates are specified in terms of rendered width, not the width in VRAM. The U,V coordinates are independant of the bit-depth of the image. If you want some example code which sets up a Sprite's TPAGE, try the function listed in the Yaroze Programming FAQ at http://www.netyaroze-europe.com/yaroze/newmembers/yarfaq.htm This will load your TIM into VRAM, but (assuming it contains just one image) can also set up a GsSPRITE structure for you. Cheers, James -- == James_Russell@scee.sony.co.uk +44 (171) 447-1626 == Developer Support Engineer - Sony Computer Entertainment Europe "Weaseling out of things is what separates us from the animals!... Except the weasel." -- Homer