窗户低级图形 [英] Windows Low-Level Graphics

查看:184
本文介绍了窗户低级图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来编程。我知道C / C ++和Win32的基本知识。我现在要做的图形,但我想在屏幕上最快的连接。我知道大多数与OpenGL或DirectX去。但是,我不想要的开销。我想从头开始,并控制像素的数据。我知道GDI的位图,但我不知道这是对数据的访问最好。我知道我有透过窗户说话,这就是麻烦。不要OpenGL和DirectX编译到GDI的水平还是有他们这样做是一种特殊的方式,难道他们绕过或使用类似code?请不要问我为什么要这么做。也许这是如何实现的解释可能的帮助。怎么样窗结合所有窗口创建最终图像。

I'm new to programming. I do know C/C++ and the basics of Win32. I am now trying to do graphics, but I want the fastest connection to the screen. I realize most are going with Opengl or DirectX. But, I don't want the overhead. I want to start from scratch and control the pixel data. I know about GDI bitmap, but I'm not sure if this is best access to the data. I know that I have to talk through windows, which is the trouble. Do Opengl and DirectX compile down to the level of GDI or is there a special way they do it, do they bypass or use similar code? Please, Don't ask why I want to do this. Maybe an explanation of how this is done might help. Like how windows combines all windows to create the final image.

推荐答案

像素数据的最直接的访问是通过的渲染的,这是由OpenGL和Direct3D的支持。它们是交叉编译和直接在视频卡上运行。它们不使用OpenGL,它们不具有的OpenGL开销。 OpenGL的只是使用,让他们在第一时间将显卡本身的处理器。

The most direct access to pixel data is via shaders, which are supported by both OpenGL and Direct3D. They are cross-compiled and run directly on the video card. They do not use OpenGL, they do not have OpenGL overhead. OpenGL is just used to get them to the graphics card's own processor in the first place.

您在CPU上做任何事情必须先通过总线(通常PCI-EX preSS)复制到视频卡。 GDI实际上是多层次从图形内存中删除。

Anything you do on the CPU has to first be copied across the bus (typically PCI-express) to the video card. GDI is actually many levels removed from the graphics memory.

的OpenGL,Direct3D的,Direct2D中,GDI和GDI +都是抽象层。 GPU的厂商写道,接受这些标准指令功能的驱动器,重新连接codeS中的具体卡格式的数据,然后将其发送到卡上。通常OpenGL和Direct3D是最重的优化,也需要重新编码的量最少。

OpenGL, Direct3D, Direct2D, GDI, and GDI+ are all abstraction layers. The GPU vendor writes a driver that accepts these standard command functions, re-encodes the data in the card-specific format, then sends it to the card. Typically OpenGL and Direct3D are the most heavily optimized and also require the least amount of re-encoding.

Windows如何融合不同的屏幕上的窗口创建全屏图像在很大程度上取决于你所谈论的是什么版本的Windows。 DWM改变的所有的。由于DWM在Vista中引入,节目呈现到GPU内存的个人领域,那么窗口管理器使用显卡的纹理查找单位每个程序个别地区的有效层到屏幕上主缓冲区。当一个程序(通常是游戏)请求全屏独占访问,这一步是跳过,驾驶员导致从该应用程序渲染命令直接影响主屏幕缓冲

How Windows combines the various on-screen windows to create the full-screen image depends heavily on what version of Windows you are talking about. DWM changed everything. Since DWM was introduced in Vista, programs render to their personal areas of GPU memory, then the window manager uses the texture lookup units of the video card to efficiently layer each of the programs' individual areas onto the screen primary buffer. When a program (usually a game) requests full-screen exclusive access, this step is skipped and the driver causes rendering commands from that application to affect the primary screen buffer directly.

假设在CPU正在产生需要被显示的数据,最快和最有效的方法是可能的块复制该数据转换成一个顶点缓冲器对象,并使用OpenGL命令栅格它作为线或多边形,或任何(或Direct3D的等价物)。如果previously认为GDI是低层次的接口,你有一些阅读在你前面,使这项工作。但它会比纯GDI跑了几个数量级速度更快。如此之快,事实上,新的架构是,GDI(和WPF)是建立在Direct2D和/或Direct3D的顶部。

Assuming that the CPU is generating the data which needs to be displayed, the fastest and most efficient approach is likely to be block-copying that data into a vertex buffer object and using OpenGL commands to rasterize it as lines or polygons or whatever (or the Direct3D equivalent). If you previously thought that GDI was the low-level interface, you've got some reading ahead of you to make this work. But it will run several orders of magnitude faster than pure GDI. So much faster, in fact, that the new architecture is that GDI (and WPF) is built on top of Direct2D and/or Direct3D.

这篇关于窗户低级图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆