是否可以使用指针直接(低级)写入窗口而不使用 Bitblt?

发布于 2024-10-09 06:56:18 字数 187 浏览 3 评论 0原文

我编写了一个浮雕滤镜,将两个图像混合成一个立体图像。这是一个快速例程,一次处理一个像素。 现在,我使用指针将每个计算出的像素输出到内存位图,然后将整个图像 Bitblt 到窗口上。

这对我来说似乎多余。我宁愿将每个像素直接复制到屏幕上,因为我的浮雕例程非常快。是否可以绕过 Bitblt 并简单地让指针直接指向 Bitblt 将其复制到的位置?

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 window.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

攒一口袋星星 2024-10-16 06:56:18

我确信这是可能的,但你真的真的不想这样做。一次绘制整个图案效率更高。

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.

今天小雨转甜 2024-10-16 06:56:18

您无法从 Windows 直接绘制到屏幕,因为图形卡内存不一定以任何合理的顺序映射。

传输到屏幕的速度快得惊人。

请记住,您不会在每个像素之后进行 blt - 仅当您想要显示新结果时,即使如此,也没有必要比屏幕上的刷新速度更快 - 可能是 60hz

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

久随 2024-10-16 06:56:18

您正在 OpenGL 中寻找类似 glMapBuffer 的东西,但直接访问屏幕。

但逐像素写入 GPU 内存是您可以执行的较慢的操作。如果发送大数据流,PCI 的工作速度会更快。另外,写入和读取数据时也会出现很多问题。像素布局也很重要(请参阅有关快速纹理传输的 nvidia 文档)。 Bitblt 将以驱动程序优化的方式为您完成此操作。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文