https://forum.jogamp.org/Text-Rendering-to-JOGL2-tp3617263p3622290.html
Hi Wade,
Initially, before porting to JOGL2, I happily used this sort of thing to render text:
public void initTextRenderer() {
Font font = new Font("SansSerif", Font.BOLD, 14);
textRenderer = new TextRenderer(font, true, false) {};
}
...
textRenderer.begin3DRendering();
textRenderer.draw3D(pps, 0, 0, 0, 0.007f);
textRenderer.drawString3D(gl, null, pps, xrot, VW, VW);
textRenderer.end3DRendering();
It was great. Now, it looks like that doesn't work anymore. So, I've been trying to figure out what will work.
> TestAWTTextRendererUseVertexArrayBug464.java example listed by Sven above seems to work fine for me (I just pasted the code verbatim into a file, fixed an import, and ran it). Are you running the above example, or something else of your own devising?
I know I'm a little clueless here, so I do apologize for needing help. My idea was that if I added your classes (GPURendererListenerBase01, GPUTextGLListener0A, and GPUTextRendererListenerBase01) to my project, that I should be able to somehow call/use GPUTextRendererListenerBase01 to render to a canvas. I can get everything to compile, but I really don't know how to implement that GPUTextRendererListenerBase01 class. I tried this sort of thing:
canvas6.addGLEventListener(new GPUTextRendererListenerBase01(null,1,false,false) {});
... but that's what's giving me the NPE.
I'm just having a really hard time believing it is this hard to just put text at a point in 3d space on a glcanvas.
Am I going in the totally wrong direction? I must be!!
>Also, it might help if you listed your platform and graphics card.
Mac OS X 10.6.8
Intel HD Graphics 3000
Java SE 6 1.6.0_29-b11-402
I truly appreciate any help at all. This stuff has gotten very complex!
Thanks,
Tami