The IDirect3DRMTexture2 interface is an extension of the IDirect3DRMTexture interface. IDirect3DRMTexture2::InitFromResource2 allows resources to be loaded from DLLs and executables other than the currently executing file. In addition, IDirect3DRMTexture2 has two additional methods. The IDirect3DRMTexture2::InitFromImage method creates a texture from an image in memory. This method is equivalent to the IDirect3DRM::CreateTexture method. The IDirect3DRMTexture2::GenerateMIPMap method generates a mipmap from a source image.
To avoid unnecessary delays when creating textures, hold onto textures you want to use again, instead of creating them each time they're needed. For optimal performance, use a texture surface format that is supported by the device you are using. This will avoid a costly format conversion when the texture is created and any time it changes.
See the remarks in IDirect3DRM2::LoadTexture for an example showing how to keep a reference to textures loaded in a texture callback through IDirect3DRM2::LoadTexture.
For a conceptual overview, see IDirect3DRMTexture and IDirect3DRMTexture2.
The methods of the IDirect3DRMTexture2 interface can be organized into the following groups:
| Color | GetColors |
| SetColors | |
| Decals | GetDecalOrigin |
| GetDecalScale | |
| GetDecalSize | |
| GetDecalTransparency | |
| GetDecalTransparentColor | |
| SetDecalOrigin | |
| SetDecalScale | |
| SetDecalSize | |
| SetDecalTransparency | |
| SetDecalTransparentColor | |
| Images | GetImage |
| Initialization | InitFromFile |
| InitFromImage | |
| InitFromResource2 | |
| InitFromSurface | |
| MIP map generation | GenerateMIPMap |
| Renderer notification | Changed |
| Shading | GetShades |
| SetShades |
The IDirect3DRMTexture2 interface, like all COM interfaces, inherits the IUnknown interface methods. The IUnknown interface supports the following three methods:
| AddRef |
| QueryInterface |
| Release |
In addition, the IDirect3DRMTexture2 interface inherits the following methods from the IDirect3DRMObject interface:
| AddDestroyCallback |
| Clone |
| DeleteDestroyCallback |
| GetAppData |
| GetClassName |
| GetName |
| SetAppData |
| SetName |
You can create an IDirect3DRMTexture2 object by calling IDirect3DRM2::CreateTexture or IDirect3DRM2::CreateTextureFromSurface.
Informs the renderer that the application has changed the pixels or the palette of a Direct3DRMTexture2 object.
HRESULT Changed(
BOOL bPixels,
BOOL bPalette
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
Generates a mipmap from a single image source.
HRESULT GenerateMIPMap(
DWORD dwFlags
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
This method can be called any time after a texture is created. It will generate a MIP map of the source image down to a resolution of 1×1 by using bilinear filtering between levels. Once a MIP map has been generated, it will always be available and will be updated whenever IDirect3DRMTexture::Changed is called. When using MIP mapping, remember to change the texture quality to D3DRMTEXTURE_MIPNEAREST, D3DRMTEXTURE_MIPLINEAR, D3DRMTEXTURE_LINEARMIPNEAREST, or D3DRMTEXTURE_LINEARMIPLINEAR using IDirect3DRMDevice::SetTextureQuality. Extra MIP map levels will not be put into video memory for hardware devices unless the texture quality includes a MIP mapping type and the hardware device supports MIP mapping.
Retrieves the maximum number of colors used for rendering a Direct3DRMTexture2 object.
DWORD GetColors( );
Returns the number of colors.
This method returns the number of colors that the Direct3DRMTexture2 object has been quantized to, not the number of colors in the image from which the Direct3DRMTexture2 object was created. Consequently, the number of colors that are returned usually matches the colors that were set by calling the IDirect3DRM::SetDefaultTextureColors method, unless you used the IDirect3DRMTexture2::SetColors method explicitly to change the colors for the Direct3DRMTexture2 object.
IDirect3DRMTexture2::SetColors
Retrieves the current origin of the decal.
HRESULT GetDecalOrigin(
LONG * lplX,
LONG * lplY
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::SetDecalOrigin
Retrieves the scaling property of the given decal.
DWORD GetDecalScale( );
Returns the scaling property if successful, or -1 otherwise.
IDirect3DRMTexture2::SetDecalScale
Retrieves the size of the decal.
HRESULT GetDecalSize(
D3DVALUE *lprvWidth,
D3DVALUE *lprvHeight
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::SetDecalSize
Retrieves the transparency property of the decal.
BOOL GetDecalTransparency( );
Returns TRUE if the decal has a transparent color, FALSE otherwise.
IDirect3DRMTexture2::SetDecalTransparency
Retrieves the transparent color of the decal.
D3DCOLOR GetDecalTransparentColor( );
Returns the value of the transparent color.
IDirect3DRMTexture2::SetDecalTransparentColor
Returns an address of the image that the texture was created with.
D3DRMIMAGE * GetImage( );
Returns the address of the D3DRMIMAGE structure that the current Direct3DRMTexture2 object was created with.
Retrieves the number of shades used for each color in the texture when rendering.
DWORD GetShades( );
Returns the number of shades.
IDirect3DRMTexture2::SetShades
Initializes a Direct3DRMTexture2 object using the information in a given file.
HRESULT InitFromFile(
LPCSTR filename
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
You must have created the Direct3DRMTexture2 object to be initialized using the IDirect3DRM2::CreateTexture or IDirect3DRM2::CreateTextureFromSurface methods.
IDirect3DRMTexture2::InitFromImage, IDirect3DRMTexture2::InitFromResource2, IDirect3DRMTexture2::InitFromSurface
Initializes a texture from an image in memory.
HRESULT InitFromImage(
LPD3DRMIMAGE lpImage
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
You must have created the IDirect3DRMTexture2 object to be initialized using the IDirect3DRM2::CreateTexture or IDirect3DRM2::CreateTextureFromSurface methods.
IDirect3DRMTexture2::InitFromFile, IDirect3DRMTexture2::InitFromResource2, IDirect3DRMTexture2::InitFromSurface
Initializes a Direct3DRMTexture2 object from a specified resource.
HRESULT InitFromResource2(
HModule hModule,
LPCTSTR strName,
LPCTSTR strType
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
You must have created the IDirect3DRMTexture2 object to be initialized using the IDirect3DRM2::CreateTexture or IDirect3DRM2::CreateTextureFromSurface methods.
IDirect3DRMTexture2::InitFromFile, IDirect3DRMTexture2::InitFromImage, IDirect3DRMTexture2::InitFromSurface
Initializes a Direct3DRMTexture2 object by using the data from a given DirectDraw surface. This method performs the same as IDirect3DRMTexture::InitFromSurface.
HRESULT InitFromSurface(
LPDIRECTDRAWSURFACE lpDDS
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
You must have created the IDirect3DRMTexture2 object to be initialized using the IDirect3DRM2::CreateTexture or IDirect3DRM2::CreateTextureFromSurface methods.
IDirect3DRMTexture2::InitFromFile, IDirect3DRMTexture2::InitFromImage, IDirect3DRMTexture2::InitFromResource2
Sets the maximum number of colors used for rendering a Direct3DRMTexture2 object. This method is required only in the ramp color model.
HRESULT SetColors(
DWORD ulColors
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::GetColors
Sets the origin of the decal as an offset from the top left of the decal.
HRESULT SetDecalOrigin(
LONG lX,
LONG lY
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
The decal's origin is mapped to its frame's position when rendering. For example, the origin of a decal of a cross would be set to the middle of the decal, and the origin of an arrow pointing down would be set to midway along the bottom edge.
This method is also used to add a decal origin key to a Direct3DRMTextureInterpolator object.
IDirect3DRMTexture2::GetDecalOrigin
Sets the scaling property for a decal.
HRESULT SetDecalScale(
DWORD dwScale
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::GetDecalScale
Sets the size of the decal to be used if the decal is being scaled according to its depth in the scene.
HRESULT SetDecalSize(
D3DVALUE rvWidth,
D3DVALUE rvHeight
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
This method is also used to add a decal size key to a Direct3DRMTextureInterpolator object.
IDirect3DRMTexture2::GetDecalSize
Sets the transparency property of the decal.
HRESULT SetDecalTransparency(
BOOL bTransp
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::GetDecalTransparency
Sets the transparent color for a decal.
HRESULT SetDecalTransparentColor(
D3DCOLOR rcTransp
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
This method is also used to add a decal transparent color key to a Direct3DRMTextureInterpolator object.
IDirect3DRMTexture2::GetDecalTransparentColor
Sets the maximum number of shades to use for each color for the Direct3DRMTexture2 object when rendering. This method is required only in the ramp color model.
HRESULT SetShades(
DWORD ulShades
);
Returns D3DRM_OK if successful, or an error otherwise. For a list of possible return codes, see Direct3D Retained Mode Return Values.
IDirect3DRMTexture2::GetShades
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.