How to draw directly to Canvas3D

I want to draw text to my screen, AFTER the rendering is done.

I see that Canvas3D inherits from awt.Canvas, so I thought maybe I’d override paint(), postRender() or postSwap(), but none of those seemed to do what I want.

“Back in the day”, when I was using JOGL, I’d complete my render, then go into glOrtho2D mode, then draw text onto the screen there, then do my GL-swap. I’m ok with doing that in J3D, except I don’t know how to interrupt the pipeline to do that.

Or I can just draw on the cavas, if there’s a way to do that.

What I was trying that didn’t work:


	public	void	paint (Graphics gr)
	{
		super.paint (gr);

		gr.setColor (Color.white);
		gr.drawString ("Foo", 50, 50);
	}

(Tried similar things with postRender() & postSwap(), too – except I had to call getGraphics().)

No text shows up on my screen.

Help? Hints? Snippets?

Thanks!

To follow up, I found A way (Google!), but it’s sub-optimal. Basically, I’ve got:


(My canvas class...)
	private		J3DGraphics2D	j3dgr	= null;

	public	void	postRender ()
	{
//*		super.postRender ();
		drawText();
	}


    private void drawText()
	{
		if (j3dgr == null)
			j3dgr = getGraphics2D();

		j3dgr.setColor(Color.WHITE);
		j3dgr.drawString ("foo", 10, 10);
		j3dgr.flush (true);
    }

Which works display-wise, but completely destroys my frame-rate. (The slow part seems to be the flush().)

So my new & improved question is: how do I do this in a reasonable amount of time?

I don’t have a good answer. Just that creating 2D overlays with Java3D is difficult. The postRender approach is know to destroy performance. So the only way seems to be to do the 2D stuff in 3D as well.