6 Replies - 368 Views - Last Post: 02 November 2013 - 10:14 PM Rate Topic: -----

#1 FrankieTheSkin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-October 13

Problem with IDirect3D9::EnumAdapterModes()

Posted 06 October 2013 - 03:01 AM

Hi there, I must be really stupid, but for all I can see I'm doing what needs to be done to get each resolution ONCE, with the HIGHEST possible refresh rate, but instead I keep getting the LOWEST refresh rate. Can anyone see my - probably obvious - mistake?

int m = 0, c = 0;

for (UINT i = 0; i < modes; i++)
{
	Direct3D->EnumAdapterModes(D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &current);

	if (c > 0 && mode[m].Width == current.Width && mode[m].Height == current.Height)
	{
		if (current.RefreshRate > mode[m].RefreshRate)
		{
			mode[m].RefreshRate = current.RefreshRate;

			continue;
		}
	}

	if (c > 0)
	{
		m++;
	}

	mode[m] = current;
	c++;
}



Is This A Good Question/Topic? 0
  • +

Replies To: Problem with IDirect3D9::EnumAdapterModes()

#2 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,610
  • Joined: 05-May 12

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 06 October 2013 - 06:53 AM

Are you sure that the resolutions are clumped together? You seem to be only checking the last entry in your array when checking for refresh rates.

As an aside, why are you not checking the return values to detect failures?
Was This Post Helpful? 0
  • +
  • -

#3 FrankieTheSkin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-October 13

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 25 October 2013 - 12:40 PM

View PostSkydiver, on 06 October 2013 - 06:53 AM, said:

Are you sure that the resolutions are clumped together? You seem to be only checking the last entry in your array when checking for refresh rates.

As an aside, why are you not checking the return values to detect failures?


I'm increasing the array counter 'm', which is initialised to 0. I'll add the checks later, as a 'just in case' measure, but don't usually get failures, so I write the function first.
Was This Post Helpful? 0
  • +
  • -

#4 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1276
  • View blog
  • Posts: 4,400
  • Joined: 19-February 09

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 25 October 2013 - 10:01 PM

Perhaps print values to screen or file to see what is happening.
Was This Post Helpful? 0
  • +
  • -

#5 FrankieTheSkin  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 06-October 13

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 02 November 2013 - 09:01 AM

View Post#define, on 25 October 2013 - 10:01 PM, said:

Perhaps print values to screen or file to see what is happening.


Exactly what I've done, which is why I can't make any sense of it. Everything seems to work fine until it is supposed to filter out the lower resolutions.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,610
  • Joined: 05-May 12

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 02 November 2013 - 02:51 PM

Can you share the file contents?

Sent from my T-Mobile G2 using Tapatalk 2
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver  Icon User is online

  • Code herder
  • member icon

Reputation: 3172
  • View blog
  • Posts: 9,610
  • Joined: 05-May 12

Re: Problem with IDirect3D9::EnumAdapterModes()

Posted 02 November 2013 - 10:14 PM

The reason why it would be interesting to see the file contents is this: The file will reveal to us what order the data is in. For example, if the data is returned in the following order:
320x200,50
640x480,50
800x600,50
1024x768,50
320x200,60
640x480,60
800x600,60
1024x768,60

Then your code cannot handle it because you are assuming that the data is returned in this order:
320x200,50
320x200,60
640x480,50
640x480,60
800x600,50
800x600,60
1024x768,50
1024x768,60
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1