• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Waiting for the verticle blank?

## Recommended Posts

Kaijin    163
Is it actually worth waiting for the verticle blank before drawing to the screen? i.e. directDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); Because it imposes a restriction of 70 FPS max on the frame rate as it has to wait for each verticle blank (1/70 of a second). This actually makes my program look choppier rather than smoother like it''s supposed to. - Kaijin

##### Share on other sites
JonStelly    127
If you''re rendering at a high enough framerate, there''s not much need to wait. What may make your game appear more choppy is if your game loop takes more than 1/70 of a second sometimes. In that case, you could have some refreshes that you don''t update and it could cause that.

##### Share on other sites
Guest Anonymous Poster
Why draw unseen frames? If you want to update your physics, etc more frequently you may, but I don''t understand the need for more frequent screen updates.

##### Share on other sites
TheFez    151
first off, why not just flip using the wait flag instead of waiting for the vertical blank and then flipping (less code, same effect). Your probably missing the vertical blank and thats why its choppy. But as far as why do you wait, well if you don''t wait then sometimes it will not draw it correctly. It will start drawing where ever the vertical line is, causing some strange results. What you can do is try triple buffering or using the buffered version of flip (no idea what its actually called as I''ve always been happy with an FPS of 70. But it will flip when it can allowing you to go on, but watch out for buffer overflow).

##### Share on other sites
Kaijin    163
quote:
Original post by TheFez
first off, why not just flip using the wait flag instead of waiting for the vertical blank and then flipping (less code, same effect).

Yeah, I thought that was the case from looking at the DirectX docs. But from looking at André LaMothe''s code in Tricks he uses the DDFLIP_WAIT flag in his flip function, but he also was a wait for verticle blank function too, so I was a little confused.

I was only asking because I''m writing a game engine and the frame rate became choppy when I tried to set the frame rate above 70 FPS. 2 or more logic loops were being called for every graphics loop. And when I took out the wait it was fine.

But I think I''ll leave it in as it''s unlikely the user will need a frame rate above 70 FPS, right?

- Kaijin

##### Share on other sites
Guest Anonymous Poster
That''s André for you. I''ve never been a big fan of his code myself.