Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This enumeration provides values that identify render states. You can set the value of a render state by calling the IDirect3DMobileDevice::SetRenderStatemethod.

Syntax

typedef enum _D3DMRENDERSTATETYPE {
  D3DMRS_FILLMODE			 = 0,
  D3DMRS_SHADEMODE			= 1,
  D3DMRS_ZWRITEENABLE		 = 2,
  D3DMRS_ALPHATESTENABLE		= 3,
  D3DMRS_LASTPIXEL			= 4,
  D3DMRS_SRCBLEND			 = 5,
  D3DMRS_DESTBLEND			= 6,
  D3DMRS_CULLMODE			 = 7,
  D3DMRS_ZFUNC				= 8,
  D3DMRS_ALPHAREF			 = 9,
  D3DMRS_ALPHAFUNC			= 10,
  D3DMRS_DITHERENABLE		 = 11,
  D3DMRS_ALPHABLENDENABLE	 = 12,
  D3DMRS_FOGENABLE			= 13,
  D3DMRS_SPECULARENABLE		 = 14,
  D3DMRS_FOGCOLOR			 = 15,
  D3DMRS_FOGTABLEMODE		 = 16,
  D3DMRS_FOGSTART			 = 17,
  D3DMRS_FOGEND				 = 18,
  D3DMRS_FOGDENSITY			 = 19,
  D3DMRS_DEPTHBIAS			= 20,
  D3DMRS_RANGEFOGENABLE		 = 21,
  D3DMRS_STENCILENABLE		= 22,
  D3DMRS_STENCILFAIL			= 23,
  D3DMRS_STENCILZFAIL		 = 24,
  D3DMRS_STENCILPASS			= 25,
  D3DMRS_STENCILFUNC			= 26,
  D3DMRS_STENCILREF			 = 27,
  D3DMRS_STENCILMASK			= 28,
  D3DMRS_STENCILWRITEMASK	 = 29,
  D3DMRS_TEXTUREFACTOR		= 30,
  D3DMRS_TEXTUREPERSPECTIVE	 = 31,
  D3DMRS_WRAP0				= 32,
  D3DMRS_WRAP1				= 33,
  D3DMRS_WRAP2				= 34,
  D3DMRS_WRAP3				= 35,
  D3DMRS_CLIPPING			 = 36,
  D3DMRS_LIGHTING			 = 37,
  D3DMRS_AMBIENT				= 38,
  D3DMRS_FOGVERTEXMODE		= 39,
  D3DMRS_COLORVERTEX			= 40,
  D3DMRS_LOCALVIEWER			= 41,
  D3DMRS_NORMALIZENORMALS	 = 42,
  D3DMRS_DIFFUSEMATERIALSOURCE  = 43,
  D3DMRS_SPECULARMATERIALSOURCE = 44,
  D3DMRS_AMBIENTMATERIALSOURCE  = 45,
  D3DMRS_COLORWRITEENABLE	 = 46,
  D3DMRS_BLENDOP				= 47,
  D3DMRS_ZENABLE				= 48,
  D3DMRS_SLOPESCALEDEPTHBIAS	= 49,
  D3DM_MAXRENDERSTATES		= 50,
  D3DMRS_FORCE_ULONG			= 0x7fffffff,
} D3DMRENDERSTATETYPE;

Elements

D3DMRS_FILLMODE

One or more members of the D3DMFILLMODEenumerated type. The default value is D3DMFILL_SOLID.

D3DMRS_SHADEMODE

One or more members of the D3DMSHADEMODEenumerated type. The default value is D3DMSHADE_GOURAUD.

D3DMRS_ZWRITEENABLE

Identifies the render state that controls whether data will be written to the depth buffer. For more information, see Writing Pixels. To enable write operations into the depth buffer, set the value for this render state to TRUE; to disable them set the value to FALSE. The default value is TRUE if EnableAutoDepthStencil was set to TRUE in the presentation parameters; otherwise it is FALSE .

D3DMRS_ALPHATESTENABLE

Identifies the render state used to control whether the alpha test logic is enabled. For more information, see Alpha Test. To enable the alpha test, set the value for this render state to TRUE; to disable the alpha test, set the value to FALSE.

D3DMRS_LASTPIXEL

Identifies whether the last pixel in a line should be drawn. To enable drawing the last pixel, set this value to TRUE; to disable drawing the last pixel, set the value to FALSE. The default value is TRUE. For more information, see Rasterization Rules.

D3DMRS_SRCBLEND

Identifies the render state that controls the blending factor for the source pixel in an alpha blending operation. For more information, see Alpha Blending. Set this render state to a value from the D3DMBLENDenumeration. Passing an illegal enumeration will return the error D3DMERR_DRIVERINVALIDCALL. The default value is D3DMBLEND_ONE.

D3DMRS_DESTBLEND

Identifies the render state that controls the blending factor for the destination pixel in an alpha blending operation. For more information, see Alpha Blending. Set this render state to a value from the D3DMBLENDenumeration. Passing an illegal enumeration will return the error D3DMERR_DRIVERINVALIDCALL. The default value is D3DMBLEND_ZERO.

D3DMRS_CULLMODE

Indicates the render state that controls Back-Face Culling. Set this render state to a value in the D3DMCULLenumeration. The default value is D3DMCULL_CCW.

D3DMRS_ZFUNC

Identifies the render state that controls the function to use for depth comparisons. For more information, see Depth Buffering. Set this render state to a value in the D3DMCMPFUNCenumeration. The default value is D3DMCMP_LESSEQUAL.

D3DMRS_ALPHAREF

Identifies the render state that sets the reference value for alpha blending operations. For more information, see Alpha Test. Set the value for this render state to a ULONG value from 0 to 255, inclusive. Setting the value outside of this range will return an error value of D3DMERR_DRIVERINVALIDCALL. The default value is 0.

D3DMRS_ALPHAFUNC

Identifies the render state used to control the function used on the input pixel's alpha value and the alpha reference value. For more information, see Alpha Test. If this function returns TRUE, the input pixel processing is allowed to proceed. If this function returns FALSE, the input pixel processing is halted and the next pixel is processed. Set this render state to a value from the D3DMCMPFUNCenumeration. Passing an illegal enumeration value will return a D3DMERR_DRIVERINVALIDCALL error value. The default value is D3DMCMP_ALWAYS.

D3DMRS_DITHERENABLE

Identifies the render state used to control dithering. For more information, see Dithering. To enable dithering, set the value for this render state to TRUE; to disable disthering, set the value to FALSE. The default value is FALSE.

D3DMRS_ALPHABLENDENABLE

Identifies the render state that controls whether alpha blending is enabled. For more information, see Alpha Blending. To enable alpha blending, set the value of this render state to TRUE; to disable alpha blending, set the value to FALSE. The default value is FALSE.

D3DMRS_FOGENABLE

Identifies the render state that controls whether fog blending is used. If the value of this render state is set to TRUE, fog blending is enabled and the input color is blended with the fog color according to the fog value at that pixel. If the value of this render state is set to FALSE, fog blending is disabled. The default value is FALSE.

This render state applies to both the vertex and the pixel fog modes.

D3DMRS_SPECULARENABLE

Indicates the render state that controls whether specular lighting calculations are made. To enable specular lighting, set this value for this render state to TRUE . If this value is set to FALSE, then only the diffuse color is computed, and the specular color for all vertices is set to 0. The default value is FALSE.

D3DMRS_FOGCOLOR

Identifies the render state that specifies the color of fog. The value for this state is a 32 bit ARGB color value. The default value is 0.

D3DMRS_FOGTABLEMODE

Indicates the render state that defines whether pixel fog will be used. For more information, see Fog. The value for this render state identifies which mathematical fog model to use, therefore the value must be taken from the D3DMFOGMODEenumeration. The default value is D3DMFOG_NONE.

D3DMRS_FOGSTART

Identifies the render state that controls where fog begins in the linear fog blending model. For more information, see D3DMFOGMODE. The value for this render state is a D3DMVALUEinterpreted as an IEEE 32-bit floating point value. The default value is 0.

D3DMRS_FOGEND

Identifies the render state that controls where fog ends in the linear fog blending model. For more information, see D3DMFOGMODE. The value for this render state is a D3DMVALUEinterpreted as an IEEE 32-bit floating point value. The default value is 0.

D3DMRS_FOGDENSITY

Identifies the render state that defines the density of fog in the exponential fog blending models. For more information, see D3DMFOGMODE. The value for this state is a D3DMVALUEinterpreted as an IEEE 32 bit floating point value. The default value is 0.

D3DMRS_DEPTHBIAS

Identifies the render state used for comparison of depth values. Set this render state to a floating point value. The default value is 0. For more information, see the description for the D3DMRS_SLOPESCALEDEPTHBIAS render state. The default value is 0.

D3DMRS_RANGEFOGENABLE

Identifies the render state that defines whether to use range-based or depth-based fog. For more information, see Fog. To use range-based fog, set the value for this render state to TRUE; to use depth-based fog, set the value to FALSE. The default value is FALSE.

D3DMRS_STENCILENABLE

Identifies the render state that controls whether the stencil buffer is enabled. For more information, see Stencil Operations. To enable the stencil buffer and stencil buffer operations, set the value for this render state to TRUE; to disable stencil buffer operations, set the value to FALSE. The default value is FALSE.

D3DMRS_STENCILFAIL

Identifies the render state that specifies which stencil operation to perform if the stencil test fails. Set this render state to a value from the D3DMSTENCILOPenumerated type. The default value is D3DMSTENCILOP_KEEP. Passing illegal values into this render state will return a D3DMERR_DRIVERINVALIDCALL error.

D3DMRS_STENCILZFAIL

Identifies the render state that specifies which stencil operation to perform if the stencil test passes and the depth test (z-test) fails. Set this render state to a value from the D3DMSTENCILOPenumerated type. The default value is D3DMSTENCILOP_KEEP. Passing illegal values into this render state will return a D3DMERR_DRIVERINVALIDCALL error.

D3DMRS_STENCILPASS

Identifies the render state that specifies which stencil operation to perform if both the stencil and the depth (z) tests pass. Set this render state to a value from the D3DMSTENCILOPenumerated type. The default value is D3DMSTENCILOP_KEEP. Passing illegal values into this render state will return a D3DMERR_DRIVERINVALIDCALL error.

D3DMRS_STENCILFUNC

Identifies the render state that specifies the comparison function to use for stencil operations. For more information, see Stencil Operations. Set this render state to a value from the D3DMCMPFUNCenumeration. Passing illegal values into this render state will return a D3DMERR_DRIVERINVALIDCALL error. The default value is D3DMCMP_ALWAYS.

D3DMRS_STENCILREF

Integer reference value for the stencil test. The default value is 0.

D3DMRS_STENCILMASK

Mask applied to the reference value and each stencil buffer entry to determine the significant bits for the stencil test. The default value is 0xFFFFFFFF.

D3DMRS_STENCILWRITEMASK

Identifies the render state that controls which bits in the stencil buffer can be written to. For more information, see Writing Pixels. Set the value of this render state to a ULONG value representing the bit mask for the stencil buffer. The default value is 0xFFFFFFFF.

D3DMRS_TEXTUREFACTOR

Color used for multiple-texture blending with the D3DMTA_TFACTOR texture-blending argument or the D3DMTOP_BLENDFACTORALPHA texture-blending operation. The associated value is a D3DMCOLORvariable. The default value is 0xFFFFFFFF.

D3DMRS_TEXTUREPERSPECTIVE

Indicates perspective-correct texture mapping. To enable perspective-correct texture mapping, set the value for this render state to TRUE; to disable it, set this value to FALSE. The default value is FALSE. For more information, see Perspective-Correct Texture Mapping.

D3DMRS_WRAP0 through D3DMRS_WRAP3

Texture-wrapping behavior for multiple sets of texture coordinates. Valid values for these render states can be any combination of the D3DMWRAPCOORD Values. These cause the system to wrap in the direction of the first, second, and third coordinates— sometimes referred to as the s, t, and r directions — for a given texture. The default value for these render states is 0 (wrapping disabled in all directions). For more information, see Texture Coordinate Wrapping.

D3DMRS_CLIPPING

Indicates the render state that controls whether primitives are clipped by the view frustum. To enable clipping, set the value for this render state to TRUE; to disable clipping, set this value to FALSE. The default value is TRUE.

D3DMRS_LIGHTING

Indicates the render state that controls whether lighting calculations are made. To enable lighting, set the value for this render state to TRUE; to disable lighting, set the value to FALSE. The default value is TRUE.

D3DMRS_AMBIENT

Ambient light color. This value is of type D3DMCOLOR. The default value is 0 (black).

D3DMRS_FOGVERTEXMODE

Indicates the render state that defines whether vertex fog will be used. For more information, see Fog. The value for this render state identifies which mathematical fog model to use, therefore the value must be taken from the D3DMFOGMODEenumeration. The default value is D3DMFOG_NONE.

D3DMRS_COLORVERTEX

TRUE to enable per-vertex color, or FALSE to disable it. The default value is TRUE. Enabling per-vertex color allows the system to include the color defined for individual vertices in its lighting calculations. The default value is TRUE.

For more information, see the descriptions for the following render states:

  • D3DMRS_DIFFUSEMATERIALSOURCE

  • D3DMRS_SPECULARMATERIALSOURCE

  • D3DMRS_AMBIENTMATERIALSOURCE

D3DMRS_LOCALVIEWER

To enable camera-relative specular highlights, set the value for this render state to TRUE; to use orthogonal specular highlights, set the value to FALSE . The default value is TRUE. Applications that use orthogonal projection should specify false.

D3DMRS_NORMALIZENORMALS

Indicates whether the driver must normalize the vertex normals sent to it. If the driver must normalize the normals, set the value for this render state to TRUE; if the application is already providing the driver with normalized normals, set the value to FALSE. The default value is FALSE.

D3DMRS_DIFFUSEMATERIALSOURCE

Indicates the diffuse color source for lighting calculations. Valid values are members of the D3DMMATERIALCOLORSOURCEenumerated type. The default value is D3DMCS_COLOR1. The value for this render state is used only if the D3DRS_COLORVERTEX render state is set to TRUE.

D3DMRS_SPECULARMATERIALSOURCE

Indicates the specular color source for lighting calculations. Valid values are members of the D3DMATERIALCOLORSOURCEenumerated type. The default value is D3DMCS_COLOR2.

D3DMRS_AMBIENTMATERIALSOURCE

Indicates the ambient color source for lighting calculations. Valid values are members of the D3DMATERIALCOLORSOURCEenumerated type. The default value is D3DMCS_MATERIAL.

D3DMRS_COLORWRITEENABLE

Indicates the render state that controls which color components will be written into a buffer. For more information, see Writing Pixels. Set the value for this render state to one or more D3DMCOLORWRITEENABLE Values. You can set multiple D3DMCOLORWRITEENABLE values by combining them with a logical bitwise OR operation when you set the value for this render state. The default value is D3DMCOLORWRITEENABLE_ALL.

D3DMRS_BLENDOP

Identifies the renders state that controls function used to do alpha blending. Set this render state to a value from the D3DMBLENDOPenumeration. Passing an illegal enumeration value will return D3DMERR_DRIVERINVALIDCALL. The default value is D3DMBLENDOP_ADD.

D3DMRS_ZENABLE

Indicates the render state that specifies the type of depth buffering to use. Set this render state to a value from the D3DMZBUFFERTYPEenumeration.

By default, the D3DMRS_ZENABLE render state is set to D3DMZB_TRUE if a depth stencil buffer was created along with the swap chains. For more information, see D3DMPRESENT_PARAMETERS. In all other cases this render state defaults to FALSE.

D3DMRS_SLOPESCALEDEPTHBIAS

Indicates the render state used to determine how much bias can be applied to co-planar primitives to reduce z fighting. For more information, see Depth Buffering. The default value is 0.

Copy Code
bias = (max * D3DMRS_SLOPESCALEDEPTHBIAS) + D3DMRS_DEPTHBIAS.

where maxis the maximum depth slope of the triangle being rendered.

D3DM_MAXRENDERSTATES

Indicates the total number of render states.

D3DMRS_FORCE_ULONG

Forces the compiler to interpret the enumeration as a ULONG value. This value is not used directly in Direct3D Mobile programming.

Requirements

Header d3dmtypes.h
Windows Embedded CE Windows CE 5.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also