LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: hvor on September 20, 2005, 08:52:00

Title: 3d weapon model in HUD?
Post by: hvor on September 20, 2005, 08:52:00
I'm wondering if anyone tried (and perhaps succeded) to place a 3d model of a weapon in HUD. So, a fixed model instead of just an image of it. I encoutered difficulties: model of weapon updates position every frame from camera position and places itself just in front of camera, but I found that bad soulution - model is "shaking" up and down too much. I need fixed model, that is (updating position every frame) obviously not the way to do that.
I need something like placing an image in ortho mode on screen, but in this case it should be an 3d model. Since it have 3d (z too), it can't be displayed in ortho mode.
Any suggestions?  :roll:
Title: 3d weapon model in HUD?
Post by: hvor on September 20, 2005, 12:28:13
OK, the solution was simple, but not obvious to me in the first time:
glPushMatrix();      // store matrix state
  glLoadIdentity(); // reset matrix
  drawHudModel();   // draw model in appropriate location
glPopMatrix();       // restore matrix state