avoid flickering

Started by
3 comments, last by mike4 12 years, 5 months ago
Hi
i draw random drops on a window but how to avoid flickering?
Thanks
Michael
Advertisement
Look up double buffering
i only found examples using glut. but I don't want to use glut for some reasons.
currently I do:

glFlush();
display(); //draws the drops
void SDL_GL_SwapBuffers(void);

but still the same flickering. That's a shared lib (plugin for another app)
Any help? Many thanks
Michael
what kind of flickering?
I do alike below to draw rain drops in the display function:

if (temperatureC >= 0){
if (speedP >= 0.05){
glPushMatrix();
if (initT1 == 0){
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
XPLMBindTexture2d(gTexture[4], 0);
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
}
// void SDL_GL_SwapBuffers(void);
glBegin(GL_QUADS);
glTexCoord2f(1, 1.0f); glVertex2f(X4achse[a]+15, Y4achse[a]-30); // Bottom Right Of The Texture and Quad
glTexCoord2f(0, 1.0f); glVertex2f(X4achse[a], Y4achse[a]-30); // Bottom Left Of The Texture and Quad
glTexCoord2f(0, 0.0f); glVertex2f(X4achse[a], Y4achse[a]); // Top Left Of The Texture and Quad
glTexCoord2f(1, 0.0f); glVertex2f(X4achse[a]+15, Y4achse[a]); // Top Right Of The Texture and Quad
glEnd();
initT1 = 1;
glPopMatrix();
X4achse[a] -= 0.5;
}else{
...

so drops get replaced slightly at each loop. ok but the drops seem to get invisible slightly before the new are drawn. ->flickering but i want them to fade out (best) after
drawn the new positions.
Many thanks

This topic is closed to new replies.

Advertisement