开发者

Rotating light source in openGL

开发者 https://www.devze.com 2023-01-29 23:23 出处:网络
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 - m

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 th开发者_运维知识库e 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消