same opengl code runs 1/3 slower on windows 7

I have 2 identical computers with nvidia geforce 7600 gs video cards. One runs windows7 and the other one is running Ubuntu linux 9.10. I’m testing an opengl program on both. As far as I
can tell the opengl code is the same for both operating systems. On linux I can get 247 frames per second if I let the program free-run. The windows 7 version will only run at 79 frames per second. The display monitor goes through a KVM switch and is 1920 x 1080.

Can someone suggest a reason for this or how I can locate the problem. I could post the GLIntercept dump of the opengl initializaion calls. I don’t know if this matters, but I’m using the orthoganal mode.

nvidia geforce 7600 gs
win7: 79 FPS
linux: 247 FPS

thanks,
William

Lack of proper OpenGL drivers on the Windows 7?

Is the same monitor and resolution used for both machines?
The app code can not be the same since one uses linus and the other is Windows…so is the application using the same GL extensions? (vertex arrays, texture formats, FBO formats, etc)

Also, is the windows implementation using vertical refesh sync (Vsync)?

Lastly, since the code between the two must be different by definition, perhaps the mechanusim to record fps is different too - have you determined exactly how you arrive at this figure? for both cases ?

  1. Check that under Windows V-Sync is off. 79 FPS sounds very much like a limit to 80 Hz.

  2. As long as you get more than 60 FPS you can’t really tell much about it. At high refresh-rates there will be very big speed-differences on different PCs, OSes, GPUs due to various reasons.
    For example drivers often cache commands for several frames. But when they have cached 3 frames in advance, they usually block, because it makes no sense to continue. On linux this might not be the case (or the setting might be set higher) so you get much more FPS there, due to no artificial throttling.

When you do enough processing, so that you get <60 FPS on the faster PC, THEN we can start comparing the differences properly.

Jan.

Device manager says the drive is “working properly”: Microsoft WDDM driver. I can’t find any place that I can turn off vertical sync. How can I tell if that is the problem or adjust that?

It’s the same monitor on both systems (using a KVM switch). The generic opengl code is the same. It IS different up to that point, WGL functions etc for windows.
I’m not using any opengl extensions, just opengl32 and glu32.

This is a test program. The real program was getting 5 FPS on windows, doing more processing, while the linux one was something like 120 FPS if I recall, so I was looking into differences in simpler code between windows and linux.

William

Make sure you have downloaded the latest drivers from nvidia’s web site.

Go into nvidia control panel -> ‘manage 3d settings’ -> vertical sync. Make sure it’s set to ‘force off’.

To turn off V-Sync:

Right-click on the desktop -> nVidia Control Panel -> Manage 3D Settings -> V-Sync -> Force OFF.

5 FPS vs 120 FPS sounds more like software-rendering vs. hardware. You might be doing something that the windows-driver doesn’t like. Check your window-setup code, that you request a common framebuffer format.

Jan.

Make sure, you use double buffering on Win7. Don’t try to draw to the front buffer. More info here:

http://www.opengl.org/pipeline/article/vol003_7/

That’s the problem: I can’t find nvidia control panel anywhere. It’s not there if I right-click on the desktop. Do I need a different driver, or to install nvidia control panel?

I’m using double buffering. Here’s the windows initialization (simplified):

hinstance = GetModuleHandle(NULL);

windowrect.left = (long)0;
windowrect.right = (long)width;
windowrect.top = (long)0;
windowrect.bottom = (long)height;

WNDCLASS wc = {
CS_HREDRAW | CS_VREDRAW,
WndProc,
0,
0,
hinstance,
NULL,
LoadCursor(NULL, IDC_ARROW),
(HBRUSH)GetStockObject(BLACK_BRUSH),
NULL,
“classname”
};

gbrush = CreateSolidBrush(OGLBGCOLOR);
wc.hbrBackground = gbrush;

RegisterClass(&wc);

dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;

AdjustWindowRectEx(&windowrect, dwStyle, FALSE, dwExStyle);

hwnd = CreateWindowEx(
dwExStyle,
OGLCLASS,
title,
dwStyle,
x, y,
windowrect.right-windowrect.left,
windowrect.bottom-windowrect.top,
NULL,
0L,
hinstance,
0L);

SetWindowLong (hwnd, GWL_USERDATA, (long)this);

hdc = GetDC(hwnd);
planes = GetDeviceCaps(hdc,PLANES); // 1
bits = GetDeviceCaps(hdc, BITSPIXEL); // 32

GetClientRect(hwnd, &clientrect);

pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = bits;
pfd.cRedBits = 0;
pfd.cRedShift = 0;
pfd.cGreenBits = 0;
pfd.cGreenShift = 0;
pfd.cBlueBits = 0;
pfd.cBlueShift = 0;
pfd.cAlphaBits = 0;
pfd.cAlphaShift = 0;
pfd.cAccumBits = 0;
pfd.cAccumRedBits = 0;
pfd.cAccumGreenBits = 0;
pfd.cAccumBlueBits = 0;
pfd.cAccumAlphaBits = 0;
pfd.cDepthBits = 16;
pfd.cStencilBits = 0;
pfd.cAuxBuffers = 0;
pfd.iLayerType = PFD_MAIN_PLANE;
pfd.bReserved = 0;
pfd.dwLayerMask = 0;
pfd.dwVisibleMask = 0;
pfd.dwDamageMask = 0;

PixelFormat=ChoosePixelFormat(hdc, &pfd);
SetPixelFormat(hdc, PixelFormat, &pfd);
hRC = wglCreateContext(hdc);
wglMakeCurrent(hdc, hRC);

William

Are you getting your drivers from nvidia? If not, do so - I’m not certain if the windows update provides the nv control panel or not - I can’t remember.

As mark ds said, you need download correct drivers from nvidia.com. Windows don’t install OpenGL drivers by default, so it’s likely that your program is passing through Microsoft’s OpenGL->Direct3D emulation layer (yes, that’s bad).

That was it. I’m now getting 245 FPS on windows 7. I thought that Microsoft would install the best driver. I guess I thought wrong.

thanks,
William

On Windows 7, the NVIDIA “in the box driver” is release 185.93. That is the driver you get with a new install of Win7. However, it is a driver with only core functionality. There is no control panel and no OpenGL ICD, for example. Thus yes, you do need to upgrade to a newer driver. Windows Update should have given you the option to do so.

Regards,
Barthold
(with my NVIDIA hat on)