openGL中的旋转光源
我已经为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,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.