[Plib-devel] Annoying SSG bug.
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2002-11-17 01:26:29
|
SSG uses a frame counter for a couple of jobs. ssgGetFrameCounter(); ...the counter is incremented in ssgCullAndDraw() - but if you use multiple calls to ssgCullAndDraw each frame (eg to do multipass rendering - or to render some objects in a separate rendering pass) then the counter is incremented too many times. This is rather nasty to fix. SSG has no way to know when you call Swapbuffers - so it can't tell the difference between true multipass rendering and two consecutive legitimate frames. In retrospect, we should probably have an SSG call that you're required to make before each swapbuffers - but we don't have it and if I add one and use it to increment the frame counter then I'll break existing applications. I suspect this problem will affect FlightGear...it explains a couple of odd things I've seen in some of my work. The only way I can think to fix this in a backwards compatible way is to write: ssgFrameUpdate () { ssgSetFrameCounter( ssgGetFrameCounter() + 1 ) ; } ssgImprovedCullAndDraw ( ssgEntity *e ) { int x = ssgGetFrameCounter() ; ssgCullAndDraw( something ) ; ssgSetFrameCounter ( x ) ; } ...and to tell people: 1) Call ssgFrameUpdate() at the end of every frame - just before Swapbuffers. 2) Use ssgImprovedCullAndDraw instead of ssgCullAndDraw - which is now deprecated. We'd need a better name than ssgImprovedCullAndDraw. Can anyone think of a cleaner way to fix this? ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net |