Why do i got flickering?
November 18, 1999 12:36 AM
Yo might want to explain a little more about your setup cause there could be a number of things creating this
Hard to say without seeing the code. I recently created a double buffer that used a Window's HDC to print text on the screen. Every time I called "Flip" I could see a bad flicker. I changed the DC to the DirectDraw
GetDC and the flicker went away!
GetDC and the flicker went away!
------------------
Still Learning...
Still Learning...
Flickering is usually caused by not using double buffering.
------------------
Dance with me......
I'm using double buffer. I made a simple directdraw class to handle that stuff. Front buffer and back buffering. The only thing I do in the main of my program is drawing the map and move it. I move it just to check to make sure it clips right. The main is this:
ddGame.SetDrawSurface(DDSBACK);
dmMap.DrawMap(ddGame.lpddsBack, 0);
ddGame.SetDrawSurface(DDSPRIMARY);
ddGame.WaitForVSync();
ddGame.Flip(DDSBACK);
dmMap.vTopLeft.X -= inc;
dmMap.vTopLeft.Y -= inc;
if (counter++ == 80) {
inc = -inc;
counter = 0;
}
ddGame is my direcrt draw class, dmMap is my map.
Using VC++ 6.0, Direct 7.0
I think your problem is how you're setting what the program draws to. When using the Flip() function, you never need to draw to the primary surface. You draw to the backbuffer, and then flip, and the pointers to the primary and backbuffer are automatically switched. So the next frame you just draw to the backbuffer again, and flip from either of them, and repeat...
Jonathan
Ok this is probly simple but i can't figure it out. I'm not tackling 3d yet, just working on an isometrics game. I got a map that draws but I'm getting flickering. I use Direct Draw's WaitForVSync but I still notice it. What could cause this?
~ Thanx in advance
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement