Frame rate/render rate question

F202116ecad31295cfd0be942f8db475
0
kop48 101 May 08, 2005 at 06:43

Hi,

I just found this forum while googling for DirectX information, so hi to all. :)

ok I have to do a project at uni and I though I’d post here instead of the beginner’s area (because I AM a beginner at DX :)). Basically, I’m implementing this project:

http://www.itee.uq.edu.au/\~engg3800/tp2product-1-05.htm
Basically, I’m using DirectX because we need to guarantee a certain rate of drawing and I don’t think I can rely on Windows standard forms to do that for me. I need to flash the screen to a certain colour once per refresh rate. However, I don’t think that Present(…) actually blocks until the refresh time has come. Since I’ve never used it before, someone could say for me to try it, but it’s a little hard to see the screen changing colour at 75hz and be able to tell. :)

Therefore, I’m wondering if anyone would be able to help me on this matter. Right now, my idea is to simply change the clear colour and present nothing rendered. I need to make sure that I only change this colour once per refresh rate, so timers are out of the question as they do not have high enough resolutions. Any idea would be very welcome.

Cheers,

kop48

7 Replies

Please log in or register to post a reply.

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 May 08, 2005 at 07:18

Set the presentation interval to “one” when you fill in the d3d presentation parameters structure. one tells d3d to only update the screen at the speed of the refresh rate.

F202116ecad31295cfd0be942f8db475
0
kop48 101 May 08, 2005 at 10:12

@bladder

Set the presentation interval to “one” when you fill in the d3d presentation parameters structure. one tells d3d to only update the screen at the speed of the refresh rate. [snapback]17503[/snapback]

Yup - I’d read that one, but does that mean DX also only allows you to draw to the back buffer once per screen refresh - effectively making Present a blocking call?

22b3033832c5c699c856814b0cf80cb1
0
bladder 101 May 09, 2005 at 00:25

yes something like that. The different valuies represent how many times the backbuffer becomes the frontbuffer. INTERVAL_ONE means once per refresh. TWO means once every two refreshes. and IMMEDIATE means as fast as possible.

F202116ecad31295cfd0be942f8db475
0
kop48 101 May 09, 2005 at 00:32

@bladder

yes something like that. The different valuies represent how many times the backbuffer becomes the frontbuffer. INTERVAL_ONE means once per refresh. TWO means once every two refreshes. and IMMEDIATE means as fast as possible. [snapback]17529[/snapback]

ok, cheers mate, I’ll give it a go. :)

F202116ecad31295cfd0be942f8db475
0
kop48 101 May 09, 2005 at 01:06

@kop48

@bladder

yes something like that. The different valuies represent how many times the backbuffer becomes the frontbuffer. INTERVAL_ONE means once per refresh. TWO means once every two refreshes. and IMMEDIATE means as fast as possible. [snapback]17529[/snapback]

ok, cheers mate, I’ll give it a go. :)

[snapback]17531[/snapback]

Alright, looks like it works, but it seems to miss one frame every 30ish or so. I’m not sure why but I’m guessing it’s because of another process using the processor for a second. I’ll have to look into completely minimising my program so that it only does really essential stuff when rendering.

D6998c65ac60a12a00710cfa30c126b5
0
ravuya 101 May 13, 2005 at 15:28

If you’re not yielding your game to other processes on the machine, sometimes the Windows task scheduler can force it to pause for awhile to let other processes work.

F202116ecad31295cfd0be942f8db475
0
kop48 101 May 15, 2005 at 02:43

@ravuya

If you’re not yielding your game to other processes on the machine, sometimes the Windows task scheduler can force it to pause for awhile to let other processes work. [snapback]17624[/snapback]

Yup - we’ve taken that into consideration and have an error check at the end of the transmition. I could also check tick counts between frames, but it’s not really necessary. Seems to work great though! We’ve pretty much got 100% reliability! :)