My limited FPS : 60

2019-04-03 23:31发布

问题:

I have learn OpenGL programming for some time.And I found a very strange phenomenon : my FPS(Frame per Second) always stays about 60,no matter the program is very easy or a little complicated.Actually,my computer is bought last year and the performance is good.The graphics card is nVidia GTX570,CPU is I7.

So I make a experiment:run the same program on my computer and my friend's computer.This program implements shadow mapping:

The FPS in my computer is about 60. But when I run it in my friend's computer,The FPS is more than 400.

But my computer's performance is obvious better than his.Now I post our computer's parameter.

My computer:

tgt.init (Info)  GLEW version: 1.7.0
tgt.GpuCapabilities (Info)  OS version: Windows 7 (build 7600)
tgt.GpuCapabilities (Info)  OpenGL Version: 4.2.0
tgt.GpuCapabilities (Info)  OpenGL Renderer: GeForce GTX 570/PCIe/SSE2
tgt.GpuCapabilities (Info)  GPU Vendor: NVIDIA Corporation (NVIDIA)
tgt.GpuCapabilities (Info)  Texturing: yes, max size: 16384, 3D: yes, max 3D size: 2048
tgt.GpuCapabilities (Info)  Texture features: 32 units, NPOT, rectangles, compression, 16x anisotropic
tgt.GpuCapabilities (Info)  Framebuffer Objects: yes, max 8 color attachments
tgt.GpuCapabilities (Info)  Shaders: yes (OpenGL 2.0), GLSL Version 4.20, Shader Model 5.0
tgt.GpuCapabilitiesWindows (Info)  Graphics Driver Version: 8.17.12.9573
tgt.GpuCapabilitiesWindows (Info)  Graphics Driver Date: 2012-02-09
tgt.GpuCapabilitiesWindows (Info)  Graphics Memory Size: 1280 MB

My friend's computer:

 tgt.GpuCapabilities (Info)  OS version: Windows 7 Service Pack 1 (build 7601)
tgt.GpuCapabilities (Info)  OpenGL Version: 4.2.11566 Compatibility Profile Context
tgt.GpuCapabilities (Info)  OpenGL Renderer: AMD Radeon HD 6620G
tgt.GpuCapabilities (Info)  GPU Vendor: ATI Technologies Inc. (ATI)
tgt.GpuCapabilities (Info)  Texturing: yes, max size: 16384, 3D: yes, max 3D size: 8192
tgt.GpuCapabilities (Info)  Texture features: 16 units, NPOT, rectangles, compression, 16x anisotropic
tgt.GpuCapabilities (Info)  Framebuffer Objects: yes, max 8 color attachments
tgt.GpuCapabilities (Info)  Shaders: yes (OpenGL 2.0), GLSL Version 4.20, Shader Model 5.0
tgt.GpuCapabilitiesWindows (Info)  Graphics Driver Version: 6.14.10.11566
tgt.GpuCapabilitiesWindows (Info)  Graphics Driver Date: 2012-03-09
tgt.GpuCapabilitiesWindows (Info)  Graphics Memory Size: 512 MB

I am very curious and I cannot figure it out.Should I do some settings for the graphics card?Could some one tell me how to solve the problem?

回答1:

This is vsync at work. Your monitor runs at 60 Hz, so there's no point in rendering more frames. And by limiting the framerate in that way, there will be no tearing artifacts.

Probably there is a setting in your driver's control panel to enable or disable vsync forcefully, or to leave it up to the application.

If you use an OpenGL framework like GLUT or GLFW, that probably also has an option to explicitly request vsync, or to turn it off (which is useful for benchmarking). Not all drivers/settings will honour this, though.



回答2:

What @Thomas said, it's VSync.

You can disable it in your applicaton using:

  • GLFW: glfwSwapInterval(0); (0 = off, 1 = on)
  • SDL: SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0);
  • FreeGLUT: I'm not aware of this being possible, use your GPU settings as a fallback


回答3:

In the nVidia Control Panel:

The vertical sync setting is the one you care about. For benchmarks like this, you normally want it set to off.