Advertisement
Guest User

Untitled

a guest
Sep 24th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
  2. int dt = getDelta();
  3. Display.sync(60);
  4. InputHandler.update(dt, cam, cam.sb);
  5.  
  6. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  7. glLoadIdentity();
  8. cam.useView();
  9. cam.update(dt);
  10. for(Block block : blocks){block.draw();};
  11. floor.draw();
  12.  
  13. //Attempt to render 2d over the 3d
  14.  
  15. // save your actual projection mode
  16. glMatrixMode(GL_PROJECTION);
  17. glPushMatrix();
  18. glLoadIdentity();
  19. glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1);
  20. glMatrixMode(GL_MODELVIEW);
  21. glLoadIdentity();
  22. glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
  23. glDisable(GL_DEPTH_TEST);
  24.  
  25. // draw a cross in centre
  26. glColor3f(1,1,1);
  27. glBegin(GL_QUADS);
  28. glVertex2f(0f, 0f);
  29. glVertex2f(0.0f, 200f);
  30. glVertex2f(200f, 200.0f);
  31. glVertex2f(200f, 0.0f);
  32. glEnd();
  33.  
  34.  
  35. // back to 3D stuff
  36. glEnable(GL_DEPTH_TEST);
  37. glMatrixMode(GL_PROJECTION);
  38. glPopMatrix();
  39. glMatrixMode(GL_MODELVIEW);
  40. glPopMatrix();
  41.  
  42.  
  43. Display.update();
  44. `}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement