用GDI绘制opengl/D3D? [英] draw over opengl/D3D with GDI?

查看:364
本文介绍了用GDI绘制opengl/D3D?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用GDI绘制opengl/direct3D表面?如果可以,怎么办?

I'm wondering if it's possible to draw over an opengl/direct3D surface with GDI? and if so, how might it be done?

我问的原因是因为我正在编写一个简单的应用程序来绘制游戏中的一些内容.这些东西全都是2D或文本,例如帧速率信息,自定义十字线,时钟等.

The reason I ask is because I'm writing a simple app to draw a few things in games. Such things would all be 2D or text such as framerate info, custom crosshair, clock, etc.

我知道最好的方法是挂接并使用本机使用的渲染器/游戏,无论是opengl还是direct3d,但我正在将GDI视为AFAIK,无论是opengl和D3D都位于设备上下文中希望可以使用GDI.

I know the best way is to hook in and use whatever the renderer/game is using natively, be it opengl or direct3d, but I'm looking at GDI as AFAIK both opengl and D3D sit on device contexts which I'm hoping can be draw to with GDI.

推荐答案

通常不能直接这样做.从理论上讲,您可以将GDI与OpenGL或DirectX混合使用,并且仅当OpenGL/DirectX设置为使用单缓冲,双缓冲.但是,这仅是理论上的可能性,因为几乎所有DirectX和OpenGL的使用都具有双重缓冲.

You can't usually do it directly. In theory, you can intermix GDI with OpenGL or DirectX if and only if the OpenGL/DirectX is set up to use single buffering, not double buffering. That, however, is little more than a theoretical possibility, because virtually all use of DirectX and OpenGL is with double buffering.

我会尝试其他方法,例如在无边界的.

I'd try something else, such as drawing your data in a borderless layered window.

这篇关于用GDI绘制opengl/D3D?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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