Re: TextRenderer overlaped
Posted by Art on May 09, 2016; 6:17pm
URL: https://forum.jogamp.org/TextRenderer-overlaped-tp4036666p4036693.html
I created a custom text renderer. However, my initialization logic may still apply. Generally you want to disable depth test when rendering things on top of, or very close to, other things. This also means that you will have to control the rendering order. Here's my initialization logic before text rendering.
// setup drawing environment
gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT);
gl.glDisable(GLLightingFunc.GL_LIGHTING);
gl.glDisable(GLLightingFunc.GL_COLOR_MATERIAL);
gl.glMaterialfv(GL.GL_FRONT, GLLightingFunc.GL_EMISSION, Color.TRANSPARENT.toRgbArray(), 0);
gl.glDisable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_BLEND);
gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA);
and then cleanup after rendering:
gl.glPopAttrib();