openGL中的旋转光源

发布于 2024-10-07 09:32:11 字数 197 浏览 0 评论 0原文

我已经为 3d 对象实现了 arcball 界面,这样我就可以用鼠标旋转对象。我有固定光源。我希望光源与物体作为一个整体移动(旋转) - 这意味着如果光线位于物体上方,那么在我旋转物体后,光线会随之旋转并保持在物体上方。我尝试获取 MODEL_VIEW_MATRIX (glGetDoublev();) 并将灯光原始坐标乘以模型视图矩阵,但效果不佳。还有其他方法可以做到吗?谢谢。

I've implemented an arcball interface for a 3d objects so i can rotate the object with the mouse. I have a fixed light source. I want the light source to move (rotate) with the object as one unit - meaning that if the light was above the object, after i rotate the object the light rotates with it and remains above it. I tried to get the MODEL_VIEW_MATRIX (glGetDoublev();) and multiply the light original coordinates by the model view matrix, but it doesn't work well. Any other way to do it? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

憧憬巴黎街头的黎明 2024-10-14 09:32:11

实际上,MODEL_VIEW_MATRIX 也会影响灯光位置,所以我只需在正确的参考系中定义它。

Actualy the MODEL_VIEW_MATRIX effects also the light position, so i only have to define it in the right reference frame.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文