Java3D:在Canvas3D上绘制2D HUD

时间:2010-04-01 08:58:38

标签: java java-3d 3d

我正在使用Java3D渲染三维场景。我想在3d图像的顶部叠加一个二维“抬头显示器”。如何在3d画布上高效绘制2d内容?

谢谢!

1 个答案:

答案 0 :(得分:7)

    // Create a Canvas3D using the preferred configuration
    Canvas3D canvas3d = new Canvas3D(config)
    {
        private static final long serialVersionUID = 7144426579917281131L;

        public void postRender()
        {
            this.getGraphics2D().setColor(Color.white);
            this.getGraphics2D().drawString("Heads Up Display (HUD) Works!",100,100);
            this.getGraphics2D().flush(false);
        }
    };