newspeoplefor developersdocumentationdownloads

DirectX 9 Graphics System
[Graphics System]

This page describes Nebula DirectX 9 graphics system and it's subsystems.

DirectX 9 Graphics Server

Nebula DirectX 9 Graphics Server (nD3D9Server) wraps functionality and implementation of D3D9.

The main features of this system includes something like this:

  • create window and handle windows message loop.
  • factory for mesh, texture, shader
  • completely encapsulates device lost/restore (application doesn't need to care about those dirty details)

Shader support

Nebula2's nD3D9Shader uses effect files to specify render state and vertex/pixel shaders. Effect files can be used to set not just the render state but also how many passes, so you can build up very complex effects. One of their best features is that each technique in an effect file will be validated by the Direct3D runtime and the first one that passes will be used, so you can have multiple techniques in each file for different graphics card capabilities; one that uses 4 textures in one pass, another that uses 2 textures in 2 passes, etc. This allows you to have more complex techniques for better cards and fall backs for older cards. In the example shaders that come with Nebula2 you can see there are two techniques, one for pixel shader hardware and one for cards that don't have pixel shaders.

Effect files are part of Direct3D so the place to learn more about them is the Direct3D documentation. The example effect files use High Level Shader Language or HLSL. Here are some links to information about effect files and HLSL:

DialogBox Mode

DialogBox mode sets the display to allow the use of GDI dialog boxes (normal windows controls) in full screen mode. Once you have a display in dialog box mode you can call nGfxServer::EnterDialogBoxMode() and nGfxServer::LeaveDialogBoxMode().

Setting DialogBoxMode in nDisplayMode2 causes the d3d9 gfx server to make the back buffer lockable (D3DPRESENTFLAG_LOCKABLE_BACKBUFFER) this does cause a small performance hit.

See D3D9 docs: http://msdn.microsoft.com/library/en-us/directx9_c/IDirect3DDevice9__SetDialogBoxMode.asp

Mesh support

nD3D9Mesh encapsulates vertex and index buffer of D3D9.

Texture support

(Talk about support for cube maps, compressed textures and other good things.)

In addition to the DDS format, the DirectX 9 Graphics Server supports bmp, dib, hdr, jpg, pfm, png, ppm and tga. These are only recommended for testing purposes, however (see the general Graphics System docs).

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.