gpt4 book ai didi

java - 获取相机和精确物体之间的距离

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

当我们需要获取相机与我们指向的 3D 对象之间的距离时,我们使用 GL11.GL_DEPTH_COMPONENT 。问题是我想获取相机与距离相机最近的物体后面的物体之间的距离。可以这样做吗?怎么办?

最佳答案

这已成为我最常写的 OpenGL 说明:

OpenGL 不是场景图。它只是将点、线和三角形绘制到 2D 帧缓冲区。 OpenGL 中不存在诸如对象或相机之类的东西。只有几何基元,OpenGL 在光栅化它们的那一刻就忘记了它们,以及帧缓冲区中这个过程的结果。 OpenGL 没有“前面”或“后面”的概念。

你问的问题完全超出了OpenGL的范围。您想要的是一个实现光线 - 三角形相交拾取的场景图。

我只能重申尼可波拉斯已经回答的内容:

OpenGL is for rendering; it's for drawing stuff. It's depth buffer exists for that purpose. And the depth buffer only stores the distance from the Z-plane of the camera, not the radial distance from the point to that point on the triangle.

关于java - 获取相机和精确物体之间的距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10592056/

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