【发布时间】:2019-10-24 10:53:57
【问题描述】:
我想在我的 guiCam(不受任何旋转或变换影响的第二个摄像头)中渲染固定文本以进行调试。
我认为正在渲染的文本在我的角度来看要么大要么小,但我似乎无法在官方 libgdx 文档中找到文本是如何绘制的以及我可以如何操作大小。
创建:
guiCam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
guiCam.position.set(1f, 1f, 20f);
guiCam.lookAt(0, 0, 0);
guiCam.near = 1f;
guiCam.far = 300f;
guiCam.update();
batch = new SpriteBatch();
batch.setProjectionMatrix(guiCam.combined);
font = new BitmapFont();
font.setColor(Color.RED);
渲染:
font.draw(batch, "debug line here", 200, 200);
有人可以向我解释一下 libgdx 默认字体是如何绘制的,或者是否有更好的解决方案来显示固定文本?
我已经尝试过使用 OrthoGraphic 相机而不是专用相机,但由于我的主要应用程序是 3D,因此 OrthoGraphic 相机不起作用。
【问题讨论】: