glm::mat4 xxx

    1. glm::mat4 model = glm::mat4(1.0f);
    2. glm::mat4 view = glm::mat4(1.0f);
    3. glm::mat4 projection = glm::mat4(1.0f);

    glm::rotate glm::translate glm::perspective

    1. model = glm::rotate(model, (float)glfwGetTime(), glm::vec3(1.0f, 0.0f, 0.0f));
    2. view = glm::translate(view, glm::vec3(0.0f, 0.0f, -3.0f));
    3. projection = glm::perspective(glm::radians(45.0f), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);

    实质:

    • 模型变换:进行旋转操作——旋转到和世界坐标方向一样
    • 观察变换:进行位移操作——相机移动=场景的反方向移动
    • 投影变换:透视操作