本文介绍了Java3D的:绘画2D HUD超过Canvas3D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的Java3D渲染三维场景。我想上的三维图像的顶部覆盖的二维抬头显示器。我怎样才能有效地绘制2D内容的3D画布之上?
谢谢!
解决方案
//使用preferred配置创建一个Canvas3D
Canvas3D canvas3d =新Canvas3D(配置)
{
私有静态最后长的serialVersionUID = 7144426579917281131L;
公共无效postRender()
{
。this.getGraphics2D()setColor(Color.white);
。this.getGraphics2D()束带(抬头显示器(HUD)作品!,100,100);
this.getGraphics2D()平齐(假)。
}
};
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!
解决方案
// 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);
}
};
这篇关于Java3D的:绘画2D HUD超过Canvas3D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!