Login  Register

Re: TextRenderer Problem - Missing Letters in Render

Posted by Xerxes Rånby on Oct 10, 2016; 6:38am
URL: https://forum.jogamp.org/TextRenderer-Problem-Missing-Letters-in-Render-tp4037297p4037299.html

Please publish a link to a "git" repository containing the full code

2016-10-10 1:59 GMT+02:00 Ben [via jogamp] <[hidden email]>:
Hello and thanks in advance for your help.  I am trying to use the text render with glList so that my text is loaded once and then displayed as needed, where needed, etc.  I am using

private TextRenderer TR = new TextRenderer( new Font("SansSerif", Font.PLAIN, 36));

for the renderer.  The list creation function (the returned integer is the list index):
        public int glListText3D(GL2 gl, int id, String text, float[] pos, float scale, float[] color) {
                int txt = gl.glGenLists(id);
                gl.glNewList(txt,GL2.GL_COMPILE);
                gl.glNormal3d(0.0, 0.0, 1.0);
                TR.setColor(color[0],color[1],color[2],color[3]);
                TR.begin3DRendering();
                TR.draw3D(text, pos[0], pos[1], pos[2], scale);
                TR.end3DRendering();
                gl.glEndList();
                return txt;
        }

I keep a list of indexes (TextGL) by textual keyword so I can reference the ID as required.  The display() code for publishing the text:
                                                gl.glPushMatrix();
                                                                                               
                                                // rotation and translation for camera viewing
                                                gl.glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); gl.glRotatef(view_roty, 0.0f, 1.0f, 0.0f); // rotation
                                                gl.glTranslatef(coordinate_calculate(crds[0]),coordinate_calculate(crds[1]) + (0.5f * size[1]),coordinate_calculate(crds[2]));
                                               
                                                // Scale and Color
                            gl.glScalef((float)ES.font_scale()*world_size(true),(float)ES.font_scale()*world_size(true),(float)ES.font_scale()*world_size(true));
                                        gl.glColor4f(fnt_clr[0],fnt_clr[1],fnt_clr[2],fnt_clr[3]); // TODO - this does nothing
                                                 
                                                // Text
                                                gl.glCallList(TextGL.get(labels.get(i)));
                                                gl.glPopMatrix();


The problem I am having is that the results are missing letters.  Specifically, E,L,N (and some others).

Another side problem - if I try and use gl.glColor4f() prior to the CallList I get no change in color.  Scale and translation work fine.

Sorry this isn't a full code post - the full code is 10,000+ lines and not public.


If you reply to this email, your message will be added to the discussion below:
http://forum.jogamp.org/TextRenderer-Problem-Missing-Letters-in-Render-tp4037297.html
To start a new topic under jogl, email [hidden email]
To unsubscribe from jogamp, click here.
NAML