开发者

Rendering Color Data to a Window, Win32

So I am able to create an array of color data (pro开发者_如何学JAVAjecting 3d models in case you are wondering), but I need to display them in a Win32 window. I know I could draw it pixel by pixel, but that is really slow. I know that I probably need BitBlt(); I would need it anyway if I am to use double buffering. I have seen how to render a .bmp to the window, but I don't have a .bmp. I guess I could MAKE a .bmp, but I'm going for speed here.

Is there any way to directly (probably not directly, but still quickly) access the pixel data of the hDC? How do graphics libraries do it so quickly?


To copy your buffer to the DC, you should construct a BITMAPINFO, then use SetDIBitsToDevice() with the screen hDC, the pointer to your buffer and the constructed BITMAPINFO.

You can find a good starting-point for double buffering here.


Render to a MemoryDC (which is quicker for pixel-by-pixel access), then copy that to your window DC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜