当前位置: 动力学知识库 > 问答 > 编程问答 >

Stuck at 30 fps when using two viewports with GLFW in OpenGL

问题描述:

vsync is switched on and off with glfwSwapInterval(1) or glfwSwapInterval(0)

single viewport is glClear --> glViewport(0, 0, win_w,win_h) --> drawscene() --> glfwSwapBuffers in the rendering loop

double viewport is glClear --> glViewport(0, 0, win_w/2,win_h) --> drawscene() --> glViewport(win_w/2, 0, win_w/2,win_h) --> drawscene() -->glfwSwapBuffers in the rendering loop

My scene single viewport with no vsync --> 140 fps

My scene double viewport with no vsync --> 70 fps (as expected since it is drawing the same scene twice)

My scene single viewport with vsync --> 60 fps (as expected because my monitor refresh rate is 60Hz)

My scene double viewport with vsync --> 30 fps (??? I am expecting 60 fps here because it is achieving 70 > 60 fps without vsync, is there any extra GLFW function that I have to call?)

网友答案:

Maybe the problem is that you put glFinish or the swap buffer command at the end of each rendering call. This imply that the rendering engine will stop until all drawing commands are performed. It may explain way you're going so slow.

I think you must put only one at the end of the two rendering call.

分享给朋友:
您可能感兴趣的文章:
随机阅读: