Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nickm

vertical retrace / tearing problem

This topic is 6171 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

Hi, Does anyone have an idea to synchronize an opengl application with the vertical retrace of the moniter? I am currently using this code: RenderObjects(); SwapBuffers(hDC); But with this code, I get a framerate that is usually above 100, and because this is not the refreshing frequency of my monitor, "tearing" occurs sometimes. Is there a way to solve this problem in openGL (using ms windows)? Thanks, Nick

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Thats funny becasue SwapBuffers usualy swaps with the vertical retrace. Try checking the settings for your display drivers.

Share this post


Link to post
Share on other sites
zedzeek, I''ll try to get some information about that extension, I haven''t heard of it before.

And ap, I don''t think SwapBuffers swaps with the vretrace, because then I should get a framerate that is max. 60 or 70 (the monitor refresh frequency). And I am getting even a 200 fps framerate, and I''m pretty sure I don''t have a 200hz monitor

Share this post


Link to post
Share on other sites
nickm i sent u an email with an example, also as its only a hint so perhaps/perhaps not itll be implemented. + the user is free to override in the control settings (if the driver enables this)

Share this post


Link to post
Share on other sites
Thank you for this example zedzeek! Really nice, I haven''t applied it in my code it yet, but the code looks good . Thanks again! And fruny, I don''t know if glFinish() should always be used; actually, I thought it was sort of built in the SwapBuffers function.

Share this post


Link to post
Share on other sites
No, it''s not.

glFinish() is used to wait until all the GL commands are done executing by the graphics card. If you swap the buffers with glutSwapBuffers() before all the commands are done... hop, instant tearing problem.

Always remember that GLUT isn''t part of OpenGL. All it does is handle the OS interface for you.

Share this post


Link to post
Share on other sites
glutSwapBuffers() calls SwapBuffers()

in glutint.h:
  
#ifdef _WIN32
.
.
#define SWAP_BUFFERS_LAYER(window) \
SwapBuffers(window->renderDc)
.
.
#endif

in glut_swap.c

  
void APIENTRY
glutSwapBuffers(void)
{
GLUTwindow *window = __glutCurrentWindow;

if (window->renderWin == window->win) {
if (__glutCurrentWindow->treatAsSingle) {
return;
}
} else {
if (__glutCurrentWindow->overlay->treatAsSingle) {
return;
}
}

window->usedSwapBuffers = 1;

SWAP_BUFFERS_LAYER(__glutCurrentWindow);
}

Share this post


Link to post
Share on other sites

  • 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!