   two questions
  hiIve two questions:1. Is it a bad idea to do something more then just calling drawing routines between Begin and End Scene, then why?2. I want to force my window dx app to run at a constant refresh rate (60hz)any ideas how to do that? What I want is that even if the refresh rate is set to something else, I dont want to change it, just wait so it turns out to 60fps.thanks   
Quote:Original post by ProblemBabyhiIve two questions:1. Is it a bad idea to do something more then just calling drawing routines between Begin and End Scene, then why?2. I want to force my window dx app to run at a constant refresh rate (60hz)any ideas how to do that? What I want is that even if the refresh rate is set to something else, I dont want to change it, just wait so it turns out to 60fps.thanks1) no, its the opposite. Its bad if you don't do other work in there...2) look at the time (use a high resolution timer) and delay if necessary;  The video card is in a lock between BeginScene and EndScene, which means it is just waiting for data.  The shorter amount of time it spends in this lock, the more time it has for processing that data.To always render at 60 FPS, you want to make sure that each frame takes at least 1000/60 milliseconds to run.  If the current frame took less time than that to process, just run a loop and wait until enough time has passed.Rockoon1:  Where do you get that information?From MSDN:IDirect3DDevice9::BeginScene should be called once before any rendering is performed, and IDirect3DDevice9::EndScene should be called once after all rendering for a frame has been submitted to the runtime. To enable maximal parallelism between the CPU and the graphics accelerator, it is advantageous to call IDirect3DDevice9::EndScene as far ahead of calling present as possible.In other words, give the video card time to process before calling Present, otherwise the program has to wait for it to catch up.  That time can be spent processing game code.   ;  1.) I'm not really sure; BeginScene() and EndScene() are meant to tell the device where rendering begins and ends, but I don't see anything wrong with performing non-rendering operations with Begin/EndScene(), and MSDN didn't turn up anything.  The best way to see would be to try it out yourself.2.) If you go to the Control Panel, select the DirectX icon (must be on Classic View), and click the DirectDraw tab, you'll see a drop-down box called Forced Refresh Rate where you can set your desired refresh rate (in Hz).  Since it is in the DirectDraw tab, I'm not sure if it just affects DirectDraw or if it effects DirectX as a whole.  This would only affect your computer, and I couldn't find anything on MSDN about programatically setting the refresh rate.  EDIT: And as JBourrie said, if you are just trying to run at 60 FPS, you could count out frames in miliseconds.  Look into the GetTickCount() function.   ;  thanks for the fast replies!   ;  1.Most drivers ignore BeginSecne/EndSecne but you should still call them. As you are already in your render loop you should reduce the creating of additional resource (buffers, textures, …) to the absolute minimum. 2.In Full screen mode you can force a fixed refresh rate during device creation as long as the card/display supports it. But it can overwrite from the user anyway. In windows mode you will always get the desktop refresh rate.  This makes it a bad praxis to require a fixed refresh rate. You should build your render function in this way that it can always show the current state of your world. Then update your world only 60 times per second. This will make the rendering independent from the update. 