我想在libgdx ModelBatch中渲染BitmapFont。我只用SpriteBatch"找到样品。当然我可以在3D空间中移动SpriteBatch,但它可以在" ModelBatched"之前或之后渲染。对象。但我想让它呈现在正确的z位置。
E.g。
然后modelInstanceB应该覆盖Render Font应覆盖modelInstanceB。
换句话说,我想在ModelBatch上下文中渲染字体。
modelBatch.begin(camera);
modelBatch.render(modelInstanceA);
modelBatch.render(font);
modelBatch.render(modelInstanceB);
modelBatch.end();
是否有内置的方法来实现这一目标?
答案 0 :(得分:3)
If the models are opaque, you could draw your text with SpriteBatch after the modelBatch.end()
call, but you'd need to call Gdx.gl.glEnable(GL20.GL_DEPTH_TEST); before spriteBatch.begin()
. Then disable it after spriteBatch.end()
to clean up (libgdx classes by default expect it to be off).