在 OpenGL 中使用相机的问题

Problems using camera in OpenGL

你好,我正在做一个可以让相机围绕模型旋转的应用程序,我已经成功导入了obj格式模型
但是我遇到旋转相机的问题,模型会消失,你可以看到

gl.Perspective(180, (double)Width / (double)Height, 100, 50000f);

旋转相机关键代码:

Calculate the center point of the model    
currentX = Math.Sin(angle) * radius;
currentZ = Math.Cos(angle) * radius;

gl.LookAt(currentX,0,currentZ,
          centerPoint.X, centerPoint.Y, centerPoint.Z,
          0, 1, 0
);

检查模型是否不比近裁剪平面更近。还要检查面部剔除:如果您的相机在网格内部,您看到的是多边形的背面,这可能没有被渲染。

尝试修改近裁剪平面使其更靠近相机,并降低 FoV 角度。试试这个:

gl.Perspective(90, (double)Width/(double)Height, 0.01f, 100.0f);