标题翻译
Problems with custom 3d renderer in java
问题
所以我最近开始在Java中制作自己的3D渲染器。我已经制作了一个立方体和一个可以用WASD
和鼠标移动的相机。我只有一个问题:
当相机看向其他地方或者立方体的一个点位于显示器的角落时,渲染器会出现问题(它会渲染一个不应该被绘制的多边形)。
经过调试,我发现渲染器想要在x: -142500
的位置渲染一个点(远离我的1500x1500
窗口)。然后我尝试通过实现屏幕剪裁来修复这个问题(这样142500
的x坐标将被移动到屏幕的边缘)。然而,这也没有起作用
我会非常感谢任何帮助。
问题(红色部分是边缘,蓝色条纹区域是白色三角形应该渲染的位置)
英文翻译
So I have recently started on my own 3D renderer in Java. I have made a cube and a camera that can be moved with WASD
and mouse. I have just one problem:
When the camera looks away or a point of the cube ends up on the corner of the display the renderer freaks out (it renders a polygon that shouldn't be drawn).
After debugging I saw that the renderer wanted to render a point at x: -142500
(way out of my 1500x1500
window). I then tried to fix this by implementing screen clipping (so that 142500
x coordinate would be moved to the edge of the screen). Well, that didn't work either
I would appreciate any help.
The problem (the red is where the edge is and the blue striped area is where the white triangle should have rendered)
Edit: dropbox jar file
专注分享java语言的经验与见解,让所有开发者获益!
评论