What haven’t I seen any LWJGL demo app with a resize-window function?..
For native window displays, you would need to recreate the window, the context stays the same so no need to re-init your code/textures/display lists and all that jazz
For AWT, you can use the resize icon and add a WindowListener and use glViewport(position.x, position.y, dimension.x, dimension.y); to change the renderable area of the canvas.
Note that the position isn’t the position of the window in terms of the desktop, its mostly 0,0 which means bottom left.
DP
why would you need it for a game, no really
just shove AWTGLCanvas in a JFrame if you really need window resizing…
But resizing the AWTGLCanvas is simple as you only have to resize the viewport if you not create a canvas that have the size of a fullscreen window. Else dump the old and create a new one. Of course they have to be shared ones!
I expect we will make the window resizable in LWJGL1.1 anyway.
Cas
heh, did you just volunteer ?
Bah no, I don’t need that feature I’m sticking to writing games with it now!!
Cas
Hi all, thanks for the answers, but unfortunatelly i dont understand any… im way too novice for that stuff… does anyone have a pre-mayde code for resizing?
Matzon : I Need it cuz my screen size (14" laptop) is not the same as my friends desktop, and I would like to offer
an options to view it all over the screen, but not in fullscreen mode…
When we talk about resizing the screen, we’re talking about live resize - drag with mouse stuff.
If you need to create a window in another size, just pass another DiplayMode to the create method
Display.getDisplayMode() gets you the current display mode (including size). If you havn’t created a display yet, this will be the size of the desktop. So just use the current display mode and create a windowed display with it.
Im talking about an option for real-time resizing… how can that be preformed? no code examples available anywhere? (btw - thanks for the tips on the displaysize)
real time resizing with mouse isn’t possible.
The only resizing you can do is destroying the display and create a new one with the requested size
How can i retrieve the max width/height of my screen ?
You can use getAvailableDisplayModes() to fetch every supported mode, or use the AWTToolkit to get the current screen measures.
[quote]Display.getDisplayMode() gets you the current display mode (including size). If you havn’t created a display yet
[/quote]
Ok, Thanks, I’ll try it.
of course it is possible, although this post is very old, setting the viewport does change the dimensions but it does this only every second time.
this is what i did:
public static void onResize()
{
GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());
}
...
if(Display.wasResized())
onResize();
… way to revive this thread from the dead. We don’t need zombies roaming around!!
i found this thread on google because of the problem ‘does this only every second time’ and i couldnt find any other threads about that specific problem xD.