简体   繁体   English

openGL中的旋转光源

[英]Rotating light source in openGL

I've implemented an arcball interface for a 3d objects so i can rotate the object with the mouse. 我已经为3D对象实现了一个arcball接口,因此我可以使用鼠标旋转对象。 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. 我试图获取MODEL_VIEW_MATRIX(glGetDoublev();)并将浅色原始坐标乘以模型视图矩阵,但是效果不佳。 Any other way to do it? 还有其他方法吗? Thanks. 谢谢。

实际上,MODEL_VIEW_MATRIX也会影响灯光位置,因此我只需要在正确的参考系中对其进行定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM