vertical retrace / tearing problem
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
Thats funny becasue SwapBuffers usualy swaps with the vertical retrace. Try checking the settings for your display drivers.
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
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
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)
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.
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.
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.
Well, eeh, I wasn''t talking about the glut, but about the SwapBuffers from (windows/wgl?)...
glutSwapBuffers() calls SwapBuffers()
in glutint.h:
in glut_swap.c
in glutint.h:
#ifdef _WIN32..#define SWAP_BUFFERS_LAYER(window) \ SwapBuffers(window->renderDc)..#endif
in glut_swap.c
void APIENTRYglutSwapBuffers(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);}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement