by Dan East » Mar 2, 2001 @ 1:18pm
That's what I do, I just don't release the buffer every frame. At the beginning of the drawing I see if I have the buffer still. If not, I get it. I have rewritten those routines completely from what you have (I think). Now I calculate all drawing parameters up front, so the actual drawing is totally generic. This allows the exact same drawing routine to work for portrait, both landscape modes, and other types of devices, without having any conditional logic.<br><br>The reason I don't release the buffer each frame is because Microsoft says you don't have to, but it does not work that way on MIPS and SH3 devices (apparently you have to release each frame). <br><br>Notice the conflicting info, this is straight out of the Game API docs (do a search for GAPI, then select the document "Animating Graphics" ) :<br><br>To continue drawing more data on the screen, call GXBeginDraw to get a pointer to the VFB. As soon as drawing is complete and no later, call GXEndDraw. <br><br>Note Consider the performance cost of these calls when implementing them in your application, because they will typically be done 20 or 30 times per second. It is acceptable to draw several frames between the GXBeginDraw and GXEndDraw calls, but you must remember to call GXEndDraw in WM_KILLFOCUS if necessary.<br><br><br>Ok, so they say you should release the buffer "as soon as drawing is complete and no later", and two sentences later say "It is acceptable to draw several frames between the GXBeginDraw and GXEndDraw calls". So to me that means you can hang onto the buffer until you get a WM_KILLFOCUS message. Even then the only reason you give up the buffer is if you want to be nice to whatever application gained the focus. <br>Thanks again Microsoft!<br><br>Dan East<br>Last modification: Dan East - 03/02/01 at 10:18:13