Sign in to follow this  
The C modest god

I am stunned by slow FPS

Recommended Posts

How big are the images? Are they stored in video memory? How are you creating the surface?

30 fps seems a bit slow for 4 images, even if they're screen-sized, but remember that your screen is 1 million pixels, and a typical graphics card fillrate is about 1 billion pixels/sec, so drawing a large image isn't exactly free.

Share this post


Link to post
Share on other sites
Even if I dont do the drawing to the direct draw surface but only do this:

pPointer = pSourceX->pElements.CreateLinkedListPointer ();
Color=Render.GetTriangleColor (
(this->pTrianglesList->operator [] (pPointer.Peek().TriangleNum)), Point2D ((Real)KeepPosX+0.5, (Real)(LineY+StartY)+0.5)
);
PixelsAmount = pPointer.Peek().PixelsAmount;
pPointer.Step();


RGBColor
RenderRedSimple::GetTriangleColor (Mesh3DCalcTriangle & Triangle, Point2D Pos)
{
RGBColor color;

color.Red = (BYTE)(Triangle.Vz*(double)0xff);
color.Green = 0;
color.Blue = 0;

return color;
}

4*80*135 times I get an FPS of 50.
I am suprised that this is the limitation of the cpu.
I thought it could do a lot more calculations

Share this post


Link to post
Share on other sites
Don't blame the CPU for your mistakes.
Each time you're accessing the videomemory you're locking it up for everything else. The proper way of doing what you're doing is to lock the entire surface, and treat it as an array or a matrix while doing all the reading/writing to it in one go. Not locking/unlocking it for every pixel as you're doing.
And what's this linked-list business? What good is it supposed to do?

Share this post


Link to post
Share on other sites
You should only lock the surfaces once per frame, nothing more, nothing less.
You also need to make sure your surfaces are in video memory. Then you should see a bit more than 30 FPS.

Share this post


Link to post
Share on other sites
Quote:
Original post by Bad Maniac
You should only lock the surfaces once per frame, nothing more, nothing less.
You also need to make sure your surfaces are in video memory. Then you should see a bit more than 30 FPS.

Second.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this