I need help coding a fast screen display for a Windows Mandelbrot-set program . I am presently setting pixel colors one-at-a-time with SetPixel(x,y,RGB(r.g.b)). This function is notoriously slow and consumes all the time expended on generate the Mandelbrot set display. (2.2 sec at this point) I want to use no more than 20 msec so I can do some real-time computer graphics operations on the Mandelbrot object. (rotate, scroll, flip, etc.) I haven’t done any programming for 10+ years and am more than a little rusty. I assume that 20 msec is achievable with today’s display adapters and the right programming.
Is this correct?
I understand that screen displays can be generated at reasonable speed if I construct a bitmap from the pixel values. I’m pretty confident of my ability to handle the transfer from a bitmap to the screen but I haven’t doped out how to create an empty bitmap with enough storage capacity for a map of the whole screen (multi megabytes for any kind of modern color display) The functions I have looked at rely on a pointer to an array of the pixel data. If I must arrange for that much storage space, the heap is the only place that makes sense. A global array would make a massive .EXE file; a local array would overwhelm the stack.
If I use heap memory, how do I do it for screen sizes known only at run time?
Some write-ups imply that the BITMAP functions themselves reserve the space in the heap.
Is this true?
That would be simplify things for me. Actually My preference would be to continue to write the color data to the screen, one pixel at the time. Sort of a one pixel transfer at a time via bitblt to the display adapter . Would that run faster than SetPixel? I understand that SetPixel is slow because the display adapter has to match its colors up with the RGB color specified in SetPixel. Would a single pixel bitblt have the same limitation?
But I may be completely at sea on this. I would appreciate any help. I want understand what I’m doing, not simply copy someone else’s code. That would defeat my basic purpose of keeping my mind reasonably sharp.