Guest User

Window

a guest
May 9th, 2015
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.15 KB | None | 0 0
  1. package net.lesson.graphics;
  2.  
  3. import org.lwjgl.LWJGLException;
  4. import org.lwjgl.opengl.*;
  5.  
  6. public class Window {
  7.  
  8.         private static final int WIDTH = 1280;
  9.         private static final int HEIGHT = 720;
  10.         private static final int FPS_CAP = 20;
  11.         private static final String TITLE = "Test";
  12.         public static void createDispaly(){
  13.                 ContextAttribs attribs = new ContextAttribs(3, 2).withForwardCompatible(true).withProfileCore(true);
  14.                
  15.                 try{
  16.                 Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
  17.                 Display.setTitle(TITLE);
  18.                 Display.create(new PixelFormat(), attribs);
  19.                 } catch (LWJGLException e) {
  20.                        
  21.                         e.printStackTrace();
  22.                 }
  23.                
  24.                 GL11.glViewport(0, 0, WIDTH, HEIGHT);
  25.                
  26.         }
  27.        
  28.         public static void updateDisplay(){
  29.                 Display.sync(FPS_CAP);
  30.         Display.update();
  31.                
  32.         }
  33.  
  34.         public static void closeDisplay(){
  35.                 Display.destroy();
  36.         }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment