I use a TextRenderer (com.jogamp.opengl.util.awt.TextRenderer) to draw text to the screen, however after I load some textures (which otherwise work ok) the text is no longer text but little parts of one of the textures I have loaded.
I load the textures like so…
gl2.glBindTexture(GL.GL_TEXTURE_2D, unit);
gl2.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1);
gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL2.GL_CLAMP);
gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL2.GL_CLAMP);
gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
gl2.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl2.glTexEnvf(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE);
gl2.glTexImage2D (GL.GL_TEXTURE_2D, 0, GL.GL_RGBA, getWidth(), getHeight(),
0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, pixMap.getData());
gl2.glEnable(GL.GL_TEXTURE_2D);
pixMap.dispose();
pixMap = null;
Why might this be happening?
My comment to Banthar’s comment. See above!
I was not using glGenTextures as I wanted control over the reference number of the texture, thought I knew what I was doing lol. Yes of course, the font is loading a texture into the GPU and then I overwrite it, thanks for pointing that out to me.