I thought that maybe my train game should look a little better. I changed the timer callback to be fast enough that a 40 car train took 100% of one CPU to position and move. It looks nice and the rubber-banding when dragging the track laying took looks better at 60+FPS. I then started to experiment with anti-aliasing.

Anti-aliasing seems simple enough. I started with GDI+ and used the GDI+ line drawing feature to get anti-aliased lines. Why does the anti-aliasing algorithm run asymmetrically? Lines look great except when they are close to horizontal. Close to vertical is not bad at all but those near horizontal lines look like crap. From the documentation, it looks like the GDI+ code is using asymmetrical pixel evaluations and the symmetrical option to use an 8×8 pixel box is not available.

I would have loved it if there had been a lower quality anti-alias option that still did anti-aliasing.

Oh, and the lines in GDI+ look wider and darker when they are anti-aliased. I’m guessing that the algorithm and coding for it is just not top notch or the decision was made to use the easiest or quickest algorithm available.

I opted to not use the GDI+ line drawing feature.

What about using a 2x render image? This is easy to accomplish because I already draw to an off screen bitmap and then bitblt that to the window client area. I tried it and using stretchblt() to then shrink it down is just slow. My 60 FPS got down to about 12 FPS. It looked fair but not great.

I finally tried using GDI+ and the DrawImage feature to do the shrinking instead of stretchblt. That looked much better and I would have loved it if it was at all fast. It wasn’t fast at all at 17 FPS. Better than the stretchblt of GDI- but not good enough and not worth the trouble.

I didn’t try it and just though of it but maybe I can do all of my drawing into a bitmap and then use directx to render it in the window. The graphics accelerator card can shrink an image insanely fast and should look just as good as any other method. I just don’t know if it is possible.

Another option is OpenGL. I think I could get the glut library and have it working in minutes. Maybe not minutes but one hour to replace all of the drawing code would not be out-of-line. The drawing code is all in a single module in a C++ class, with the exception of one special function.

In the end, GDI is fine and renders quickly enough for the demonstration game. There is no 3D and the graphics are not meant to be fun looking, just usable to test other features.