Guest User

Untitled

a guest
May 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. while(!Display.isCloseRequested()) {
  2.             if(Display.wasResized()) {
  3.                 System.out.println(Display.getWidth() + " " + Display.getHeight());
  4.                 glOrtho(0, Display.getWidth(), Display.getHeight(), 0, -1, 1);
  5.             }
  6.            
  7.             glClearColor(0, 0, 1, 1);
  8.             glClear(GL_COLOR_BUFFER_BIT);
  9.            
  10.             if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT))
  11.                 x++;
  12.             else if(Keyboard.isKeyDown(Keyboard.KEY_LEFT))
  13.                 x--;
  14.            
  15.             if(Keyboard.isKeyDown(Keyboard.KEY_DOWN))
  16.                 y++;
  17.             else if(Keyboard.isKeyDown(Keyboard.KEY_UP))
  18.                 y--;
  19.            
  20.             glColor3f(1, 0, 0);
  21.             glBegin(GL_TRIANGLES);
  22.                 glVertex2f(x, y);
  23.                 glVertex2f(x + 50, y);
  24.                 glVertex2f(x + 30, y + 30);
  25.             glEnd();
  26.            
  27.             Display.update();
  28.             Display.sync(60);
  29.         }
Add Comment
Please, Sign In to add comment