ID3DXSprite question

Started by
1 comment, last by ArthY303 14 years, 9 months ago
Hello ... I'm using ID3DXSprite to draw all my textures/sprites.I know that this is not the best method but I'll stick with it for now. So without drawing anything on the screen I get ~1200 FPS.When I draw a 1024x768 texture the FPS falls at around 600 FPS.Is this behaviour normal or am I doing something wrong ? Another thing : If I draw the same texture twice the FPS I get is around 180. However , I if draw the texture three or four times the FPS rises at about 250. Can someone explain to me how can this be ? I have also tried rendering small textures and drawing a 64 by 64 texture 2500 times I get at 300 FPS.Is this good ? With 10000 32x32 textures I get at 60 FPS. Thanks in advance...
Advertisement
Quote:Original post by ArthY303
Hello ... I'm using ID3DXSprite to draw all my textures/sprites.I know that this is not the best method but I'll stick with it for now.

So without drawing anything on the screen I get ~1200 FPS.When I draw a 1024x768 texture the FPS falls at around 600 FPS.Is this behaviour normal or am I doing something wrong ?
Nope, that's normal - FPS isn't a good scale. You're going from 0.0008 seconds per frame to 0.0017, which is a difference of under a millisecond.

Quote:Original post by ArthY303
Another thing : If I draw the same texture twice the FPS I get is around 180.
However , I if draw the texture three or four times the FPS rises at about 250.
Can someone explain to me how can this be ?
Nope - although at those sort of frame rates it's impossible to measure anything accurately. How are you measuring frame rate?

Quote:Original post by ArthY303
I have also tried rendering small textures and drawing a 64 by 64 texture 2500 times I get at 300 FPS.Is this good ?
With 10000 32x32 textures I get at 60 FPS.
If you have fewer textures, then you can render in larger, less frequent batches - which is good for graphics cards. So you'll get a higher frame rate drawing the same number of pixels with less texture switches.

How "Good" it is is totally subjective. ID3DXSprite is pretty well optimised - it's possible to out-perform it, but not by much. It's important to remember that it's primarily there for convenience rather than performance.
Thanks for the quick response.

// update the current time
QueryPerformanceCounter(&currentTime);

// calculate the fps and the animation rate
animRate = (double)(currentTime.QuadPart - prevTime.QuadPart) /frequency.QuadPart;

fps = (int)((double)frequency.QuadPart / (currentTime.QuadPart - prevTime.QuadPart));

// update the previous time
prevTime.QuadPart = currentTime.QuadPart;

This code is in the update method of my game timer class.

This topic is closed to new replies.

Advertisement