开发者

Is it possible to use pointers to write directly (low level) onto a window without using Bitblt?

开发者 https://www.devze.com 2023-02-01 17:27 出处:网络
I have written an anaglyph filter that mixes two images into one stereographic image.It is a fast routine that works with one pixel at a time.

I have written an anaglyph filter that mixes two images into one stereographic image. It is a fast routine that works with one pixel at a time. Right now I'm using pointers to output each calculated pixel to a memory bitmap, then Bitblt that whole image onto the w开发者_运维知识库indow.

This seems redundant to me. I'd rather copy each pixel directly to the screen, since my anaglyph routine is quite fast. Is it possible to bypass Bitblt and simply have the pointer point directly to wherever Bitblt would copy it to?


I'm sure it's possible, but you really really really don't want to do this. It's much more efficient to draw the entire pattern at once.


You can't draw directly to the screen from windows because the graphics card memory isn't necessarily mapped in any sane order.

Bltting to the screen is amazingly fast.

Remember you don't blt after each pixel - only when you want a new result to be shown, even then there's no point doing this faster than the refresh on your screen - probably 60hz


You are looking for something like glMapBuffer in OpenGL, but acessing directly to the screen.

But writing to the GPU memory pixel per pixel is the slower operation you can do. PCI works faster if you send big streams of data. Also, there are many issues if you write and read data. And the pixel layout is also important (see nvidia docs about fast texture transfers). Bitblt will do it for you in a driver optimised way.

0

精彩评论

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