RenderWare Graphics contains a set of global state variables that are used to control rendering. Some of these variables are simple boolean switches such as whether to perform Z-buffer tests, some are integer types such as texture addressing mode, or the color used for fogging, and others are pointers to objects such as the current RwRaster to use for texturing in immediate mode.
All renderstate values are set and queried through two functions,
These take, as parameters, an RwRenderState identifier, and an appropriate value or pointer (cast to void *). Refer to the RwRenderState table for the different render states that can be controlled.
Most render states are truly global and affect nearly all rendering pipelines. These include back/front face cull mode, z buffer modes, fog modes, and frame buffer blending modes. Any pipelines that do override these states will restore them on completion. Other renderstates, such as texture raster, filtering, and addressing are frequently changed within pipelines (based on RwTexture objects for instance) and are not restored. These must always be set explicitly when rendering in immediate mode.
Cross-platform support
Since the render states must usually map to hardware states, they are not universally supported on all platforms, nor can they provide complete access to the hardware state of a particular platform. In the cases where a render state or a particular value is not supported, the RwRenderStateSet function will return FALSE. Refer to the platform specific documentation for details of unsupported render states, and also additional renderstate functions which might be available for controlling hardware specific features.
|
|
RwAlphaTestFunction represents the comparison functions available for an alpha test. The function may be selected via the RwRenderState setting rwRENDERSTATEALPHATESTFUNCTION.
|
|
|
RwBlendFunction represents the options available when changing the RwRenderState setting for rwRENDERSTATESRCBLEND and rwRENDERSTATEDESTBLEND. The values are factors used to modulate either the source or destination pixel color when blending to the frame buffer. Note the some combinations are not allowed on certain platforms (see platform specific restrictions). In the following list, the factors applied to each color component are listed explicitly. A subscript s refers to a source value while a subscript d refers to a destination value. Note that blending in the alpha channel is only applicable when the frame buffer actually contains alpha, and that the precise operation is platform specific. For instance, the source alpha value might simply be written to the alpha channel with no blending.
|
|
|
RwCullMode represents the options available for culling polygons during rendering. The cull mode may be set via the RwRenderState setting rwRENDERSTATECULLMODE. |
|
|
RwFogType represents the fog modes available when setting the RwRenderState rwRENDERSTATEFOGTYPE. Note that a particular platform may not support all of these modes (see platform specific restrictions). |
|
|
RwRenderState represents the global state variables that control rendering. These may be set and queried using the RwRenderStateSet and RwRenderStateGet functions respectively. Refer to the RwRenderState Overview for an overview of this system.
|
|
|
RwShadeMode represents the available shading modes that may be set using the RwRenderState rwRENDERSTATESHADEMODE. |
|
|
RwStencilFunction represents the comparison functions available for a stencil test. The function may be selected via the RwRenderState setting rwRENDERSTATESTENCILFUNCTION.
|
|
|
RwStencilOperation represents the stencil operations that may be performed depending on the results of stencil/z-buffer tests. The operation may be set for the various tests via the RwRenderState settings rwRENDERSTATESTENCILFAIL, rwRENDERSTATESTENCILZFAIL and rwRENDERSTATESTENCILPASS.
|
|
|
RwTextureAddressMode represents the addressing modes available when mapping textures to polygons using UV texture coordinates. This may be set in immediate mode via the RwRenderState rwRENDERSTATETEXTUREADDRESS, or via RwTextureSetAddressing for an RwTexture object. |
|
|
RwTextureFilterMode represents the texture filtering modes that may be set using the RwRenderState rwRENDERSTATETEXTUREFILTER in immediate mode, or RwTextureSetFilterMode in retained mode. |
|
||||||||||||
|
RwRenderStateGet queries the value of a renderstate element.
RwShadeMode shadeMode;
RwBool zTest;
RwRenderStateGet(rwRENDERSTATESHADEMODE, (void *)&shadeMode);
RwRenderStateGet(rwRENDERSTATEZTESTENABLE, (void *)&zTest);
|
|
||||||||||||
|
RwRenderStateSet is used to set the value of a particular renderstate element.
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEGOURAUD); RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)raster); Many of the renderstates may not be supported on certain platforms and this function will return FALSE in such cases. It is recommended that during development you check the return value to check for unsupported states or values. Refer to the platform specific documentation for more details of unsupported states, and also for any details of any platform specific renderstate functions.
|
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:53 2004.
Send Feedback