Path: chuka.playstation.co.uk!news From: alex@teeth.demon.co.uk (Alex Amsel) Newsgroups: scee.yaroze.programming.3d_graphics Subject: OT explanation: was Re: GsSortOt() function Date: Tue, 29 Apr 1997 11:47:35 GMT Organization: Into Beyond Lines: 76 Message-ID: <3365d9da.404749@news.playstation.co.uk> References: <01bc5441$7348f5a0$7916e8c3@fred> Reply-To: alex@teeth.demon.co.uk NNTP-Posting-Host: teeth.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent .99g/32.335 On 29 Apr 1997 01:58:52 GMT, "Michael Enoch" <100413.2514@compuserve.com> did quoth at me: >Hi, could someone explain how to use GsSortOt() better than the manuals >explain it, I wan't to force an object to be drawn last. Mike, I've only just got up (!) so would probably explain everything completely wrong, but if you are unsure just whack me an email and I'll try and explain it when I'm more awake :) Take that back...I'll try now, though I really have just stepped out of bed - been installing CodeWright overnight! To force an object to be drawn last, draw that object into a separate OT defined as normal. So you have your main OT (used by DrawOT) and then this special one. Then you need to 'insert' this OT into the main one. This is done by assigning a mock Z value to OT.point in the GsOT structure. As you know, each OT is basically like a set of marks on a ruler. Except instead of one centimeter, they may mean 1 meter, or 1 mile, or who knows what. If your OT is 256 long (OT_LENGTH = 8), then to insert this OT as the last item you need to set OT.point as 255. DrawOT will draw from the end of the OT to the start, and bob's your uncle. Or something like that. Also note that you should call GsSortOt to do this as the second last command. The last being the ClearScreen one. Otherwise you could end up with other distant objects (where their z = 255) being drawn over your object. It may help to know that OT's are basically just linked lists. I'll explain... An OT of length 4 units (OT_LENGTH = 2). Unit 0 ptr->primitive 1 ptr->primitive 2 ptr->primitive 3 END_OT_TAG (something like a ptr to 7ffffff) Unit 1 ptr->primitive 4 ptr->unit 0 Unit 2 ptr->unit 1 Unit 3 ptr->primitive 5 [e.g. clear screen which is probably a square fill) ptr->unit 2 DrawOT starts at the top of unit 3, and follows the list of pointers. When a new primitive is inserted at any point, it adds it at the TOP of the Unit. So the objects added to the OT later get a higher priority for polygons at the same Z value was previous objects since they are placed 'higher' in the linked list. Sorry if this explanation is a bit cack. I'll try again if anyone wants. Anyway, this info is pretty useful to know when you start suffering from polygons being flipped behind scenery (since you know which order to draw your objects in if you know how the OT works). P.S. Do Sony want to give me a tech support job?! Heard of PS-X jobs available there ;) Except no office in Sheffield :( * Alex Amsel * Into Beyond Web Design & JAVA Programming * * http://www.intobeyond.com * WWFC Utter Rubbish 1996-7* MM - "Steve Corica is every bit as good as that Kinkladze"