setMode doesn't provide desired result...

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
WidmerNoel
Prole
Posts: 7
Joined: Sun Jan 12, 2014 10:55 pm

setMode doesn't provide desired result...

Post 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?
User avatar
Gorus
Prole
Posts: 9
Joined: Sat Jan 11, 2014 8:33 pm

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

Post 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 ?
WidmerNoel
Prole
Posts: 7
Joined: Sun Jan 12, 2014 10:55 pm

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

Post 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...
WidmerNoel
Prole
Posts: 7
Joined: Sun Jan 12, 2014 10:55 pm

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

Post 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?
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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.
User avatar
Gorus
Prole
Posts: 9
Joined: Sat Jan 11, 2014 8:33 pm

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

Post 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.
WidmerNoel
Prole
Posts: 7
Joined: Sun Jan 12, 2014 10:55 pm

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

Post 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?
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

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

Post by Nixola »

Nvidia graphics card on Windows 8.1 (not cracked, but not legit too), same thing happens.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
WidmerNoel
Prole
Posts: 7
Joined: Sun Jan 12, 2014 10:55 pm

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

Post by WidmerNoel »

This issue won't fix.
I'll try some more things and let you know if there is some kinda workaround.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

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

Post by davisdude »

It works on my computer (also using Windows 8)
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 0 guests