Pon wrote:
I'm creating a software renderer. Currently, for each and every frame, I use the SetPixel method of the Bitmap class to update the colour, then put that on the form. However, I dislike doing it this way for obvious reasons. How can I set the colour of a pixel on a Form?
What are these obvious reasons? Speed?
If your program runs in full trust you can lock the image and directly paint to the memory using pointers. Besides using DirectX you will not find a faster way to do this:
Bitmap bm = new Bitmap (1000, 1000);
BitmapData data = bm.LockBits (new Rectangle (1000,1000), ImageLockmode.ReadWrite, PixelFormat.Format32bppRgb);
byte* firstByte = (byte*)data.Scan0.ToPointer ();
Don't forget to unlock once you are done...