gpt4 book ai didi

Delphi - GLScene如何获取拾取对象的x,y,z

转载 作者:行者123 更新时间:2023-12-02 00:25:58 25 4
gpt4 key购买 nike

我有一个具有基本几何形状的场景(选择演示),我希望当我选择任何对象时返回鼠标光标的 x、y 和 z,否则返回 -1

最佳答案

一般的OpenGL技术是使用gluUnProject()它获取屏幕 x、y 和深度缓冲区的 z 值,并将其反向转换为世界(或 View )坐标。

gluUnProject maps the specified window coordinates into object coordinates using model, proj, and view. The result is stored in objX, objY, and objZ. A return value of GLU_TRUE indicates success; a return value of GLU_FALSE indicates failure.

参见NeHe's tutorial关于如何在通用 OpenGL 应用程序中使用它。希望它能够帮助您朝着正确的方向开始使用 Delphi 应用程序。

关于Delphi - GLScene如何获取拾取对象的x,y,z,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9085723/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com