I start a little game with this good LWJGL!
I want to create a HUD for my game, but i don’t know how to use with LWJGL!
Someone can help me ?
// save your actual projection mode
_gl.matrixMode(GL.PROJECTION);
_gl.pushMatrix();
// go to front in ortho mode
_gl.loadIdentity();
_glu.ortho2D(0, Display.getWidth(), 0, Display.getHeight());
// if needed save your current transformations
_gl.matrixMode(GL.MODELVIEW);
_gl.pushMatrix();
_gl.loadIdentity();
// position in the bottom left corner if needed :)
// _gl.translatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
// now draw stuff
// no depth test
_gl.disable(GL.DEPTH_TEST);
// no loghting needed
_gl.disable(GL.LIGHTING);
// draw a cross in center
_gl.color4f(0.2f,1.0f,0f,0.7f);
_gl.begin(GL.LINES);
_gl.vertex2f(0.0f, 150f);
_gl.vertex2f(0.0f, -150f);
_gl.vertex2f(-200f, 0.0f);
_gl.vertex2f(200f, 0.0f);
_gl.end();
// back to your 3D stuff
_gl.enable(GL.LIGHTING);
_gl.enable(GL.DEPTH_TEST);
_gl.matrixMode(GL.PROJECTION);
_gl.popMatrix();
_gl.matrixMode(GL.MODELVIEW);
_gl.popMatrix();
Hi vrm,
Thanks for your code.
It’s work ok.
But i want to use an image too.
EX: a PNG with all letter …
Have you another piece of code for that.?
Cool, i look that.!!