How can I get view direction from the OpenGL ModelView Matrix?

前端 未结 2 1310
时光说笑
时光说笑 2020-12-19 19:43

I am writing a volume render program that constantly adjusts some plane geometry so it always faces the camera. The plane geometry rotates whenever the camera rotates in ord

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-19 20:45

    Instead of trying to follow the modelview matrix, to adjust your volume rasterizer's fragment impostor, you should just adjust the modelview matrix to your needs. OpenGL is not a scene graph, it's a drawing system and you can, and should change things however they suit you best.

    Of course if you must embedd the volume rasterization into a larger scene, it may be neccessary to extract certain info from the modelview matrix. The upper left 3×3 submatrix contains the composite rotation of models and view. The 3rd column contains the view rotated Z vector.

提交回复
热议问题