Jump to content
  • Advertisement
Sign in to follow this  
the_golden_gunman

DirectX : Is running at 60FPS possible?

This topic is 4845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on my own game and am using the DirectX libraries to create it. Currently I can only get the game to run at 30 FPS, and I intened for my game to run at twice this speed, 60FPS. Someone told me that DirectX can only support up to 30FPS. Is this true, and if so, is there any way to make the game run at 60 FPS using DirectX?

Share this post


Link to post
Share on other sites
Advertisement
Yes, it is. Only thing limiting fps is hardware, if you're not locking framerate on purpose or have vsync turned on in display driver settings.

Share this post


Link to post
Share on other sites
It really depends on the complexity of your code and your hardware. My current project (which is basically a starfield and around 100 textured boxes) easily runs over 200 FPS on my PC (A64 @ 2.55 GHz, 6600gt, 1GB RAM). However, on my old PC (P3 500, 9200SE, 128MB RAM), it struggles to stay over 100.

Did you enable vsync? How did you do it? What is your code doing so far? What kind of harware do you have? Have you tried it on any other computers?

Share this post


Link to post
Share on other sites
Quote:
Original post by the_golden_gunman
Someone told me that DirectX can only support up to 30FPS.


Its not true. DX can run at any FPS. Maybe your hardware is not powerful enough to run the examples.

All is in the hardware. If you render 1000 tris in a Geforce7800 then you will get 1000 FPS. But render those in a Geforce5200 and you get 200FPS. Add reflections, refractions, shadows, ripples for water and you get 60FPS.

Just remember, FPS depends on many factors. I'd recommend you first program your game and get into Alpha. Then debug and get it to Beta, you start optimizing only after that.

Luck!
Guimo


Share this post


Link to post
Share on other sites
Thanks for the replies, but actually this is a much simpler question and I am still stuck on this. I have a Win32 applcaition to be created using DirectX, and I would like to know where I have to tell DirectX what frame rate I wish to be used for rendering when calling DXUTimeToRender() . My code looks as follows:

// Main:
int APIENTRY WinMain(HINSTANCE hinstance,
HINSTANCE hPreInstance,
LPSTR lpCmdLine,int nCmdShow)
{

int inc=10,i=255,alpha=255;
static int isright=0,first=1,level=1;
double scalex=1.0,scaley=1.0;

// Load the Direct3D COM and Build the current systems device list:
if ( !DXULoadDirectXGraphics() )
{
DXUDisplayLastError();
return -1;
}

// Create a WIN32 window: add +6 and + 26 to account for window borders
if(!DXUCreateWindow(hinstance,0,0,800,650))
{
DXUDisplayLastError();
return -1;
}
// Initialise Windowed Graphics:
// Note: Default Full Screen Mode is ( 640x480x16 )
if (!DXUInitGraphics())
{
DXUDisplayLastError();
return -1;
}

I thought that when I create a window, I would pass a parameter to it to tell the window what it's refresh or frames per second speed should be. Is it possible to do this, and how do I do this?

Share this post


Link to post
Share on other sites
What is DXUTimeToRender? I can't find any mention of it on Google, so it's not really possible to advise you on its use. If this is some wrapper that has been supplied for you, then presumably it comes with documentation, or someone to ask.

Share this post


Link to post
Share on other sites
Sorry it's DXUIsTimeToRender(), and was given to me by my University Lecturer. You can find what we were given from a Goolge search I did which brought up this result:

http://www.cs.mdx.ac.uk/staffpages/peter/cmt3311/chapter3.pdf

Share this post


Link to post
Share on other sites
A quick search through that file would show you this: "DXUSDK uses the stability of 30 FPS and it can not be changed by any DXU application that wishes to
use on-time rendering, though 30 FPS is fairly enough for performance and stability."
So, you are limited by your DXUSDK.

Share this post


Link to post
Share on other sites
Thanks for that, I was aware of this, but was just wondering if it would be possible to switch this to 60FPS by altering the tick count with a method such as SetTimeToRender(), or something similar. Unfortunately nothing like this exists. Could you perhaps reccomend anywhere that a novice with DirectX could read up on creating windows and setting frame rates. Thanks for all your help anyway.

Share this post


Link to post
Share on other sites
DirectX itself doesn't have any concept of frame time. The library you're using is imposing this itself, presumably using some sort of timer. Therefore if your library doesn't offer you a way of changing this, you can't (practically) do it without dropping the use of that library.

If you want basic information on creating your own DirectX window, there are lots of tutorials around, which Google will help you find. There may be some on this site too in the Articles section, such as this article, but I don't know DirectX well enough to judge its quality or relevance.

As for setting the frame rate yourself, the easiest way is to note the precise time at the start of a frame, do the rendering, check the time again to see how long your rendering took, then pause the game (using a call such as Sleep() ) for the remainder of your frame's timeslot. Others may advise you to not limit the frame rate, often for good reason, but in your case a limited framerate would be fine and the alternative would be overly complex.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!