2d over 3d gone missing.

Hi Guys,

I’m trying to draw a 2D line from a 3D point on a 3D object to a 2D text label that I’m rendering with the textRender package.

below is the code I’m using which draws absolutely nothing visible???

Could somebody explain why.

        textRenderer.beginRendering(drawable.getWidth(), drawable.getHeight());
        textRenderer.setColor(c, c, c, 1.0f);
        textRenderer.draw(it.name, x+ 20, y );
        textRenderer.endRendering();
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        glu.gluOrtho2D(0, drawable.getHeight(), 0, drawable.getWidth());
        gl.glColor4f(0.5f,1.0f,0.5f, 1.0f);
        gl.glBegin(GL.GL_LINES);
        gl.glVertex2i(x, y);
        gl.glVertex2i(x+20, y);
        gl.glEnd();
        gl.glPopMatrix();

By the way the textRenderer works a treat - just to let you know that all the hard work is much appreciated!
It’s just my little line that’s missing.
Thanks

Chris

Oh well… got up this morning and saw my obvious mistakes. What I should have done was:

        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glPushMatrix();
        gl.glLoadIdentity();
        glu.gluOrtho2D(0, drawable.getWidth(), 0, drawable.getHeight() );
        gl.glColor4f(0.5f,1.0f,0.5f, 1.0f);
        gl.glBegin(GL.GL_LINES);
        gl.glVertex2i(x, y);
        gl.glVertex2i(x+20, y);
        gl.glEnd();
        gl.glPopMatrix();
        gl.glMatrixMode(GL.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL.GL_MODELVIEW);

Sorry for wasting everyones time.