Login  Register

TextRenderer - my text won't show

Posted by Lili on May 31, 2013; 6:56pm
URL: https://forum.jogamp.org/TextRenderer-my-text-won-t-show-tp4029291.html

Hello. I am trying to learn jogl (with shaders) and so far I've been able to make everything I wanted work (from basic geometric shapes to 3D-scan data and animation). However now I am trying to render text and so far it's been mission impossible for me. I really need some help.
So I am trying to use the TextRenderer in jogamp.graph.curve.opengl. I initlialize the textrenderer in my init(GLAutoDrawable drawable) function as follows
gl = drawable.getGL().getGL3();
RenderState rs = RenderState.createRenderState(new ShaderState(), SVertex.factory());
tren = TextRenderer.create(rs,  0);
tren.init(gl);
tren.setAlpha(gl, 1.0f);
tren.setColorStatic(gl, 0.0f, 1.0f, 0.0f); // green
font = FontFactory.get(fontSet).getDefault();
where fontSet is FontFactory.UBUNTU and font is of type Font in jogamp.graph.font

And in my display(GLAutoDrawable drawable) I have
gl = drawable.getGL().getGL3();
gl.glClear(GL3.GL_COLOR_BUFFER_BIT | GL3.GL_DEPTH_BUFFER_BIT);
int[] size = {10, 10, 10};
float[] position = {0, 0, 0};
tren.reshapeOrtho(null,  drawable.getWidth(), drawable.getHeight(), 200f, 500.0f); tren.drawString3D(gl, font, "PLEASEEEE PRINT", position, 12, size);

When I run my code I see the window open but no text shows up. I don't have any runtime errors which means that for some reason it renderes not in the position where my camera is looking at  (which means I don't understand how to call my functions) or that it just doesn't render at all.

Thank you in advance for the help