View Full Version : Flickering With Glut
02-01-2008, 03:31 AM
I am pretty new to OpenGl, so I am using glut, but with user input the problem is that the image begins to flicker, I think it is because of glutPostRedisplay(); in my glutKeyboardFunc but I'm not sure, is there any way to prevent this?
02-01-2008, 04:15 AM
You can try enabling vsync in your graphics card control center.
02-01-2008, 10:23 AM
I think it is because of glutPostRedisplay(); in my glutKeyboardFunc but I'm not sure, is there any way to prevent this?
You really put glutPostRedisplay() in the glutKeyboardFunc ?
What OS are you working on?
02-01-2008, 12:48 PM
Windows. Should that really make a difference? And should glutPostRedisplay not be in the KeyboardFunc? The problem is that if I remove it, it doesn't show the changes that need to be made.
02-01-2008, 01:11 PM
In the usual case you put glutPostRedisplay() at the end of the function you pass to glutDisplayFunc().
02-01-2008, 01:25 PM
Well, I just tried that, and it constantly flickers, I'm still not sure why. Sorry.
02-01-2008, 01:47 PM
I found out a simple fix for my problem, all I had to do was add GLUT_DOUBLE to the display mode. Thanks all. :D
02-02-2008, 12:53 AM
Haha, nice spot, I forgot about this.
Yes front buffer rendering brings the grand mother of all tearing :D
12-07-2009, 07:34 AM
I know it's an old post, so sorry for bringing it up again, but I am having the same problem when porting my GLUT application from Mac to Windows.
As I had earlier passed GLUT_SINGLE to glutInitDisplayMode (I am not sure what it did or why I had it there) I replaced this parameter with GLUT_DOUBLE. But instead of a flickering window I now get an empty window :( In fact, I can see right through the window, so it's not just empty, its hollow... Any ideas on what to look for in the code to make this work?
If it matters, note that I am passing the following function to glutTimerFunc in order to be able to control the frame-rate:
void TimerFunc(int extra)
glutTimerFunc(1000 / fps, TimerFunc, 0);
12-07-2009, 07:56 AM
Probably just missing a glutSwapBuffers(); call right at the end of your display function.
12-08-2009, 12:03 AM
Yes, I was missing that.. thanks!
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.