Advertisement
Guest User

Untitled

a guest
Apr 20th, 2013
926
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. public void draw2D()
  2. {
  3. // switch to 2d drawing
  4. glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  5. glClearDepth(1);
  6. glViewport(0,0,800,600);
  7. glMatrixMode(GL_MODELVIEW);
  8. glMatrixMode(GL_PROJECTION);
  9. glLoadIdentity();
  10. glOrtho(0, 800, 600, 0, 1, -1);
  11. glMatrixMode(GL_MODELVIEW);
  12. glLoadIdentity();
  13.  
  14. // draw your 2d stuff here
  15.  
  16. // reset to 3d drawing mode
  17. glMatrixMode(GL_PROJECTION);
  18. glLoadIdentity();
  19. gluPerspective(45.0f, 4/3.0f, 0.1f, 1000);
  20. glMatrixMode(GL_MODELVIEW);
  21. glLoadIdentity();
  22. glEnable(GL_DEPTH_TEST);
  23. glDepthFunc(GL_LEQUAL);
  24. glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement