glMulMatrix和glTranslate(或glRotate)之间的区别

时间:2016-09-16 01:21:03

标签: opengl rotation translation

我已经习惯了现代的OpenGL语法,但是我必须处理一个使用旧语法的现有代码,尽管它应该更简单,但这对我来说太困惑了!

我想知道使用glMulMatrix(并传递翻译矩阵)和使用glTranslate并传递xyz之间的区别翻译?

同样的问题适用于glMulMatrix(并传递轮换矩阵)或使用glRotate并传递xyz轮换?

1 个答案:

答案 0 :(得分:2)

使用[ { "TestId":1, "AccountId":1, "SomeString":"This is an updated test", "SomeTimestamp":"2016-01-01T00:00:00Z", "SomeDecimal":5.55 }, { "TestId":3, "AccountId":1, "SomeString":"This is a third test", "SomeTimestamp":"2016-01-01T00:00:00Z", "SomeDecimal":5.55 }, { ... removed for brevity ... } ] ,您需要自己创建矩阵(按列主要顺序),并使用该函数将其传递给OpenGL。通过使用[ { "RowError":"", "RowState":2, "Table":[ { "TestId":1, "AccountId":1, "SomeString":"This is an updated test", "SomeTimestamp":"2016-01-01T00:00:00Z", "SomeDecimal":5.55 }, { "TestId":3, "AccountId":1, "SomeString":"This is a second test", "SomeTimestamp":"2016-01-01T00:00:00Z", "SomeDecimal":5.55 }, { ... removed for brevity ... } ], "ItemArray":[ 1, 1, "This is an updated test", "2016-01-01T00:00:00Z", 5.55 ], "HasErrors":false }, { "RowError":"", "RowState":2, "Table":[ ... there seems to be an instance of this for every row in the result ... ], "ItemArray":[ 1, 1, "This is an updated test", "2016-01-01T00:00:00Z", 5.55 ], "HasErrors":false } ] glMultMatrix,您只需传递参数并让OpenGL构建它。

之后,处理将是相同的。在过去,对于初学者来说,使用glTranslateglRotate更容易理解和使用,而对于更高级的用户,glTranslate更自然,因为通常您会积累转换(场景图)并将其传递给复合场景。