Ok, things are going well now. I have most everything working now. Just a few anomilies. First, my bitmap font is not displaying. I can’t see anything wrong with what I’m doing…
here’s the old code:
public void print(int x, int y, String text, int set) {
if (set > 1) {
set = 1;
} else if (set < 0) {
set = 0;
}
TextureManager.getTextureManager().bind(texId);
//set the GL states to how we want them.
if(isBlended) {
gl.enable(GL.BLEND);
}
gl.disable(GL.DEPTH_TEST);
gl.enable(GL.TEXTURE_2D);
gl.matrixMode(GL.PROJECTION);
gl.pushMatrix();
gl.loadIdentity();
gl.ortho(0, gl.getWidth(), 0, gl.getHeight(), -1, 1);
gl.matrixMode(GL.MODELVIEW);
gl.pushMatrix();
gl.loadIdentity();
gl.translated(x, y, 0);
gl.listBase(base - 32 + (128 * set));
//Put the string into a "pointer"
ByteBuffer scratch = ByteBuffer.allocateDirect(text.getBytes().length);
scratch.put(text.getBytes());
gl.color4f(red,green,blue,alpha);
//call the list for each letter in the string.
gl.callLists(
text.length(),
GL.BYTE,
Sys.getDirectBufferAddress(scratch));
//reset the GL states.
if(isBlended) {
gl.disable(GL.BLEND);
}
gl.matrixMode(GL.PROJECTION);
gl.popMatrix();
gl.matrixMode(GL.MODELVIEW);
gl.popMatrix();
gl.enable(GL.DEPTH_TEST);
gl.disable(GL.TEXTURE_2D);
}
and the ported code:
public void print(int x, int y, String text, int set) {
if (set > 1) {
set = 1;
} else if (set < 0) {
set = 0;
}
TextureManager.getTextureManager().bind(texId);
//set the GL states to how we want them.
if (isBlended) {
GL.glEnable(GL.GL_BLEND);
}
GL.glDisable(GL.GL_DEPTH_TEST);
GL.glEnable(GL.GL_TEXTURE_2D);
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glPushMatrix();
GL.glLoadIdentity();
GL.glOrtho(0, Window.getWidth(), 0, Window.getHeight(), -1, 1);
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glPushMatrix();
GL.glLoadIdentity();
GL.glTranslatef(x, y, 0);
GL.glListBase(base - 32 + (128 * set));
//Put the string into a "pointer"
ByteBuffer scratch =
ByteBuffer.allocateDirect(text.getBytes().length);
scratch.put(text.getBytes());
GL.glColor4f(red, green, blue, alpha);
//call the list for each letter in the string.
GL.glCallLists(scratch);
//reset the GL states.
if (isBlended) {
GL.glDisable(GL.GL_BLEND);
}
GL.glMatrixMode(GL.GL_PROJECTION);
GL.glPopMatrix();
GL.glMatrixMode(GL.GL_MODELVIEW);
GL.glPopMatrix();
GL.glEnable(GL.GL_DEPTH_TEST);
GL.glDisable(GL.GL_TEXTURE_2D);
}
The main difference being:
//Put the string into a "pointer"
ByteBuffer scratch =
ByteBuffer.allocateDirect(text.getBytes().length);
scratch.put(text.getBytes());
GL.glColor4f(red, green, blue, alpha);
//call the list for each letter in the string.
GL.glCallLists(scratch);
Yet nothing displays to the screen. All the remaining code stayed the same (except for the static GL calls), but I can also put up anything else you’d like to see.