This article summarizes the Microsoft® Direct3D® Retained Mode samples. The summary for each sample lists the default installation directory for that sample in the Microsoft DirectX® Software Development Kit (SDK) and provides a short description of the sample.
All of the Direct3D Retained Mode samples except RMBegin1, RMBegin2, RMEnum and Viewer use the RMMain helper code. All of the samples that use the RMMain helper code depend on the Rmmain.cpp to provide the main application window and Rmmain.rc to provide menus and accelerators. These samples also link to the Ddraw.lib and D3drm.lib libraries. Each sample directory includes a Microsoft Developer Studio project (.dsp) file that you can open in Developer Studio and use to build the sample.
If you are new to Direct3D Retained Mode, you might want to start by looking at the RMBegin1, RMBegin2, RMEnum, Egg, Globe, Hier1, and Tex1 samples.
The following articles provide a detailed walk through of sample code.
This article contains information on the following samples.
Some of the DirectX Foundation SDK samples demonstrate multiple technologies. You might want to look at those samples to see how the technologies fit together. For example, the DS3dView DirectSound sample is a simple extension of the Direct3D Retained Mode 3-D object Viewer sample. DS3dView enables you to attach sounds to objects and to move the objects in three dimensions. For more information about DS3dView see the DirectX Foundation SDK.
Path
mssdk\samples\multimedia\d3drm\src\Egg
Description
This sample loads a simple DirectX file of a single mesh object (Egg.x from the Dxsdk\Media directory). The sample initializes the lights in the scene, loads the mesh file, creates the egg frame within the scene, adds the mesh into the frame, and sets up the frame's position, orientation, and rotation. The sample uses methods of IDirect3DRM3 (CreateFrame, CreateLightRGB, CreateMeshBuilder), IDirect3DRMFrame3 (SetPosition, AddLight, SetRotation, AddVisual, SetOrientation), and IDirect3DRMMeshBuilder3 (Load).
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Faces
Description
This sample creates mesh objects one face at a time.
Required Libraries
- Ddraw.lib
- D3drm.lib.
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Fly
Description
This sample uses animations to set the position of a spaceship along a curved path.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Globe
Description
This sample loads a simple DirectX file of a single mesh object with textures. It uses methods of:
- IDirect3DRM3
- CreateFrame
- CreateLightRGB
- CreateMeshBuilder
- CreateMaterial
- CreateWrap
- LoadTexture
- CreateAnimation
- IDirect3DRMFrame3
- GetScene
- LookAt
- SetPosition
- AddLight
- SetOrientation
- SetRotation
- AddVisual
- AddMoveCallback
- AddDestroyCallback
- IDirect3DRMMeshBuilder3
- Load
- SetMaterial
- Scale
- SetColorRGB
- GetBox
- SetTexture
- IDirect3DRMAnimation
- SetFrame
- SetTime
- SetOptions
- AddPositionKey
- IDirect3DRMWrap
- Apply
- IDirect3DRMTexture3
- SetShades
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Hier1
Description
This sample creates a simple hierarchy of two meshes, demonstrating the concept of frames. It initializes the lights in the scene, loads two mesh files, and creates a hierarchy of frames (frames within frames). Hier1 loads a texture and wraps it onto a mesh, adds the mesh into the frame, and sets up the frame's position, orientation, and rotation.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Path
mssdk\samples\multimedia\d3drm\src\Hier2
Description
This sample demonstrates a simple hierarchy of four meshes.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Hier1
Path
mssdk\samples\multimedia\d3drm\src\Morph
Description
This sample demonstrates how to use interpolators.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
IDirect3DRMInterpolator
Path
mssdk\samples\multimedia\d3drm\src\Quat
Description
This sample uses quaternions to interpolate between two vectors in space.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\RMBegin1
Description
This is a "bare-bones" sample that creates a default Direct3D Retained Mode device, loads a mesh from a DirectX file, adds lights, and rotates the mesh object. Extensive comments throughout the sample code introduce and explain its purpose.
Unlike most of the Direct3D Retained Mode samples, it does not use the RMMain helper file, Rmmain.cpp, or the extensive menus provided by Rmmain.rc.
For a detailed code walkthrough of the RMBegin1 sample, see Rotating an Object: The RMBegin1 Sample.
For a sample that builds upon the RMBegin1 sample code, see RMBegin2.
Required Libraries
- Ddraw.lib
- D3drm.lib
Path
mssdk\samples\multimedia\d3drm\src\RMBegin2
Description
This is a "bare-bones" sample that demonstrates a hierarchy of frames. It loads, scales, lights, and colors three objects from DirectX files. The objects mimic a sun, planet, and moon scenario with the moon revolving around the planet and both the moon and planet revolving around the sun. This sample builds upon the code introduced in the RMBegin1 sample. In addition to building a more complex scene than RMBegin1, this sample handles resizing of the window and handles the WM_ACTIVATE and WM_PAINT messages. Extensive comments throughout the sample code introduce and explain its purpose.
Unlike most of the Direct3D Retained Mode samples, it does not use the RMMain helper file, Rmmain.cpp, or the extensive menus provided by Rmmain.rc.
For a detailed code walkthrough of the RMBegin2 sample, see Frame Hierarchies: The RMBegin2 Sample.
Required Libraries
- Ddraw.lib
- D3drm.lib
Path
mssdk\samples\multimedia\d3drm\src\Rmenum
Description
This is a "bare-bones" sample that enumerates devices, intelligently selects one, and creates the Direct3D Retained Mode device. This sample does not perform any rendering. It focuses on device enumeration for clarity and simplicity of code. It enables the user to select the device through a menu choice.
Unlike most of the Direct3D Retained Mode samples, it does not use the RMMain helper file, Rmmain.cpp, or the extensive menus provided by Rmmain.rc. It does use the error reporting functions from its Rmerror.c file.
For a detailed code walkthrough of the RMEnum sample, see Enumerating Devices.
Required Libraries
- Ddraw.lib
- D3drm.lib
Path
mssdk\samples\multimedia\d3drm\src\Misc
Description
The RMMain helper code handles common tasks, such as creating, enumerating, and managing Microsoft DirectDraw® and Direct3D Retained Mode objects and providing a common resource for menus. It uses Direct3D Retained Mode to set up a window for rendering, calls the BuildScene function the sample provides to have the sample build its scene, and uses Direct3D Retained Mode to render the scene. Most of the Direct3D Retained Mode samples link to this common code, which allows the application-specific code to be much simpler. The samples that use RMMain only work in windowed mode.
RMMain also provides a number of menu items, allowing the user to see the effect of different rendering options. You can single step through the animation, select the device to use for rendering, select shading (flat or Gouraud), turn lighting and dithering on and off, and choose fill options (point, wireframe, or solid).
The RMMain helper code consists of the following files.
Rmmain.cpp Main source file that includes WinMain and message handler. Creates Direct3D Retained Mode, uses it to set up the window for rendering, and then calls the sample to have it build its scene. Resource.h Header file for Rmmain.rc. Rmmain.rc Resource file for Rmmain.cpp, providing menus, keyboard accelerators, and the About dialog box.
Path
mssdk\samples\multimedia\d3drm\src\Shadow
Description
This sample creates a shadow of a mesh object.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Tex1
Description
This sample loads a simple, texture-mapped mesh object, using a cylindrical mapping.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Tex3, Tex4, and Tex5
Path
mssdk\samples\multimedia\d3drm\src\Tex3
Description
This sample uses texture wraps for special effects, using a spherical mapping relative to a frame.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Tex1, Tex4, and Tex5
Path
mssdk\samples\multimedia\d3drm\src\Tex4
Description
This sample uses texture wraps for special effects, using a spherical mapping relative to the camera. The texture is also used as a background for the scene.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Tex1, Tex3, and Tex5
Path
mssdk\samples\multimedia\d3drm\src\Tex5
Description
This sample uses a wrap for chrome mapping and a texture map as decal.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
See Also
Tex1, Tex3, and Tex4
Path
mssdk\samples\multimedia\d3drm\src\Trans
Description
This sample demonstrates the use of transparent texture maps. It rotates a solid sphere and independently rotates two partially transparent checkered cubes that intersect with the sphere. The sample creates frames, lights, meshbuilders, meshes, textures, and materials. It calls IDirect3DRMTexture3::SetDecalTransparency to make decals transparent.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Uvis
Description
This sample demonstrates how Direct3D can be used with Direct3D Retained Mode. It demonstrates how to use a Direct3D Immediate Mode execute buffer as a visual in a Direct3D Retained Mode scene.
Required Libraries
- Ddraw.lib
- D3drm.lib
Required RMMain Code
- Rmmain.cpp
- Rmmain.rc
Path
mssdk\samples\multimedia\d3drm\src\Viewer
Description
Viewer (Direct3D Retained Mode Object Viewer) is a stand-alone Retained Mode application that enables you to load and view 3-D objects.
The initial scene has a light source in the upper-right corner. To see this, the view can be moved backward and forward using the T and R keys. Additional objects can be loaded from the File menu, and new light sources can be added from the Lights menu. Objects can be rotated with the left mouse button and dragged with the right.
The last object that was rotated or dragged remains the current selection.
The device quality can be altered using the Renderer menu. Using this menu, the type of device used can also be switched from ramp to RGB. When using the RGB device, the color of lights in the scene can be changed in the same way as you change the color of objects. In 256-color mode, it is advisable to dither an RGB device for best results.
Additional keyboard controls:
T Forward R Back Z Move current selection forwards X Move current selection back Ctrl+G Gouraud shade Ctrl+F Flat Shade Ctrl+D Dither toggle Arrow Keys Move left/right/up/down Delete Delete the current selection
Required Libraries
- Ddraw.lib
- D3drm.lib
- Comdlg32.lib
- Winmm.lib
- Msvcrt.lib
Top of Page
© 1999 Microsoft and/or its suppliers. All rights reserved. Terms of Use.