Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


vertical retrace / tearing problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 nickm   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 November 2001 - 06:44 AM

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

Sponsor:

#2 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 19 November 2001 - 08:58 AM

this is an os specific issue under windows use the winswapinterval extension

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 20 November 2001 - 05:32 PM

Thats funny becasue SwapBuffers usualy swaps with the vertical retrace. Try checking the settings for your display drivers.

#4 nickm   Members   -  Reputation: 122

Like
Likes
Like

Posted 21 November 2001 - 06:38 AM

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

#5 zedzeek   Members   -  Reputation: 528

Like
Likes
Like

Posted 21 November 2001 - 08:08 AM

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)

#6 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 22 November 2001 - 01:49 AM

Remember to put a call to glFinish() when you''re done drawing a frame...

#7 nickm   Members   -  Reputation: 122

Like
Likes
Like

Posted 22 November 2001 - 06:21 AM

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.

#8 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 22 November 2001 - 06:42 AM

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.

#9 nickm   Members   -  Reputation: 122

Like
Likes
Like

Posted 23 November 2001 - 06:29 AM

Well, eeh, I wasn''t talking about the glut, but about the SwapBuffers from (windows/wgl?)...

#10 Fruny   Moderators   -  Reputation: 1653

Like
Likes
Like

Posted 23 November 2001 - 07:12 AM

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);
}





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS