I’ve returned to this project, and made it work. But now I want to know how does resizing of the window work (Display.getWidth or JFrame.getWidth())? If I render something on screen with opengl (I use Display.getWidth/2 to render 2D in center) and then resize this screen everything moves out of place (aspect ratio messes up, before I used Display.wasResized() to renew ratio on gluPerspective). I tryed to use Frame.getWidth() and getHeight() but I get same result. I want to know how are display and jframe connected exactly.
sry for my typing, i need to get some sleep.
parent code:
Canvas = new Canvas();
Frame = new JFrame("sup");
Frame.setSize(1280, 720);
Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Frame.setBackground(Color.BLACK);
Canvas.setBackground(Color.BLACK);
Frame.getContentPane().add(Canvas);
Frame.setLocationRelativeTo(null);
Frame.setVisible(true);
try {
Display.setVSyncEnabled(true);
Display.setParent(Canvas);
Display.create();
} catch (Exception e) {
e.printStackTrace();
Display.destroy();
System.exit(0);
}