Gamestudio Links
Zorro Links
Newest Posts
Specular Shader
by Dooley
Yesterday at 18:17
is 3dgs byDirextX or Opengl?
by Dooley
Yesterday at 18:09
Tensorflow and Python 32 bit
by jcl
Yesterday at 13:28
New Zorro version 2.12
by jcl
05/21/19 17:23
Mixed frequency history (M1+D)
by jcl
05/20/19 12:21
This is my fault-tolerant ATR indicator for you
by OptimusPrime
05/18/19 16:35
missing trade variables
by AndrewAMD
05/18/19 12:37
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online
5 registered (kvm, Michael_Schwarz, Ayumi, Dooley, 1 invisible), 519 Guests and 1 Spider online.
Key: Admin, Global Mod, Mod
Newest Members
Reza65, Pritamchakra, h4h4rd, ccm, Pippo
18224 Registered Users
Topic Options
Rate This Topic
#477009 - 05/02/19 11:17 Multi Monitor Info, resolutions, graphics cards
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6841
Loc: Kiel (Germany)
I want to share a code snippet with you that I had made some time ago to enumerate all available monitor resolutions (at the current frequency - you can get others as well, easy to change) on all connected monitors.

Screenshot of the test program:


Download: http://www.pogostuck.com/multiMonitorInfo.zip

How to use: Have a look at the test program. You only need to call multiMonitorGetInfo() once.
Open multiMonitorInfo.h and check what info is available.
_________________________
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Top
#477012 - 05/02/19 13:27 Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku]
Emre Offline
User

Registered: 07/28/07
Posts: 508
Loc: Turkey, izmir
Thank you Felix! You are generous as always.

There is just one little thing. Not a big deal for me but i want to let you know, because since your game is already on market, maybe you'd like to change it. (though it is not necessary for my opinion.)

Your codes can't detect virtual super resolution, until i select one of them. For example; my monitor support maximum 1920x1080. With super resolution option, it's reach 3840x2160.

When i run the code, i get this (desktop resolution is 1920x1080);


then i set the resolution 2304x1296 and i get all resolution;



So, as long as the resolution is in 1920x1080, pogostuck can't detect higher (virtual) resolutions.

Top
#477013 - 05/02/19 13:46 Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre]
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6841
Loc: Kiel (Germany)
Interesting, I did not know that was a thing (super resolutions).
However, I'm using Windows functions to grab all available resolutions, and what you see is what Windows reports.
Can you pick higher/ super resolutions in other games?
_________________________
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Top
#477014 - 05/02/19 13:55 Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku]
Emre Offline
User

Registered: 07/28/07
Posts: 508
Loc: Turkey, izmir
Yes. Tomb Raider series, Resident Evil 7, Dying Light, even Dishonored (very old game) detect and list all resolution. (no need to change desktop resolution )

Edit: i understand it's windows reports but it's also odd that it doesn't list super resolutions, until i change desktop resolution to higher. it doesn't happen in other games. Maybe other developers are using another method to get resolution list. i don't know.


Edited by Emre (05/02/19 14:17)

Top
#477015 - 05/02/19 14:22 Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre]
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6841
Loc: Kiel (Germany)
Okay, thank you. Will look that up later or the next couple of days!
_________________________
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Top
#477018 - 05/02/19 16:38 Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku]
Emre Offline
User

Registered: 07/28/07
Posts: 508
Loc: Turkey, izmir
You are welcome! And be ready, i think i found the cause of the problem and it's bigger than i thought.

it's about desktop refresh rate. When it is set to the highest freq (60 hz), your code can list all resolutions. But, when it was set to 59, it can't detect all resolutions.

i realized; when i set resolution to 2304x1296, refresh rate automatically change to 60 hz. that is why your code detect all resolutions when desktop resolution is 2304x1296.

Most interesting thing is, when i set it 50hz, i just get two resolution:


image upload


as far as i understand, it's related with this code: "displayMode.RefreshRate == multiMonitorInfo.currentFrequency", but you are the expert.

Top
#477021 - 05/02/19 17:28 Re: Multi Monitor Info, resolutions, graphics cards [Re: Emre]
Superku Offline
Senior Expert

Registered: 09/13/03
Posts: 6841
Loc: Kiel (Germany)
Oh, good find!
Yeah, I included that line to not have to deal with different frequencies. Did not know that that's resolution dependent.
_________________________
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

Top
#477022 - 05/02/19 20:18 Re: Multi Monitor Info, resolutions, graphics cards [Re: Superku]
Emre Offline
User

Registered: 07/28/07
Posts: 508
Loc: Turkey, izmir
Here is a quick solution;

Code:
if(multiMonitorInfo.numMonitors)
	{
		int count = 0;
		// get screen rects
		multiMonitorInfo.monitorInfo = (MYMONITORINFO*)sys_malloc(sizeof(MYMONITORINFO)*multiMonitorInfo.numMonitors);
		EnumDisplayMonitors(NULL, NULL, MonitorEnumProc, (LPARAM)&count);
		
		// get display modes
		D3DDISPLAYMODE displayMode;
		int i,j;
		int last_res[2];
		last_res[0]=0;
		last_res[1]=0;
		for(i = 0; i < multiMonitorInfo.numMonitors; i++)
		{
			MYMONITORINFO *pinfo = &(multiMonitorInfo.monitorInfo)[i];
			int maxModes = pd3dKu->GetAdapterModeCount(i,D3DFMT_X8R8G8B8);
			for(j = 0; j < maxModes; j++)
			{
				if(D3D_OK != pd3dKu->EnumAdapterModes(i,D3DFMT_X8R8G8B8,j,&displayMode)) break;
				if(displayMode.Width >= MMminWidth && displayMode.Height >= MMminHeight/* && displayMode.RefreshRate == multiMonitorInfo.currentFrequency*/) 
				{
					if(displayMode.Width==last_res[0]&&displayMode.Height==last_res[1])
					{
						//skip
					}
					else
					{
						pinfo->numModes++;	
						last_res[0]=displayMode.Width;
						last_res[1]=displayMode.Height;
					}
					
				}
				
				
			}
			if(pinfo->numModes)
			{
				last_res[0]=0;
				last_res[1]=0;
				pinfo->displayModes = (DISPLAYMODE*)sys_malloc(sizeof(DISPLAYMODE)*pinfo->numModes);
				int k = 0;
				for(j = 0; j < maxModes; j++)
				{
					if(D3D_OK != pd3dKu->EnumAdapterModes(i,D3DFMT_X8R8G8B8,j,&displayMode)) break;
					if(displayMode.Width >= MMminWidth && displayMode.Height >= MMminHeight /*&& displayMode.RefreshRate == multiMonitorInfo.currentFrequency*/)
					{
						
						if(displayMode.Width==last_res[0]&&displayMode.Height==last_res[1])
						{
							//skip
						}
						else
						{
							DISPLAYMODE* pMode = &(pinfo->displayModes)[k];
							pMode->Width = displayMode.Width;
							pMode->Height = displayMode.Height;
							k++;	
							last_res[0]=displayMode.Width;
							last_res[1]=displayMode.Height;	
						}
						
						
						
					}
				}
			}
			else pinfo->displayModes = NULL;
			MMInfoSortDisplayModes(pinfo,0);
		}
	}


Top


Moderator:  HeelX, Lukas, Rei_Ayanami, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de