I found that if I don't use glLoadIdentity before gluLookAT, then I will see blank screen. I don't understand: why?

有帮助吗?

解决方案

gluLookAt basically calculates a transformation matrix consiting of a translation (to the eye point you specified) and a rotation (to orient it). However, this transformation matrix is multiplied with the current matrix. So if the current matrix is not identiy, your camera will end up somewhere else, the rotation and translation operations will be additionally applied. Note that despite the name, gluLookAt can in princple be used to position and orient any object, not just the "camera".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top