This is only a preview of the April 1998 issue of Silicon Chip. You can view 32 of the 96 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Items relevant to "An Automatic Garage Door Opener; Pt.1":
Articles in this series:
Articles in this series:
Items relevant to "40V 8A Adjustable Power Supply; Pt.1":
Articles in this series:
Items relevant to "A Chook Raffle Program For Your PC":
Purchase a printed copy of this issue for $10.00. |
COMPUTER BITS
BY JASON COLE
DirectX 5: why you need it
Aimed originally at the 3D games & multimedia
markets, DirectX is designed to simplify and
speed up complicated tasks such as rendering
3D graphics and playing sounds. Let’s find out
more about it.
3D graphics in consumer PCs are
becoming commonplace, driven
mainly be the demand for high-quality 3D graphics in games. Quite a few
high-performance 3D accelerators and
combination 3D/2D graphics cards are
now available at reasonable prices.
However, a 3D graphics card is
not the only thing you need for fancy
3D graphics. You also need special
software known as an API (application programming interface) in order
to take advantage of all the card’s
features. One of the best known APIs
is DirectX.
DirectX was created by Microsoft so
that a programmer can more effectively
utilise specific hardware components
in your PC. But why do we need some
other program to help programmers
use the hardware?
Well, the problem with programming for computers is that there are
many different types of hardware out
there. This makes it impossible to
produce a single piece of software that
fully utilises the various features of all
this hardware. To explain, let’s say that
you’re a games programmer and the
game you’re creating is 3D-based. This
means that you need to issue specific
instructions to the video card in order
to create 3D graphics. Unfortunately,
the commands used for one type of
video card are different to those used
for most others.
This means that your software
would have to be able to identify each
of the many different 3D graphics cards
that are now in existence and utilise
the appropriate code for the model
detected. In theory, this could be done
but it’s clearly impractical because of
the amount of software that would be
involved. A typical game would have
to be installed from three or four CDs
Tip Of The Month
Most people know that if you want to delete something in Windows 95 you
simply drag the file onto the Recycle Bin icon. But did you also know that you
can print files by dragging them onto a printer icon?
If you have one or more printers, all you have to do is create shortcuts to
them on the desktop. This done, you can print files simply by dragging them
onto the appropriate icon. When you do this, the application that created the
file is automatically launched and the file downloaded to the printer.
In case you’re wondering, you can also open a document by dragging
it (or a shortcut to it) onto the application’s icon (or onto a shortcut to the
application). Of course, in most cases it will be easier to open the document
by double-clicking it.
and would take up a lot of room on
your hard disc drive.
One way around this is to design
the game so that it only uses generic
program codes. Unfortunately, this
would severely compromise the graphics quality, regardless of the quality of
the video card. The graphics on a $400
3D video card would be no better than
those on a $100 card. Sure, the $400
3D card would be fast but who cares
if the game looks substandard?
In fact, this is how things were done
up until a few years ago. Many games
were simply designed for the “S3”
video chip. That’s great for S3 chip
owners but what about other chips?
DirectX was designed to overcome
this problem. It’s so-called “Low Level” functions are based on Application
Programming Interfaces, or API’s for
short. API’s control functions from 2D
graphics acceleration to mouse and
joystick inputs.
DirectX is, in fact, split up into
four areas which are a part of the
“Foundation Layer”. These are Direct3D, DirectSound, DirectDraw and
DirectInput. These areas use software
drivers to communicate between the
software and the hardware. This is
called the “Hardware Abstraction
Layer” or HAL.
As a result, programmers can write
a set of instructions that are standard
and the HAL will then translate these
instructions so that they can be used by
the hardware. But what if the hardware
doesn’t support the features that the
program requires?
A typical example of this is 3D
games on a 2D video card. In cases
like this, DirectX uses a “Hardware
Emulation Layer”, or HEL. This will
decipher the instructions and generate
a virtual 3D card from the 2D card. Of
course, this will be slower than using a
April 1998 53
Fig.1: the Add/Remove Programs feature in Control Panel lets
you restore your previous audio and video drivers.
real 3D card but it does allow everyone
to play 3D games regardless of what
video card he or she has.
It should be pointed out that not all
devices are supported by DirectX. The
hardware maker must supply a set of
drivers for DirectX in order to take
advantage of the specialised functions
that DirectX has to offer.
Fortunately, most of the latest 3D
cards support DirectX. But that’s not
the end of the story; there are other
APIs besides DirectX, the two main
ones being OpenGL and Glide. In
fact, Quake – one of the biggest selling
games of all time – supports OpenGL
exclusively for 3D acceleration and
new titles are being added all the time.
For this reason, many graphics card
vendors also provide OpenGL drivers
for their latest offerings. Glide works
only with 3Dfx-based cards.
As well as providing graphics
compatibility, DirectX also provides
compatibility between different multimedia elements (eg, graphics and
sound). Fairly obviously, the computer
must be able to provide simultaneous
graphics and sound. Originally, this
required several API’s for the video
and sound cards, generally from
different manufacturers. After all,
not everyone uses a Creative sound
54 Silicon Chip
Fig.2: you can check the status of your DirectX drivers
by double-clicking Dxtool.exe.
card with a Creative video card. In
fact, I use a Creative sound card with
an Octek video card. These are both
fairly high-quality components but
the APIs for the sound card may not
work well with the API’s for the video
card, thereby causing conflicts and
slowing down either the video image
or the sound.
Once again, DirectX overcomes this
problem. It has a “Media Layer” and
this to is split up into several areas: Direct3D retained mode, DirectPlay, DirectAnimation, and DirectShow. Note
that DirectShow and DirectAnimation
are now built into Microsoft Internet
Explorer 4.0, which allows web site
developers to utilise the enhanced feature’s of DirectX. This can also reduce
the size of the page that is downloaded
and thus the download time – an important consideration for web users.
The “Media Layer” of DirectX
works in a similar way to the “Low
Level” functions described earlier and
enables programmers to co-ordinate
a multitude of different multimedia
elements. This is done by using a set of
API’s that allow the different elements
to function together as though they
were a single application. As a result,
different elements can work together
and run smoothly with the correct
timing (eg, a 2D character on top of a
video clip with some added sound).
Installing DirectX
If you’re into games or other multimedia activities with fancy graphics,
then DirectX 5.0 is a must. It can be
downloaded from the Microsoft web
site and is also often available on the
CD-ROMs that come with some computer magazines. It is also supplied
with some games programs.
During the installation, the install
program checks for “certified” video
and audio card drivers. If it finds them,
it recommends upgrading them with
new drivers (which are included with
the install program). You simply click
“Yes” to upgrade or “No” to keep your
existing drivers. By the way, you can
easily revert to your previous drivers
via the Add/Remove Programs feature
in Control Panel – see Fig.1. You can
also disable or enable Direct 3D Hardware Acceleration.
If you want to check the status of
the DirectX Driver Tool, go to the
folder where DirectX is installed and
double-click Dxtool.exe. A dialog box
similar to that shown in Fig.2 will
appear. This dialog box also enables
you to turn Direct 3D and DirectDraw
hardware acceleration on or off. SC
|