如何在Firemonkey App中设置OpenGL1.4环境? [英] How to setup OpenGL1.4 environment in Firemonkey App?

查看:171
本文介绍了如何在Firemonkey App中设置OpenGL1.4环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在较旧的日子里,我将创建一个TForm,放置一个TMyPanel(覆盖WM_PAINT消息),并将其Handle传递给一组WGL函数,找到兼容的pixelformat并创建渲染上下文。就像NeHe教程一样。



现在有了FireMonkey应用程序。如何获取在Win和iOS上工作的OpenGL 1.4渲染环境?



编辑:尝试通过传递TForm来使其工作.Handle(这是NativeUInt)。好消息 - 没有错误从OpenGL结束,但坏消息 - 没有输出TForm任何一个..我显然在这里缺少一些关键的部分,有谁有一个工作的OpenGL在FireMonkey应用程序?

解决方案

经过一些调查,我已经设法在Windows平台上的FireMonkey中创建了OpenGL上下文。我还没有访问iOS,但我确定可以在那里完成任务。



解决方案:添加 FMX .Platform.Win 使用子句(可能需要将其包装到 IFDEF 对于iOS)。现在我们可以使用 FmxHandleToHWND(Form1.Handle)来获取有效的 HWND 。而已。在MacOS上,通过添加 FMX.Platform.Win 并通过 H_WND:= FmxHandleToObjC(AHandle); 调用。


In older days I would create a TForm, place a TMyPanel on it (with overriden WM_PAINT message) and pass its Handle to a bunch of WGL functions that find a compatible pixelformat and create rendering context. Just like NeHe tutorials did it.

Now there comes FireMonkey application. How to get OpenGL 1.4 rendering context there that is working on Win and iOS?

EDIT: Been trying to make it to work by passing TForm.Handle (which is NativeUInt). Good news - no errors from OpenGL end, but bad news - no output on TForm either.. I'm obviously missing some critical piece here, does anyone has a working OpenGL in FireMonkey application?

解决方案

After some investigations I have managed to create OpenGL context in FireMonkey on Windows platform. I don't have access to iOS yet, but I'm sure something can be done there as well.

To the solution: add FMX.Platform.Win to uses clause (might need to wrap it into IFDEF's for iOS). Now we can use FmxHandleToHWND(Form1.Handle) to get valid HWND. Thats it. On MacOS the same is done by adding FMX.Platform.Win and through H_WND := FmxHandleToObjC(AHandle); call.

这篇关于如何在Firemonkey App中设置OpenGL1.4环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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