Getting Good Results


It is possible that the movement of the ball is too slow or too jerky. There are a couple of reasons for this. First, your computer may be old and slow. If that's the case, you'll need to upgrade as soon as you can afford it. A game programmer should have a computer whose microprocessor runs no slower than 500 MHz (500 megahertz). Even that's on the slow side. In reality you should be using a computer that runs no slower that 1 GHz (1 gigahertz, which is 1000 megahertz).

The simple bouncing ball program shown in Listing 4.3 can run slow or jerky even if you have a fast computer. It might be that your graphics card (also called a video adapter) is old and slow. If you bought your graphics card more than 4 years ago, it's time to replace it.

It is possible that the program runs slow on your very fast computer with an excellent graphics card. That's because your screen might be in a very high resolution video mode. For example, my screen is set to 1280 pixels across by 1024 pixels vertically. That's a lot of pixels.

Having your display set to a high-resolution mode usually means that its refresh rate is set to 60 Hz (hertz). That means that the electron gun in your screen refreshes the screen 60 times every second. This is actually a slow refresh rate. If your screen is set to 60 Hz, it limits the number of frames that OpenGL can display on the screen each second. Usually it means that you're getting fewer than 30 frames of animation per second. To get smooth, quick animation, you need a frame rate of 30 frames per second or higher. Your program does that by setting the screen into a lower resolution mode with a higher refresh rate than 60 Hz. I'll demonstrate how to do that with LlamaWorks2D in chapter 7, "Game Program Structure."

If your game does not specify a video mode and refresh rate, LlamaWorks2D just uses the current mode and refresh rate. This is not generally a good idea because you cannot guarantee that the game looks right and has a proper frame rate on all computers.



Creating Games in C++(c) A Step-by-Step Guide
Creating Games in C++: A Step-by-Step Guide
ISBN: 0735714347
EAN: 2147483647
Year: N/A
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net