Software Programs and Projects

This Software Programs and Projects include programing tips and technology using different languages like VC++,ASP,JSP C#.Net,PHP,VB.Net,JavaScript,ASP.NET .Software Programs and Projects blog mainly support to software programmers and provide help through the mail.

DirectX in C#

Several techniques of implementing DirectX functionality into C# application will be presented. Their common attribute is an idea of component object model (COM) because DirectX is based on component technology. This paper will be focused on use of DirectX graphical capabilities within the C# code of the Microsoft .NET Framework. 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. Each technique will be supported with a code snippet and with several reasons stating its suitability. 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.

The purpose of this paper is to provide a basic idea about implementation of DirectX graphical interface in the code of C# language in the .NET Framework. A goal is to have such an environment where the code for C# looks similar to the C++ one. This work is a part of project ROTOR, more detailed information is placed at [Her03]. DirectX version 8.1 and above is assumed, if not said explicitly. Complete information on DirectX and .NET Framework can be found in electronic resources [MSDN02].

The .NET Framework Environment where the C# code is executed. It uses Garbage Collector (GC) for system memory management, which automates such tasks as a memory allocation, release, fragmentation, etc. No pointers are allowed here (managed code) but if necessary, the unmanaged code can be entered. In this mode pointers are allowed but GC doesn”t work - it is a developer responsibility to manage the memory. Therefore the managed code should be used but there is a problem: DirectX is using pointer parameters to pass data into its functions. How to face this pointer-problem will be shown later in the paragraph “COM Benefits”.

0 comments:

Post a Comment

Post a Comment