Path: chuka.playstation.co.uk!news From: "Rikki Prince" Newsgroups: scee.yaroze.beginners Subject: Order in main display loop Date: Sat, 18 Sep 1999 15:41:35 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 77 Message-ID: <7s08as$lcu11@chuka.playstation.co.uk> NNTP-Posting-Host: th-gt144-148.pool.dircon.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 I've been playing about with some wrapper functions to simplify writing games, for example sprite initialisation function (which everyone has made or copied out of G. Bain's tutorials :), and so on. When I did a simple version of some of these most basic wrappers, I had two functions for the main loop, basically setting up the graphics(GsGetActiveBuff() etc), and then waiting for DrawSync etc. These were used as first and last functions called in my main while(RUNNING) loop, with pad handling and rendering/sorting of primitives, so the loop looked like: while(RUNNING) { GraphicsLoopStart(); /* The variables used were global */ PadHandler(); DisplayScreen(); GraphicsLoopEnd(); } In this code GraphicsLoopStart() basically consisted of: ActiveBuff = GsGetActiveBuff(); GsSetWorkBase(&GpuPacketArea[ActiveBuff]); GsClearOt(0, 0, &OrderingTable[ActiveBuff]); and Graphics LoopEnd() was: DrawSync(0); VSync(0); GsSwapDispBuff(); GsSortClear(0, 0, 255, &OrderingTable[ActiveBuff]); GsDrawOt(&OrderingTable[ActiveBuff]); Now when I've come to tidy these functions up, with the variables used (OT, active buffer etc) being passed as arguments, I tried to integrate these into one function, so that it could be called at the end or the start of the loop. I thought this would be possible, as in the loop example above, I thought it could be rearranged as: while(RUNNING) { GraphicsLoopEnd(); GraphicsLoopStart(); /* The variables used were global */ PadHandler(); DisplayScreen(); } or while(RUNNING) { PadHandler(); DisplayScreen(); GraphicsLoopEnd(); GraphicsLoopStart(); /* The variables used were global */ } However, when I came to test this, it didn't work at all. After messing around with it, using the actual code in place of a function call, and then splitting the code into the two separate functions, and putting them in different places in relation to the other function calls in the loop, I found it only worked when the 'GraphicsLoopStart' code was at the start of the loop, and the 'GraphicsLoopEnd' code was at the end. I think the idea of combining the two parts should work, at least the do in theory, but I can't seem to get it to work - I get a warped image of the 'start-up brick screen', followed by a GPU timeout message in siocons, then the blue background screen I should be getting, and control of the program (well Start + Select to exit). Has anyone got any ideas on why it isn't working? I suppose it could be my whole testing program etc, as it's a bit recycled from old stuff, but it works with the code at the start and end, but not all at the end, or al at the start. Can someone tell me if it shouldn't work in theory, and that I've got completely the wrong idea? I'd be grateful for any help whatsoever. Thanks Rikki