From: Chris P. <cj...@lo...> - 2003-09-23 17:03:33
|
On Tue, Sep 23, 2003 at 09:12:20AM -0500, Fay John F Contr AAC/WMG wrote: > (1) The Display function in the "fractals_random" demo is, as somebody > correctly pointed out, supposed to draw a few more points into the window > each time it is called. For this reason a call to "glClear" from the > Display function is inappropriate. I assume that this would frequently (but > not always) be true for single-buffered applications. On the other hand, if > the user wanted to restart the drawing, or if he changed viewpoint or scale, > the drawing would need to start over (otherwise you would have the new > fractal being drawn over the remnants of the old fractal) and so we need to > call "glClear" from the other callbacks. The problem with doing things that way is how the demo handles expose events. When all or part of the window has been damaged and needs redrawing glut will call the display callback expecting the application to redraw the entire window. Fractals_random does not do this. Instead it continues with it's drawing of the foreground leaving the damaged portion of window a mess. This is most noticeable when I first start the demo. What happens is the glClear in main is called too soon and when the X calls to created the window are flushed the window appears containing whatever was in that part of the screen before. I get the same thing with glut classic, so that is not a freeglut problem. The way I would do it is have the Display callback do the glClear and the Idle callback to the incremental drawing. Also, what does it use the depth buffer for? > The call to "glFinish ()" (is it "glFinish" or "glFlush"?) is good and > should be added to the "fractals_random" demo program. At the same time, > let's cut out the unused "num_levels" variable and the unused "num" argument > in the "draw_level" function. Thomas Thierry has also pointed out a > "should-have-known-better" lack of robustness in that we should check that > the data file was actually opened before we try reading it. It's glFlush() that should usually be used in such cases. glFinish() has much the same effect as glFlush() but it waits until all rendering is completed before returning. Neither is technically needed in fractals_random because the demo never stops rendering. -- Christopher John Purnell | I thought I'd found a reason to live http://www.lost.org.uk/ | Just like before when I was a child --------------------------| Only to find that dreams made of sand What gods do you pray to? | Would just fall apart and slip through my hands |