From: Bernie P. <bj...@cs...> - 2004-10-19 00:31:24
|
On Mon, Oct 11, 2004 at 07:41:21PM +1000, Bernie Pope wrote: > Hi wxHaskell people, > > I have a little ray-tracer in Haskell. An image is > produced as a stream of pixel intensities. > > I want to use wxHaskell to write a display facilty that > will render each pixel as it is generated by the tracer > (so we can see the image being generated pixel by pixel). Hi again, I've done some more tinkering and here's what I've come up with. When the user clicks the "render" button a new frame is created containing a panel. A bitmap is drawn onto the panel on paint raw events. At each idle event for the panel, the program requests a chunk of pixels from the raytracer. It then writes those pixels to their respective positions in the bitmap pixelbuffer. Then it sends a repaint event to the panel. When the supply of pixels runs out (the emtpy list) the panel stops responding to idle events. You can set the chunk size. Smaller sizes tend to slow the repaint process down. The nice thing is we can have multiple simultaneous renderings going on in different frames. I'll post a link to the code when I'm done polishing it. Cheers, Bernie. |