如何用我自己的4x4矩阵更新的OpenGL模型视图矩阵?矩阵、自己的、视图、用我

2023-09-08 01:15:10 作者:抵不住思念苦

我有4x4矩阵对象的变换。

I have 4x4 matrix for object's transformations.

float mat44[16];

但我不知道如何使用我的矩阵更新的OpenGL模型视图矩阵。我应该使用的glTranslatef()/ glRotatef()有初步认识的值从我的基质或者我应该使用glLoadMatrix(),glMultMatrix()?请帮助。谢谢你。

But i don't know how to update OpenGL ModelView matrix using my matrix. should i use glTranslatef()/glRotatef() with relavant values from my matrix or should i use glLoadMatrix(),glMultMatrix() ? Pls help. Thanks.

推荐答案

如果你想申请已在OpenGL的矩阵堆栈的改造,目前改造,那么你应该写:

If you want to apply your transformation to current transformation already in OpenGL matrix stack, then you should write:

glMultMatrixf(mat44);

但是,如果你要放弃什么目前OpenGL的矩阵堆栈的顶部,并使用自己的转型,那么你应该写:

But if you want to discard what's currently on top of OpenGL matrix stack and use your own transformation, then you should write:

glLoadMatrixf(mat44);