Java3D: Painting 2D HUD over a Canvas3D

自古美人都是妖i 提交于 2019-12-30 09:28:28

问题


I'm using Java3D to render a three-dimensional scene. I would like to overlay a two-dimensional "heads-up-display" on top of the 3d image. How can I efficiently paint the 2d content on top of the 3d canvas?

Thanks!


回答1:


    // 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);
        }
    };


来源:https://stackoverflow.com/questions/2559220/java3d-painting-2d-hud-over-a-canvas3d

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!