Tomas SMLSAL, Vaclav SKALA
University of West Bohemia
Department of Computer Science
306 14 Plzen
Keywords: computer graphics, DirectX, Direct3D, DirectDraw, C#, .NET Framework, COM, implementation, interface, wrapper class, security, efficiency, Microsoft.
Several techniques of how to implement DirectX functionality into C# application will be presented. Their common attribute is an idea of component object model (COM) because DirectX is based on this technology.
One of the most important task in computer graphics programming is an user interaction. For purposes of game and other high-performance multimedia developers, DirectX technology was prepared. It is a set of low-level application programming interfaces (APIs) that includes support for high-performance 2-D and 3-D graphics, sound and music, input, force feedback, multimedia streaming, and network communication for applications (such as multiplayer games). This talk will be focused on use of DirectX graphical capabilities within the C# code of the Microsoft .NET Framework.
The three main techniques will be described. First, COM interoperability which allows us to decide what specific functionality to use. There will be also mentioned some basic principles like memory management and garbage collector (GC) and some approaches based on wrapper classes. Second, Visual Basic type library that includes all the functionality, and third, the complete solution known as DirectX 9.0.
In this last section the following significant namespaces will
be shortly described:
Microsoft.DirectX (provides utility operations and data storage for DirectX application programming, including exception handling, simple helper methods, and structures used for matrix, clipping plane, quaternion, and vector manipulation),
Microsoft.DirectX.Direct3D (enables to manipulate visual models of 3-D objects and take advantage of hardware acceleration) and
Microsoft.DirectX.DirectDraw (display memory, the hardware blitter, hardware overlay support, and flipping surface support).
Each technique will be supported with a code sample and with several reasons stating its suitability.
Also issues concerning security and efficiency will be presented. Nowadays, the need for security can be more important than for the efficiency. This also gives a right answer for the question of how good is solution provided by use of DirectX and .NET Framework.