Weird bug with 1440x900 Res, GfxMode3DExists

Blitz3D Forums/Blitz3D Programming/Weird bug with 1440x900 Res, GfxMode3DExists

Ian Martin(Posted 2012) [#1]
Blitz3D 1.106, with IDEal, Win7/32, DX11

Hey!
I'm getting a weird problem with resolutions. I added a bunch of resolutions to the game I'm working on and noticed one wasn't showing up on the selection screen. Resolutions that your computer can show are the only ones that show up. 1440x900 isn't showing up. Running a short program, I CAN get a window at 1440x900.

I wrote a bit of code to check for the gfx mode, which it does and returns, at least on my PC, 0 for mode does not exist (1 is mode exists). It waits for a key and then in the second part of the program, sets the graphics mode to 1440x900 and draws a line in red around the border. Taking a screen shot of this, I verified this rectangle as being 1440x900.

Am I missing something here? Has anyone else had this problem?
I am wanting to include this mode as some laptops and some 19" monitors use this mode. Is it safe to assume someone with a 1440x900 setup would be able to run 1366x768, 1360x768, or 1280x720?

Here's the code, could someone else run it and see what result they get?

Ian

Print GfxMode3DExists(1440, 900, 32)

WaitKey


Graphics3D 1440,900,32

Color 255,0,0

Line (0,0,1439,0)
Line (1439,0,1439,899) 
Line (1439,899,0,899)
Line (0,899,0,0)

WaitKey



Ross C(Posted 2012) [#2]
Is this full screen you can get this? Will 1440,900 work in full screen?


Yasha(Posted 2012) [#3]
Returns 1 and draws correctly (although you might want a Flip in there).

I have had odd results in the past with the GfxMode commands, including obviously-ridiculous resolutions like 25000x1 showing up.

I would advise writing the code as you would expect it to work and having a few people test it on other machines before trying to come up with workarounds.

Is it safe to assume...


No.

The only resolution you can safely assume exists is whatever the desktop is currently using (we've had some threads on this recently).

If you must have a fallback, consider 1024x768 (and that too changes with time: a few years ago that would have been 640x480). In general however you should not attempt to come up with alternatives for the user: that's what options screens are for - you're already dealing with an edge case by the time your code would try to address the issue, so you should just enter an obviously-fallback mode and let the user apply case-specific judgement.


Ian Martin(Posted 2012) [#4]
@Ross, hmm, good point...I think I'm getting the mode in debug, it's a window. When I change the line to Graphics3D 1440,900,32,1, it says "Unable to set graphics mode".
Doing Graphics3D 1440,900,32,2 I get the window in the right size.
Graphics3D 1440,900,32,3 I don't get past the first result, when I hit a key, the box stays the same size and no graphics appear.
So I'm only getting the res in a window. I think debug defaults to windowed.

The main issue is screen edges and the cursor appearing in the right spot. To debug that I have to double check the placement and can't if I can't set the mode on mine :( I'm thinking of cutting this mode rather than doing it wrong.


@Yasha The road to Hell is paved with assumptions, no?!

Thanks for testing it on yours! :)

I've looked into taking the desktop and using that as the default. No easy command to do that in Blitz3D. Right now I am going through modes, picking the best (biggest) widescreen mode. If all of those fail, it picks 4:3 modes. The lowest is 800x600 which should run on a Flintstones computer. Once you get in-game, there is an option to set the resolution to whatever you want.

I'm just wondering if 1440x900 monitors/desktops have 1366x768 modes too, as those seem to be the most popular with the most popular laptops these days, the 15.6" ones? If someone had native 1440x900, the game could just go to 1366x768 or 1280x800 or whatever, and it would be transparent to the user?


Yasha(Posted 2012) [#5]
Well, to help answer your question, the following program...

Local i : For i = 1 To CountGfxModes3D()
	DebugLog "Mode "+i+": ("+GfxModeWidth(i)+"x"+GfxModeHeight(i)+"x"+GfxModeDepth(i)+")" 
Next
WaitKey


...gives this output:

Mode 1: (640x480x16)
Mode 2: (640x480x32)
Mode 3: (320x200x16)
Mode 4: (320x240x16)
Mode 5: (400x300x16)
Mode 6: (512x384x16)
Mode 7: (640x400x16)
Mode 8: (720x480x16)
Mode 9: (720x576x16)
Mode 10: (800x600x16)
Mode 11: (1024x768x16)
Mode 12: (1280x1024x16)
Mode 13: (1400x1050x16)
Mode 14: (1440x900x16)
Mode 15: (1600x1200x16)
Mode 16: (1920x1200x16)
Mode 17: (320x200x32)
Mode 18: (320x240x32)
Mode 19: (400x300x32)
Mode 20: (512x384x32)
Mode 21: (640x400x32)
Mode 22: (720x480x32)
Mode 23: (720x576x32)
Mode 24: (800x600x32)
Mode 25: (1024x768x32)
Mode 26: (1280x1024x32)
Mode 27: (1400x1050x32)
Mode 28: (1440x900x32)
Mode 29: (1600x1200x32)
Mode 30: (1920x1200x32)


As you can see, not actually very imaginative.

Some computers might have other high-res widescreen modes... if so, I reckon the most sensible thing to do is let the game find it as a natural part of the descending-resolution process.

Last edited 2012


Ian Martin(Posted 2012) [#6]
Cool! Thanks for the help guys! :)


Matty(Posted 2012) [#7]
One other thing....

on the computers at work I had a program which would simply pick the highest (widest) resolution and set that using the list generated by blitz but there were problems - some computers for some reason would then generate a display which was rotated...no idea why...they had intel video cards and it was not consistent - only some of these did that....but I wouldn't necessarily trust an 'auto picker' of resolutions..


Ian Martin(Posted 2012) [#8]
Ugh. I will have to keep an eye on that. Was it built in intel graphics?


Rroff(Posted 2012) [#9]
I grab the current desktop resolution in my programs to use as default fullscreen and if that fails try fallbacks: 800x600 windowed, 640x480 windowed then the same but fullscreen.

Instead of trying to create a list automatically of supported resolutions I just include common ones catagorised by common aspect ratios and an option to enter a custom one.


Ian Martin(Posted 2012) [#10]
@Rroff How do you get the desktop res? I'm using Blitz3D and there seems to be no easy way...have to use a .dll?


Yasha(Posted 2012) [#11]
How do you get the desktop res?


I could have sworn there was a thread on this just a couple of months ago... can't find it now!

Going by a much older discussion, it appears to be as easy as this: http://www.blitzbasic.com/Community/posts.php?topic=21501


Ian Martin(Posted 2012) [#12]
Wow, awesome link...that worked in about 3 minutes!
Thanks so much, I've been wondering about that for months... :/

If others are wanting it, the page says
Make a new file and paste this:

; User32.decls
;
.lib "user32.dll"
User32_GetSystemMetrics% (nIndex%) : "GetSystemMetrics"

Save the file as User32.decls in the Blitz3D/userlibs

Then in a new program or in your code:
;Blitz code
Global DesktopWidth  = User32_GetSystemMetrics(0)
Global DesktopHeight = User32_GetSystemMetrics(1)

Print "DesktopWidth=" + DesktopWidth
Print "DesktopHeight=" + DesktopHeight
WaitKey


Run that and there it is...I thought it would be a lot harder than that or the .dll was custom, didn't realize it was part of Windows.

Thanks again to everybody who posted! Anyone who runs a 1440x900 monitor or laptop wanna beta test a program at some point?!


_PJ_(Posted 2012) [#13]
Jus to note:

All the gfx* functions only report the capabilities of the graphics coprocessor, not necessarily the monitor.

Also, it is recommended to build the list of these modes (by calling CountGfxModes or CountGfxModes3D ) before using any other gfx* commands, or they can fail.

Lastly, the idea of checking for current desktop resolution first, then if that fails, drop down to something like 800,600 (which conveniently should fit into even tiny netbook widescreen monitors!) in the evewnt that a user-defined, 'SAFE' configuration hasn't been found - Is a good one in my opinion. I used it myself and it has so far worked on all machines Ive tested it with :)


Ian Martin(Posted 2012) [#14]
Thanks, some good tips there!

One of my test machines is a netbook that runs only two resolutions, either 1024x600 or 800x600. I use that for minspec on the game :)


Rroff(Posted 2012) [#15]
Reason I check 800x600 first is due to there being some high res monitors i.e. 2560x1440 native that do not support 640x480 for some reason and 800x600 is the lowest they go likewise some netbooks, etc. won't go much above 800x600 but its better to get the user up and running with something so they can then tweak it themselves to desired settings than error out completely.

Last edited 2012


Ian Martin(Posted 2012) [#16]
That's true. Good point, make sure something works. I can't do 640x480 (or was it 320x240?) on my setup, which is weird. I think some of the video cards from the last few years are dropping some of those modes, like Mode X, I think it was called.


Ross C(Posted 2012) [#17]
It maybe also worth noting, I had some issues running certain resolutions, on my laptop. I had the troubleshoot advanced graphic properties slider set to basic, and it was causing all sorts of problem, telling me the laptop wasn't 3d capable, and telling me certain resolutions didn't work. Obviously setting the slider did the trick!