简体   繁体   中英

what is the fastest way to draw pixel in win32

I'm writting a simple software renderer, load 3d model, process vertex, rasterization, texture, lighting, all that things, all done. I used SDL(not using OpenGL mode) to draw pixel on its SDL_Surface, and call SDL_Flip, so one frame appears.

for some reason now I don't want to use SDL, I just need a double-buffer to draw pixel.

I know there're someway to do this, OpenGL, Direct3D, gdi, maybe they're too "advanced" for this project, what is the direct(or fastest) way to draw pixels to back-buffer on win32 ?

I'd recommend using a graphics API for this (OpenGL or Direct3D), but GDI would be the easiest option. You can create a DIB (Device Independent Bitmap) using the CreateDIBSection function which returns a pointer to the bitmap's memory. You can then modify the pixels of the bitmap however you please and draw it to your window's client area. See chapter 15 of Programming Windows (5th) by Charles Petzold for source code and explanation of this technique.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM