Jump to content
  • Advertisement
Sign in to follow this  
pseudomarvin

OpenGL Screen tearing when using OpenGL on Windows

This topic is 916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am encountering a screen tear issue using OpenGL and WinApi. I am doing a ray marching demo (rendering just 2 triangles and ray marching and shading terrain in fragment shader). Rendering with GTX 860M, the app does not have an issue with staying at 60 FPS (at least at lower resolution). A screen tearing is present however (and this was rendered at especially low resolution to make sure this has nothing to do with the complexity of the fragment shader code):

 

 

Where I am at:

 

I am creating the OpenGL context using the recommended settings (https://www.opengl.org/wiki/Creating_an_OpenGL_Context_%28WGL%29). 

I have tried manually turning VSync on using (wglSwapIntervalEXT(1)), although that should be the default behavior.

I have tried placing glFinish before the SwapBuffers call, i.e.:

while (isRunning)
{
	ProcessMessages(window, &context);
        App::Update(&context);
	glFinish();
	SwapBuffers(windowHandle);
}

I have tried setting VSync to "Always on" in the Nvidia control panel. I have also tried setting Maximum pre-rendered frames to 1.

 

 

None of these things have helped. Does anyone have any ideas? I have also tried running the app on a friend's PC (GTX 960) and the tearing was present there as well. Thanks.

Share this post


Link to post
Share on other sites
Advertisement

VSync is often unreliable in windowed mode. If you create a window filling the entire screen with its client area and nothing obscuring it (WS_POPUP / WS_EX_TOPMOST) the Nvidia driver should switch to exclusive fullscreen mode.

For perfect VSync you actually want pre-rendered frames, so it should not be set to 1, that would break VSync if even a single frame happened to lag behind because of some background process or similar that is out of application control

Share this post


Link to post
Share on other sites

Thank you for the suggestion. I have tried rendering to a full screen window using the styles you have specified with WinApi. I also tried rendering to a full screen window created by GLFW. The tearing persisted in both cases. I tried setting the pre-rendered frames to maximum but that did not help either.

Share this post


Link to post
Share on other sites

If this is a win7 system...Do you have aero on?

 

I need to use aero-theme in win7 to get VSync to work.

 

Without aero, my app tears even when VSync is set manually, or through the driver control panel.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!