how do i render text on my perspective viewport?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

how do i render text on my perspective viewport?

diskhub
I wish to render text on top of my viewport but i do not know how to do so.
Can someone advice me?

I tried the glutBitmapString but it doesn't seem to work :(
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

Demoscene Passivist
Administrator
Try com.jogamp.opengl.util.awt.TextRenderer
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

diskhub
Hi,
thanks.
But does it only appear on Ortho view?
Cos i wish to have my text appearing on my perspective view and it didn't work  for it.

Ortho works though~
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

diskhub
gl.glViewport(0,0,400,400);
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
gl.glOrtho(0, getWidth(), getLength(), 0, -10, 200);
gl.glMatrixMode(GL2.GL_MODELVIEW);
gl.glLoadIdentity();
...
...
renderer.beginRendering(drawable.getWidth(), drawable.getHeight());
renderer.draw("TESTING", 0, 300);
 renderer.endRendering();

works on the Ortho.

but  my gl.Perspective view didn't work.
I also tried

renderer.begin3dRendering((, but i failed.
Any quick snipplet of the code?

Sorry for the trouble
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

diskhub
ha, i know why.
I have to use draw3d for it.
It's amazing how a print text is so complicated on the 3d view...
I guess if i want to have it "superimpose" on the screen, i will have to care about the rotation as well... do i?
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

Demoscene Passivist
Administrator
If u generally only want to superimpose various 2D things, u may take a look at com.jogamp.opengl.util.awt.Overlay wich is exactly for such a purpose.
Reply | Threaded
Open this post in threaded view
|

Re: how do i render text on my perspective viewport?

diskhub
wonderful!
thx so much for ur quick response!