i
i
i
i
i
i
i
i
12.2. Software Tools 293
12.2 Software Tools
At the very least, we need a high-level language compiler. Many now come
with a friendly front end that makes it easier to manage large projects with
the minimum of fuss. (The days of the traditional makefile are receding fast.)
Unfortunately, this is only half the story. F or most applications in VR, the
majority of the code will involve using one of the system API libraries. In
the case of PCs running Windows, this is the platform software developers
kit (SDK). For real-time 3D graphics work, a specialist library is required.
Graphics APIs are introduced and discussed in Chapter 13, where we will
see that one of the most useful libraries, OpenGL, is wonderfully platform-
independent, and it can often be quite a trivial job to port an application be-
tween Windows, Linux, Mac and SGI boxes. We shall also see in Chapter 17
that libraries of what is termed middleware can be invaluable in building VR
applications.
12.2.1 Why C and C++
Almost without exception, VR and 3D graphics application programs are de-
veloped in either the C and/or C++ languages. There are many reasons for
this: speed of program execution, vast library of legacy code, quality of devel-
oper tools—all of the operating systems on the target platforms were created
using C and C++. So we decided to follow the majority and write our code
in C and C++. We do this primarily because all the appropriate real-time 3D
graphics and I/O libraries are used most comfortably from C or C++. Since
OpenGL has the longest history as a 3D graphics library, it is based on the
functional approach to programming, and therefore it meshes very easily with
applications written in C. It does, of course, work just as well with application
programs written in C++. The more recently specified API for Windows ap-
plication programs requiring easy and fast access to graphics cards, multime-
dia and other I/O devices, known as DirectX, uses a programming interface
that conforms to the component object model (COM). COM is intended to
be usable from any language, but in reality most of the examples and applica-
tion programs in the VR arena use C++. Sadly, programming with COM can
be a nightmare to do correctly, and so Microsoft’s Visual Studio development
tools include a library of advanced C++ template classes to help. Called the
ATL, it is an enormous help to application developers, who sometimes get
interface reference counting object creation and destruction wrong. We talk
more about this topic in Section 12.4.2.