I have a couple of queries/difficulties…
- I have been able to print text on the face of my cubes using textures and glCopyTexImage. But I want to be able to write text in different lines…for e.g. HELLO
WORLD
i want to split the text in different lines. How to do that?
Currently my text is always displayed only at the bottom of the cube and the string gets clipped if its too long.
Is there any way to print the long strings in separate lines and also be able to move them anywhere on the face?
CODE:
public void init(GLAutoDrawable drawable)
{
GL gl = drawable.getGL();
glut = new GLUT();
gl.glClearDepth( 1.0f );
gl.glClear( gl.GL_DEPTH_BUFFER_BIT );
gl.glEnable( gl.GL_DEPTH_TEST );
gl.glDepthFunc( gl.GL_LEQUAL );
gl.glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
gl.glClear(gl.GL_COLOR_BUFFER_BIT);
gl.glShadeModel(GL.GL_SMOOTH);
gl.glEnable(GL.GL_TEXTURE_2D);
texture = genTexture(gl);
gl.glBindTexture(GL.GL_TEXTURE_2D, texture);
gl.glColor4f(1.0f,1.0f,1.0f,1.0f);
glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24, “TEXT 1”);
glut.glutBitmapString(GLUT.BITMAP_TIMES_ROMAN_24, “THIS TEXT on next line”);
gl.glCopyTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_RGB, 0, 0, 128, 128, 0);
gl.glClearColor(0.0f, 1.0f, 1.0f, 0.0f);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR);
}