I’m finding myself using object graphics over direct graphics more and more in my projects. My rule used to be to use direct graphics unless there was a compelling reason to use object graphics. This rule has now reversed itself, making object graphics the new default for me.

Here are the reasons which have lead to this:

  1. Visualization properties are persistent. So after you create a visualization, it is easy to change one property of your visualization and redraw. This is particularly nice in widget programs.
  2. Anti-aliased fonts.
  3. IDLgrBuffer beats the True Color deficient Z buffer, hands down.
  4. You want to make a 3D visualization with multiple items? In direct graphics, you can use the Z buffer to do hidden line removal, but then you are stuck in 8-bit color. Object graphics handles 3D graphics by default (of course, there are some minor snags with the interaction of rendering order and transparency, but nothings perfect).
  5. Slice through anything with the CLIP_PLANES keyword.
  6. Make anything transparent with the ALPHA_CHANNEL keyword.
  7. Volume rendering.
  8. It’s easier to create a visualization for one destination (like a graphics window) and then send it to another (like the printer or a Postscript file).
  9. No system variables!
  10. With the iTools using object graphics, in most situations you can create a quick visualization as fast as in direct graphics (or should I say, in as much typing). (See some of the advantages of direct graphics below for a situation you can’t do this.)
  11. Since the MAP_PROJ_* routines were introduced in IDL 5.6, it’s possible to do mapping in object graphics.
  12. With IDL 6.2 and a decent graphics card, displaying images is faster in object graphics.

Of course, there are some reasons still to use direct graphics.

  1. While debugging a program, if you’re stopped at a line in the source code and want to make a quick visualization of one of the local variables, your options are limited. “Quick visualization” doesn’t really fit with hand coding object graphics, nor are the iTools an option in this situation since the event handlers for the widget program will not work. So I use direct graphics.
  2. There are still some tricks with pixmaps in widget programs that I think look better in direct graphics.

Feel free to comment below on your own findings about object graphics versus direct graphics. Does anyone have another great reason to use direct graphics (besides the learning curve)?