Page 1 of 2

setMode doesn't provide desired result...

Posted: Sun Jan 12, 2014 11:07 pm
by WidmerNoel
Well hello everyone.
This is my first post here. I just started out with love.

I tried to set my window mode to the highest possible ratio. That worked fine.
I wanted to test the behavior when I lower the Desktop Dimensions from my OS (Windows 8.0).

My current Desktop Dimension is 1600x900
The highest possible Mode is 1920x1080 (Note: This is higher than the Desktop D.)

The script below reads out the highest possible values and applies these to the window:

Code: Select all

function love.load()
	modes = love.window.getFullscreenModes() --Get all Modes available on my PC
	table.sort(modes, function(a, b) return a.width*a.height > b.width*b.height end) --Sort the modes array (highest first)
	success = love.window.setMode(modes[1].width, modes[1].height, {fullscreen=true}) --Set highest mode and fullscreen
	if success then
		Message = "Success" --love sais setMode was successful
	else
		Message = "Failed" --setMode failed
	end
end

function love.draw()
	love.graphics.print('Highest availible Mode: '..modes[1].width..'_'..modes[1].height, 100, 100) --highest Mode
	local width, height = love.window.getMode() --Get current Mode (should be highest one)
	love.graphics.print('Current Mode: '..width..'_'..height) --Print Current mode
	love.graphics.print('love.window.setMode sais: '..Message, 250, 250) --Print setMode message
end
When the game starts I have 1680x1050. (weird values!)
After minimizing the game using the windows button and maximizing it again, I then have the desired and highest resolution (1920x1080).

Why isn't this mode set from the beginning on and what can I do to change this?

Re: setMode doesn't provide desired result...

Posted: Mon Jan 13, 2014 1:09 am
by Gorus
Well the code certainly looks alright, and worked on both of my 2 machines I tested it on.
Do you by any chance have 2 graphics cards? Mostly interested if you have an integrated card and an slotted card.
While we are at it, what videocard do you have, and have you updated the drivers ?

Re: setMode doesn't provide desired result...

Posted: Mon Jan 13, 2014 6:36 pm
by WidmerNoel
Well great idea with the graphic cards.
I once installed a second card (NVIDIA GeForce GTX 560 Ti) and I have an onboard card as well.
Nvidia driver seems up to date and settings are all set to max res. (1920x1080)

Did you copy paste the code?
I got that nasty feeling that I may messed up with the code. :?
Next test will be to check if it works on my laptop...Update is coming soon...

Re: setMode doesn't provide desired result...

Posted: Mon Jan 13, 2014 7:25 pm
by WidmerNoel
So, I updated my drivers with no effect.

Then I tried the script on my Laptop:
Best Mode: 1366x768
Desktop Mode: 1024x768
Game-res.: 1280x768

Same behavior, when I go back to my Desktop and then back in the game the mode is set to best.

In the love API they say:
If setMode() failes, love will automatically set the closest mode.
Couldn't it be, that somehow love can't set the best mode and does some stupid things?
But that wouldn't explain why it suddently switches to the best mode after switching to desktop and back.

Any ideas? (I still think I missed some window.update function, maybe)
Or should I open an issue on Atlassian?

Re: setMode doesn't provide desired result...

Posted: Mon Jan 13, 2014 7:43 pm
by slime
I can't reproduce this in Mac OS X - it might be a bug in SDL's Windows-specific window / display mode code.

Re: setMode doesn't provide desired result...

Posted: Mon Jan 13, 2014 9:15 pm
by Gorus
Are you forcefully disabling windows updates? your Windows 8 should be updated to windows 8.1. While we're at it, if you don't have a "legit" copy of windows 8, that could be the issue. Many of the cracks/activators/repacks are crap quality and no proper scene has released a trustable cracked win8 yet.

Re: setMode doesn't provide desired result...

Posted: Tue Jan 14, 2014 3:51 pm
by WidmerNoel
I updated my NVIDIA driver today and updated to Windows 8.1 (Pro).
My Windows isn't cracked, it's a regular license.
And there are no more Windows Updates to install left.

Can someone replicate this on a W8 machine?

Re: setMode doesn't provide desired result...

Posted: Tue Jan 14, 2014 4:00 pm
by Nixola
Nvidia graphics card on Windows 8.1 (not cracked, but not legit too), same thing happens.

Re: setMode doesn't provide desired result...

Posted: Tue Jan 14, 2014 11:32 pm
by WidmerNoel
This issue won't fix.
I'll try some more things and let you know if there is some kinda workaround.

Re: setMode doesn't provide desired result...

Posted: Wed Jan 15, 2014 9:52 pm
by davisdude
It works on my computer (also using Windows 8)