OpenGL or DirectX

“It’s done by poorly optimised and stupid helper lib D3DX”

Thats the most fantastic damning of D3DX I’ve heard so far in a single sentance

Conclusion had been made, OpenGL is better than Direct3D!

Hi

there is a simple workaround to avoid running only at 60hz refesh rate, just before setting the screen resolution enumerate all display modes and chose that with the highest refresh rate. So you don’t have to worry about the bug.

DEVMODE dm;
memset(&dm, 0, sizeof(dm));
dm.dmSize = sizeof(DEVMODE);
int mode=0;
vector < DEVMODE> modes,new_modes;
vector < DEVMODE>::iterator mode_it;
while(EnumDisplaySettings(NULL,mode++,&dm))
modes.push_back(dm);
if(modes.size()<1)
{
CriticalError(“found no valid display settings”);
return;
}

for(mode_it=modes.begin();mode_it < modes.end();mode_it++)
{
if( (mode_it->dmBitsPerPel==bits)&&(mode_it->dmPelsWidth ==width)&&
(mode_it->dmPelsHeight==height))
{
new_modes.push_back(*mode_it);
}

	}

	if(new_modes.size()&lt;1)
	{
		CriticalError("invalid resolution");
		return;
	}
	m_window.m_devmode=dm=new_modes.back();
	m_window.m_devmode_valid=true;
	m_window.m_bits=dm.dmBitsPerPel;
	m_window.m_width=dm.dmPelsWidth;
	m_window.m_height=dm.dmPelsHeight;
	printf("entering fullscreen mode : %i x %i x %i @%i hz

",m_window.m_devmode.dmPelsWidth,m_window.m_devmode.dmPelsHeight,m_window.m_devmode.dmBitsPerPel,m_window.m_devmode.dmDisplayFrequency);
ChangeDisplaySettings(&dm, CDS_FULLSCREEN);

Bye
ScottManDeath

Ahh I knew there was also a way to work around it in code, but I didn’t know what it was. Thanks a whole lot, ScottManDeath.

Must not forget the most important difference:

D3D has only 3 letters!!!
Therefore…it is much easier to spell!!!

Deiussum,

The XP refresh rate limitation is a known issue (although Microsoft probably doesn’t acknowledge it). OpenGL games played under XP are limited to 60Hz. My XP Pro does run at 85Hz for normal Windows operation, but when games switch to fullscreen modes, they switch to the lower refresh. I can confirm this happening on Jedi Knight II and Soldier of Fortune II, the only two games I have installed since I switched to XP.

Luckily on Q3 based games, you can type r_displayRefresh x at the console where x is the desired refresh rate, then vid_restart. I looked at registry solutions when I learnt about this problem but there aren’t any currently AFAIK. You should find information about the problem via google, I guess. e.g. ‘“windows xp” “refresh rate” 60Hz’ gives heaps of links, as well as some limited fixes.

IIRC, I learnt about the problem initially on the advanced board (not sure, though). God knows why Microsoft introduced this limitation to the OS. Hopefully future service packs will fix it.

On 06-18-2002 02:36 PM, a frequent contributor named Jeeeez made the following remark:
D3D has only 3 letters!!!
Therefore…it is much easier to spell!!!

…uhmm, ‘3’ is NOT a letter, least the last time I checked grin

On 06-18-2002 07:26 PM, a frequent contributor named ffish made the following remark:
IIRC, I learnt about the problem initially on the advanced board (not sure, though). God knows why Microsoft introduced this limitation to the OS. Hopefully future service packs will fix it.

Knowing Microsoft, I don’t think they’ll ever release a fix for it, or acknowledge it in the first place–they claim it’s a video driver’s issue, since they do have the ability to override the limitation if they choose to put that option in. Microsoft has always been trying to kill off their competitors–Java, Mozilla, etc–by doing weirdness to their operating system, and now they’re trying to take out OpenGL. Even with Longhorn, seriously, have you ever ran a D3D and an OpenGL app simultaneously? It’s not something you’d want to do.

Ok, I admit maybe there’s some fullscreen limitation on refresh rate. I don’t write too many fullscreen demos.

But! OpenGL itself doesn’t setup fullscreen, so the limitation would really be with the ChangeDisplaySettings API function, not OpenGL itself. Those games that use OpenGL fullscreen most likely don’t request any particular refresh rate so it defaults to a “safe” one. With D3D, setting up the fullscreen is handled for you underneath.

Also, I think I read once that EnumDisplaySettings isn’t guaranteed to give you a display mode that will work with your monitor.

Earlier versions of win9x did not allowed the refresh rate to be changed from a program. I think that can explain some things about older games made before XP. I have not heard anything about EnumDisplaySettings but it is of course possible to set a unsupported value.

When is OpenGL 2.0 coming out anyway?? Anyone have an approximate date? or month, or something?

On 06-19-2002 06:58 AM, a frequent contributor named Deiussum made the following remark:
Also, I think I read once that EnumDisplaySettings isn’t guaranteed to give you a display mode that will work with your monitor.

That is absolutely correct, Deiussum. Direct3D checks to see of your monitor supports the display mode your program requests before it makes the switch. OpenGL, on the other hand, juts assumes it does. Therefore, it’s important to code this check in yourself.

Funny thing how functions sometimes return values that nobody uses, and they should. Take the last line out of ScottManDeath’s code above and append the following:

// derived from NeHe code
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
MessageBox(HWND_DESKTOP, “Mode switch failed.
Running in windowed mode.”, “Error”, MB_OK | MB_ICONEXCLAMATION);
}

…or something similar, and it’ll prevent your program from going 1600x1200x32 on my monitor, which doesn’t support it.

What happens if you call ChangeDisplaySettings like that and dmScreenSettings has unsupported values?

From the ChangeDisplaySettings documentation at msdn:

Remarks

To ensure that the DEVMODE structure passed to ChangeDisplaySettings is valid and contains only values supported by the display driver, use the DEVMODE returned by the EnumDisplaySettings function.

The msdn documentation sucks but I found this about DEVMODE:
When you call the EnumDisplaySettings function, the dmDisplayFrequency member may return with the value 0 or 1. These values represent the display hardware’s default refresh rate. This default rate is typically set by switches on a display card or computer motherboard, or by a configuration program that does not use display functions such as ChangeDisplaySettings.

I guess that means that 0 or 1 can not be used to represent the default refresh rate in calls to ChangeDisplaySettings? Is this really the same for all Windows versions? I belive that the msdn gdi documentation is not complete about those functions.
Here is a starting point if anybody wants to search http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_7gz7.as