简体   繁体   中英

Rotating light source in openGL

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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