DisplayMode misreports height for desktop-size decorated windows (Windows XP)

Started by lamster, December 08, 2008, 19:20:26

Previous topic - Next topic

lamster

Just upgraded from 1.1.3 to 2.0.1 and ran into a small bug with decorated windows.

I'm running Windows XP with a 1600x1200 resolution desktop.

I request a 1600x1200, non-fullscreen DisplayMode: Dsiplay.create works, LWJGL claims to have grabbed the mode without incident.  However, it has really given me a 1600x1180 pixel GL surface.  I assume the height has been clipped to avoid the window-decorations-overlap-GL-surface issue that was present in 1.1.3.  This would be OK except that Display.getDisplayMode().getHeight() returns 1200, which throws off all view setup calculations.

For reference, in 1.1.3 LWJGL would give me a real 1600x1200 GL surface, however the top 20 pixels of that surface were permanently obscured by the window decoration.

In an ideal world, I'd like a true 1600x1200 surface + non-overlapping decorations. If WindowsXP disallows larger-than-desktop windows then the current approach (where the surface is clipped) is probably the most correct, provided that Display.getDisplayMode() reports its size correctly.  The 1.1.3 behavior (permanently obscured pixels) is OK by me too: it is intuitively obvious to the user that the context is being clipped due to a max-window-size constraint, and the DisplayMode reports consistent values.

Anyone know a workaround?  Any hope that someone else will do the dirty work of fixing up the native code? :)

bobjob

yeah i got the same issue on the 1200 * 800 laptop when i change from fullscreen to window,  (at max res) I didnt really consider it a problem, because I doubt anyone would play a game windowed at fullscreen.

lamster

Unfortunately we have a few users who run our game at 800x600 on their netbook (1024x600) so I assume they'll run into this issue.

ajvaughan

Quote from: bobjob on December 08, 2008, 20:35:59
because I doubt anyone would play a game windowed at fullscreen.

For some game types (eg. multi-player turn-based strategy games) a maximised window can make a lot of sense.

If you are waiting for other players to finish their turn, chatting/negotiating/plotting strategy with other players via irc (or just killing time browsing the web), whilst still having the game visible underneath is convenient. 


bobjob

Quote from: ajvaughan on December 11, 2008, 04:52:29
Quote from: bobjob on December 08, 2008, 20:35:59
because I doubt anyone would play a game windowed at fullscreen.

For some game types (eg. multi-player turn-based strategy games) a maximised window can make a lot of sense.

If you are waiting for other players to finish their turn, chatting/negotiating/plotting strategy with other players via irc (or just killing time browsing the web), whilst still having the game visible underneath is convenient. 



yeah. A quick fix would be, run the window mode as undecorated.

Nun the less, its defenately a problem.

lamster

Workaround: use glGet(GL_VIEWPORT), thanks MatthiasM!
int displayWidth = displayMode.getWidth();
		int displayHeight = displayMode.getHeight();
		FloatBuffer buffer = BufferUtils.createFloatBuffer(16);
		GL11.glGetFloat(GL11.GL_VIEWPORT, buffer);
		int viewportWidth = Math.round(buffer.get(2));
		int viewportHeight = Math.round(buffer.get(3));
		if (displayWidth != viewportWidth || displayHeight != viewportHeight) {
			System.err.println("Inconsistent displaySize: " + displayWidth + " x " + displayHeight + " vs " + viewportWidth + " x " + viewportHeight);
			displayWidth = viewportWidth;
			displayHeight = viewportHeight;
		}
		setupScreen(displayWidth, displayHeight);


Would still be nice to see a fix for this in 2.0.2 -- can't see any reason DisplayMode should misreport the viewport size.

napier

I noticed a (possibly) related problem.  On WinXP, lwjgl 2.0.1, I can't create a decorated window with height greater than the screen height.  Seems like the window height is capped to the height of the desktop (window width is fine). 

I'm trying to create a non-standard sized window that can span dual monitors.  I use Display.setLocation(-3,-30) to move the window chrome offscreen.  All works fine except that I can't make the window height any larger than the desktop, so when I shift the screen location up 30, I get a 30 pixel gap at the bottom of the screen.

I realize it's not the most common thing to do, but if anybody has any suggestions or workarounds I'd appreciate it.

mark
penGL/Java/LWJGL demos and code: http://potatoland.org/code/gl