No window resize in LWJGL?

Works every time for me…

Cas :slight_smile:

Or create a JFrame, add a Canvas, set the Canvas to the Display’s parent (Display.setParent(Canvas)), and resize the JFrame in any way you like. AWTGLCanvas is deprecated.

Most of information in this thread is now out of date. So just by way of update, as of LWJGL 2.8 the native Display has the ability to be resized.

Its disabled by default but to enable it you call the following method Display.setResizable(true);

Then you can call Display.isResized() which will return a boolean to let you know if the Display has been resized, allowing you to resize your content accordingly. The Display.getWidth() and Display.getHeight() are also new, giving you further information of the window size.

you know its still doesn’t work

just use Display.setResizable(true);
make the background color like red

not draw a line or something which is as long as the width

if you resize it so thats smaller, its all fine, but bigger, that new space is not drawn to

this is just Display.setResizable(true); and not changing the glViewport, because that would just shrink/stretch everything

If you don’t update the glViewport, you can’t draw outside the old boundaries. Try to add GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight()); to the beginning of your game loop inside an if-statement checking Display.isResized(), just like Kappa said.

yeah like I said, you stretch everything then, which I dont wanna do

then also adjust your projection matrix :clue: