This lecture explains some of the basics of the Microsoft DirectX multimedia support software system, and focuses on an example of the Direct3D Immediate Mode. It also covers Wu Chapter 7's discussion of the Version 6 Internet Protocol.
But first a few words about the COM concept.
http://www.microsoft.com/workshop/components/com/comatl.asp
Having read the introductory portion of that stuff (you did read it, didn't you?) should equip you to answer the following queries.
Query 18.1. What is the principle of immutability and why is it so important?
Query 18.2. What role does the registry play in COM?
Query 18.3. What is a signature, in the sense of this article? What is a GUID?
DirectX is a software package built into Windows 98 and NT 5.0, and later versions of Windows 95, and can be added to NT 4.0 and older Win95 installations. The downloads are available from the above DirectX site and are free. "X" in the above is replaced by many different words to name parts of DirectX; such as Direct3D, DirectDraw, etc.
DirectX's purpose is to provide a uniform programmer's interface for game and other media developers, hiding the differences between graphics, sound and other resources in the actual hardware. This means that DirectX has to do a lot of "busy work" to set up a session, even for something as simple as showing a single triangle.
DirectX Foundation provides HAL (Hardware Abstraction Layer) to connect applications to specific hardware. If necessary hardware is not there, DirectX also provides HEL (Hardware Emulation Layer) which is software that does the job of the missing hardware. The components of Foundation:
DirectDraw
Direct3D
DirectInput
DirectMusic
DirectSound
DirectSound3D
DirectPlay
For a basic explanation of DirectX Foundation, follow this link.
DirectX Media is the next layer up; it provides more integrated behaviors, such as animation, media streaming, and interactivity. Media includes
DirectShow - media streaming playback system, such as MPEG, DVD-video,
Quicktime
DirectAnimation - for mixing vector and image graphics into animated
HTML or other apps
DirectX Transform - tools for people to add capabilities to DirectX
Direct3D Retained Mode - similar to VRML, with its own scene graph.
DirectPlay - joysticks, etc.
For a basic explanation of DirectX Media, follow this link.
Components are the highest level of stuff that Microsoft supports. VRML 2.0 is a Component. It makes calls to both DirectX Media and DirectX Foundations, as needed. Notice, however, that these aren't the only place where COM modules and techniques are used.
NetMeeting - an online whiteboard
Windows Media Player - provides a timing framework to coordinate multimedia.
VRML
The VRML site looks somewhat neglected.
For a basic explanation of DirectX Components, follow this link.
Using DirectX. You need four things:
1) The DirectX
Software Developer's Kit (SDK) Version 6.0 is the current one, I think.
2) A very
good book about DirectX. Microsoft recommends this book.
3) A working example of code (provided with the SDK and also with the
book)
4) A mentor who already knows how to use DirectX. (Not me!)
We'll walk through some DirectX code, to give you a flavor of how it all hangs together. We'll stop and discuss the following points.
The source code for this Direct3D Immediate Mode example is located at Microsoft's DirectX site.
Some remarks about the example:
1) Note that the constants they're defining have mundane names like FRONT_CLIP and BACK_CLIP. If you were designing a module for others' use, you'd be smart to provide a unifying naming convention. If the package was named JMM, for instance, you might start all the defs intended for public use with JMM_. So, we recognize this demo as just a sample, not a module for others' use.
2) When we get to the global variables, the naming convention gets more obvious. prefixes h, f and l start appearing. f seems to be 'flag'; h is 'handle'; l, I don't know what it means. We see that the types being invoked, such as LPDIRECTDRAWSURFACE are all prefixed with LP (the data type category) and DIRECTDRAW, which are references back to ddraw.h. Shortly we come to DIRECT3D and D3D references, which obviously point back to d3d.h.
3) Consider the predefined transformation matrices on page 4 (of my printout, at least.) They look sorta familiar. One notices that the d3dWorldMatrix is the identity matrix; that d3dViewMatrix has some mysterious stuff (namely, 5.0) down at the fourth row, third column; and that the projection matrix has a zero (!) in its lower right corner.
I don't want to drown you in the details of 32 pages of code that are required to draw a simple spinning rectangle. Here are the essential steps.
Query 18.4: Explain the following terms and concepts which were encountered while walking through the Direct3d immediate mode example. I've changed the order to correspond more to execution order, rather than presentation order in the source code. Your best approach to figuring these items out would be to read the header comments associated with the source code, accessible through the link above.
Enumeration of Direct3D devices and selecting one
Converting Bit Depths
Working with Matrices
Creating Objects and Interfaces
Creating the Scene
Filling the Execute Buffer
Animating the Scene (by changing one matrix & rerunning the Execute
Buffer)
Rendering
Restoring & Redrawing
Releasing Objects
Error Checking
Main Window Procedure
MainWin Function
There's not a lot of good stuff to be learned here in a course at this level, so let's not waste too much time.
But I want to make sure everyone understands how callback functions are used.
Say you want to apply a procedure to a bunch of instances of some data. One way to do so, would be to put it in a loop and call it repeatedly, assigning to its parameters the appropriate values for each call. However, what if you don't know when the data will be available, or from what variable it will be found. You could just hand the procedure itself to other procedures which may in fact know where the data is (or may make it up as needed.)
By analogy, the first approach is like a cookie factory. All the ingredients
are available in standard ways and packaging, so you just put everything
in an assembly line. The second approach is like a cookbook recipe for
cookies. It's passed out to millions of households, where people provide
the "flour" from a variety of boxes, bags, tins and bins, whole wheat or
white or whatever. In the same way, a callback function provides the "how-to"
to solve a problem, but allows its use (i. e. the assignment of parameter
values) by a variety of potential callers - whose identities we may not
even know! When you pass a handle of a callback function to some procedure
(like the enumerator in this example), it's probably being passed to other
procedures before it's actually invoked.
We discussed the problem of running out of Class B nets. IPv6 uses 128 bit (16 byte) addresses.
IP Address:
3 bits: format prefix. 010 means "unicast" (traditional message to one
destination.)
5 bits: registry ID (who assigns your IP addresses?)
16 bit: provider ID (are there gonna be only 64K ISPs in the world?
16 bit: subscriber type, and
8 bit: subscriber ID, effectively constitute a 24 bit subscriber
ID. 16 million of these.
32 bit sub-net ID, and
48 bit host ID.
Hard to see, based on the text, how the slicing into subscriber types, etc. will be done. We need an external reference article to get more information.
IP header:
Version: 4 bits. Supports up to 15, of course. This one is 6 (0110).
Priority: 4 bits. Interactive traffic=6; e-mail and other unattended
traffic is 2.
Flow label: 24 bits. Supports routers' tracking of an extended document
(anti-"connectionless" in flavor)
Payload length: 16 bits so IP packets can have up to 64k bytes.
Next header: 16 bits. This links forward to extension headers for rarely
used optional information.
Hop limit: 8 bits. Formerly "time to live". Decrements one per hop
Source addr: 128 bits IPv6
Destination addr: 128 bits IPv6
Despite the "rarely" above, the author says that the authentication header is required. Not enough detail is provided to show how this critter is to be used.
Migration from IPv4 to IPv6
If an IPv4 address needs to be represented in IPv6, just set the first 96 bits to zero.
IPv6 will be "tunneled" through IPv4 by representing the v6 headers, presumably at the TCP/IP layer. Inefficient.
ISPs will gradually come up IPv6 capable over the next few years.
RTP - Real Time Protocol
Essentially RTP is a strategy for using UDP to support videoconferencing. It uses feedback to lower the quality of video being fed into the system, as needed, so that frame rates can be maintained (people object to lost frames more than they object to degraded resolution.)
RSVP - ReSource reserVation Protocol
RSVP sets up a "soft state" in routers to establish a pathway. This is contrary to the spirit of IP, but hey it works.
Intranets
Using Internet technology within one's organization rather than in a public context. Uses are everywhere. McDonnell Douglas' service bulletin system is typical; 4 million pages of documentation per year.
Back to the course index
Back to the course syllabus
Back to the previous lecture
Onward to the next lecture