我正在编写一个简单的obj模型查看器。在调整窗口大小时如何制作屏幕的对象中心?目前,当我展开屏幕时它向右移动,当屏幕变小时向左移动。
有一个模型转换,中心对象位于(0,0,0)(cx,cy,cz是对象的中心)
gl_Position = mvp * vec4(VertexPosition, 1.0);
并在顶点着色器中:
void reshape(int w, int h)
{
height = h;
width = w;
// set viewport to stretch the CVV to fit exactly in the display window
glViewport(0, 0, w, h);
glutPostRedisplay();
}
重塑回调:
msg += u'\U0001f468'