Re: [Plib-users] Newbie Question: Mixing SSG & OpenGL
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2002-05-15 13:09:07
|
Stanford Ng wrote: > After much digging under the hood of my program, I'm still encountering > problems with mixing SSG & OpenGL. I've narrowed it down to the > ssgCullAndDraw() call influencing the GL state somehow. It does change state without restoring it - yes. That's not accidental though - it's very inefficient in OpenGL to keep setting and restoring state unnecessarily - so we leave it to the application to save and restore state if it wishes to. Many applications (all of mine) get away without doing that and are faster as a result, others can do things like not restoring all of the detailed texture attributes because they just glDisable texture globally. So, it's better to let the application decide. > When I comment > out ssgCullAndDraw() in my redraw routine, the draw_water() works fine, > drawing a blue rectangle. When I leave the call in there, the rectangle > is still drawn, but it is very dark and blends right into the > background. > > I'm trying to puzzle out what ssgCullAndDraw() is doing that would > affect the standard OpenGL stuff... I'm still quite a novice when it > comes to these things. If someone could explain things, I'd much > appreciate it! Thanks in advance! As a first shot at fixing this, you could wrap ssgCullAndDraw with glPushAttrib ( GL_ALL_ATTRIB_BITS ) ; ssgCullAndDraw () ; glPopAttrib () ; ...that will almost certainly fix your problem - but at some performance cost. If you find that cost is acceptable - then you're done. If not then you'll have to ascertain which things that SSG changed are not acceptable to your draw_water() function. ----------------------------- Steve Baker ------------------------------- Mail : <sjb...@ai...> WorkMail: <sj...@li...> URLs : http://www.sjbaker.org http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net http://freeglut.sf.net http://toobular.sf.net http://lodestone.sf.net |