DirectX 8 开发者常见问题集

 

Microsoft DirectX 8 Developer FAQ

Microsoft Corporation

February 2001

Summary: This article provides in-depth answers to frequently asked development questions regarding Microsoft DirectX, version 8.0, including sections on Direct3D, DirectSound, and DirectPlay. (10 printed pages)

Contents

General DirectX Development Issues
Direct3D
   General Questions
   Geometry (Vertex) Processing
   Performance Tuning
   Direct3DX Utility Library
DirectSound
DirectPlay

General DirectX Development Issues

Why do I get so many error messages when I try to compile the samples?

You probably don't have your include path set correctly. Many compilers, including Microsoft? Visual C++?, include an earlier version of the SDK, so if your include path searches the standard compiler include directories first, you'll get incorrect versions of the header files. To remedy this issue, make sure the include path and library paths are set to search the DirectX include and library paths first. See also the dxreadme.txt file in the SDK. If you install the DirectX SDK and you are using Visual C++, the installer can optionally set up the include paths for you.

I get linker errors about multiple or missing symbols for globally unique identifiers (GUIDs), what do I do?

The various GUIDs you use should be defined once and only once. The definition for the GUID will be inserted if you #define the INITGUID symbol before including the DirectX header files. Therefore, you should make sure that this only occurs for one compilation unit. An alternative to this method is to link with the dxguid.lib library, which contains definitions for all of the DirectX GUIDs. If you use this method (which is recommended), then you should never #define the INITGUID symbol.

Can I cast a pointer to a DirectX interface to a lower version number?

No. DirectX interfaces are COM interfaces. This means that there is no requirement for higher numbered interfaces to be derived from corresponding lower numbered ones. Therefore, the only safe way to obtain a different interface to a DirectX object is to use the QueryInterface method of the interface. This method is part of the standard IUnknown interface, from which all COM interfaces must derive.

Can I mix the use of DirectX 8 components and DirectX 7 or earlier components within the same application?

You can freely mix different components of differing version; for example, you could use DirectPlay 8 with DirectDraw 7 in the same application. However, you generally cannot mix different versions of the same component within the same application; for example, you cannot mix DirectDraw 7 with Direct3D 8 (since these are effectively the same component as DirectDraw has been subsumed into Direct3D in DirectX 8).

What do the return values from the Release or AddRef methods mean?

The return value will be the current reference count of the object. However, the COM specification states that you should not rely on this and the value is generally only available for debugging purposes. The values you observe may be unexpected since various other system objects may be holding references to the DirectX objects you create. For this reason, you should not write code that repeatedly calls Release until the reference count is zero, as the object may then be freed even though another component may still be referencing it.

Does it matter in which order I release DirectX interfaces?

It shouldn't matter because COM interfaces are reference counted. However, there are some known bugs with the release order of interfaces in some versions of DirectX. For safety, you are advised to release interfaces in reverse creation order when possible.

What is a smart pointer, and should I use them?

A smart pointer is a C++ template class designed to encapsulate pointer functionality. In particular, there are standard smart pointer classes designed to encapsulate COM interface pointers. These pointers automatically perform QueryInterface instead of a cast, and handle AddRef and Release for you. Whether you should use them is largely a matter of taste. If your code contains lots of copying of interface pointers, with multiple AddRefs and Releases, then smart pointers can probably make your code neater and less error prone. Otherwise, you can do without them. Visual C++ includes a standard Microsoft COM smart pointer, defined in the "comdef.h" header file (look up com_ptr_t in the help).

I have trouble debugging my DirectX application, any tips?

The most common problem with debugging DirectX applications is attempting to debug while a DirectDraw surface is locked. This situation can cause a "Win16 Lock" on Microsoft Windows? 9x systems, which prevents the debugger window from painting. Specifying the D3DLOCK_NOSYSLOCK flag when locking the surface can usually eliminate this. Windows 2000 does not suffer from this problem. When developing an application, it is useful to be running with the debugging version of the DirectX runtime (selected when you install the SDK), which performs some parameter validation and outputs use

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
DirectX 8 SDK是一款为开发者提供多媒体和游戏应用程序的软件开发工具包。它于2000年发布,是Windows操作系统上的一种图形应用程序接口。DirectX 8 SDK包含了一系列的库和工具,用于加速计算机图形和音频渲染。它为开发者提供了一种简单而有效的方式来创建富有创意和多媒体效果的应用程序。 DirectX 8 SDK具有许多重要的特性和功能。其中包括对高质量3D图形和动画的支持,以及增强的音频功能,包括3D音效的实现。此外,DirectX 8 SDK还提供了一些辅助工具和库,用于处理输入设备、网络通信和多媒体文件的加载和播放等。 通过使用DirectX 8 SDK,开发者可以充分利用计算机硬件的性能优势,提供流畅的游戏体验和视觉效果。它使开发者能够创建复杂的3D场景、实现逼真的光影效果和物理模拟,并控制游戏中的音频和视频流。 DirectX 8 SDK不仅在游戏开发领域得到广泛应用,也在其他领域如虚拟现实、多媒体应用程序以及计算机辅助设计等方面发挥作用。它的易用性和高性能使得开发者能够更加专注于创意和体验的设计,而无需过多关注底层的编程细节。 总而言之,DirectX 8 SDK是一款功能强大的软件开发工具包,为开发者提供了许多丰富的功能和工具,用于创建多媒体和游戏应用程序。它在计算机图形和音频的渲染方面有着重要的作用,为开发者提供了简洁而方便的编程接口。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值