01-09-2001, 07:05 AM
Hello and Happy New Year to everybody.
The following is about a project I have been working on for a while. It's a training simulation for teaching new drivers the road signs and generally how to behave while driving. Its an application that uses 3 windows : the first window with dimensions 550x640 (not really visible) is the frame for the other two. In the second window the 3D world is rendered and in the 3rd window the 2D controls for the driver are displayed. The 3D world consists of 4 building blocks, roads, some road signs and traffic lights. Most of the textures used in this program are of 256x256 resolution. The problem is this : the frame rate starts from 35 fps the momment the app is initialized and reaches 5 or even 2 fps after 4-5 minutes. At first I thought that the textures were too heavy but if this is the case why does the frame rate decline as the time goes by?
The rendering of the windows is done when there are no messages in the windows message queue to be processed.
Here is the main code snippet:
//if there are no messages in the message //queue
//Handle Car Physics
MoveVehicle();
HandleCollisions();
//Check about Collisions with another car
collided = CarCollision();
//if car is moving in the correct direction
if(ValidMoveDirection())
{
//check for road signs
if(!CheckControlAreas())
Penalty();
}
//send a WM_PAINT message to paint the 2nd //window (render the 3D world)
InvalidateRect(hViewWnd, NULL, FALSE);
//send a WM_PAINT message to paint the 3rd //window (render the 2D controls)
InvalidateRect(hOutWnd, NULL, FALSE);
All the above functions contain some fors (not nested and iterations < 20 ) but they are not costly.
Does anybody have any ideas about what is going wrong? And is there a way to keep the fps steady or at least above 10 ? Thank you very much in advance.
The following is about a project I have been working on for a while. It's a training simulation for teaching new drivers the road signs and generally how to behave while driving. Its an application that uses 3 windows : the first window with dimensions 550x640 (not really visible) is the frame for the other two. In the second window the 3D world is rendered and in the 3rd window the 2D controls for the driver are displayed. The 3D world consists of 4 building blocks, roads, some road signs and traffic lights. Most of the textures used in this program are of 256x256 resolution. The problem is this : the frame rate starts from 35 fps the momment the app is initialized and reaches 5 or even 2 fps after 4-5 minutes. At first I thought that the textures were too heavy but if this is the case why does the frame rate decline as the time goes by?
The rendering of the windows is done when there are no messages in the windows message queue to be processed.
Here is the main code snippet:
//if there are no messages in the message //queue
//Handle Car Physics
MoveVehicle();
HandleCollisions();
//Check about Collisions with another car
collided = CarCollision();
//if car is moving in the correct direction
if(ValidMoveDirection())
{
//check for road signs
if(!CheckControlAreas())
Penalty();
}
//send a WM_PAINT message to paint the 2nd //window (render the 3D world)
InvalidateRect(hViewWnd, NULL, FALSE);
//send a WM_PAINT message to paint the 3rd //window (render the 2D controls)
InvalidateRect(hOutWnd, NULL, FALSE);
All the above functions contain some fors (not nested and iterations < 20 ) but they are not costly.
Does anybody have any ideas about what is going wrong? And is there a way to keep the fps steady or at least above 10 ? Thank you very much in advance.