Path: chuka.playstation.co.uk!news From: "Carlos Pieterse" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Texture problem Date: Tue, 28 Jul 1998 23:30:12 +0200 Organization: PlayStation Net Yaroze (SCEE) Lines: 99 Message-ID: <6plfss$3ue10@chuka.playstation.co.uk> References: <35BDDB53.81B9EE38@hi.is> <01bdba39$e36cc320$f30b0a0a@Angela1.intelligent-group.com> <35BDF21A.A4F69B0@hi.is> NNTP-Posting-Host: pm25-55.image.dk X-Newsreader: Microsoft Outlook Express 4.72.3110.1 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Hi Ari Pall, >Ok, now I'm using a functions from a demo that came with the CodeWarrior 2. >First >I call the "void ProperInitialiseTexture (long address, GsIMAGE* imageInfo)" ???? (this means nothing, could be almost anything) >function >and then there is another function called >"u_short SortSpriteObjectPosition (ObjectHandler* object)" ???? (this too means nothing ... -sort of out of context) >witch I'm not sure what to do with.. (the example, states it's not ready). What ?? >I would appriciate if somebody would send me some samplecode, so I could fix >my >errors. >(I always see "something" on the 3d models, but that's always something >strange. I store >the .tim file at (640,0) in the VRAM, that is outside the frame buffers.) Errrm... Well actually it is in the frame buffer!!! (The area of the frame buffer is 1024x512 !!! -remember?!) Did you code a routine to diplay a non-textured object ?? (You'll find plenty of sources in the demos area of the SCEE-yaroze webside, and on the members homepages too.. ) -A good idea when learning(/debugging) from someones source, is to write down (on piece of paper, that is!) the main steps of the program. Afterwards start from scratch writing your own source based upon the steps you wrote down. This way you should be sure to understand the code! If you did write a routine to display a 3D object, texturing it is a piece of cake. Follow these steps : 1) Load the .TIM file(s) into TIMTOOL position it somewhere safe in the frame buffer (not in the area you use for screen buffers) and make sure to sort the CLUT table(s) (if it's 4 or 8 -bit textures) aswell. 2) Load the .RSD file (object file) into either RSDTOOL or RSDANIM(preferred) apply the texture(s). 3) Use RSDLINK to convert it to a .TMD file. 4) Load the .TMD and .TIM files into the yaroze's memory, at some approprieate address's (starting at 0x80090000, is a good idea). 5) Within your source be sure to perform the following bit of code, before initialising your 3D object : ---------------------------------------------------------------------------- -------------------------------------------------- #define Texture_Address ???????+4 //(the address+4 where you loaded the .TIM file i.e. 0x80090500) GsIMAGE Texture; RECT rect; GsGetTimInfo((unsigned long *)(Texture_Address), &Texture); rect.x = Object_3D[O3D_Num].Texture.px; rect.y = Object_3D[O3D_Num].Texture.py; rect.w = Object_3D[O3D_Num].Texture.pw; rect.h = Object_3D[O3D_Num].Texture.ph; LoadImage(&rect,Texture.pixel); // apply only the following 5 lines of code if, the texture is 4 or 8 bit. rect.x = Object_3D[O3D_Num].Texture.cx; rect.y = Object_3D[O3D_Num].Texture.cy; rect.w = Object_3D[O3D_Num].Texture.cw; rect.h = Object_3D[O3D_Num].Texture.ch; LoadImage(&rect,Texture.clut); ---------------------------------------------------------------------------- -------------------------------------------------- 6) That's it!! > >thanks > Ari Pall > Good luck, Carlos Pieterse john-doe@image.dk