Functions |
|
RwReal | RwIm2DGetNearScreenZ (void) |
RwReal | RwIm2DGetFarScreenZ (void) |
RwBool | RwIm2DRenderLine (RwIm2DVertex *vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2) |
RwBool | RwIm2DRenderTriangle (RwIm2DVertex *vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2, RwInt32 vert3) |
RwBool | RwIm2DRenderPrimitive (RwPrimitiveType primType, RwIm2DVertex *vertices, RwInt32 numVertices) |
RwBool | RwIm2DRenderIndexedPrimitive (RwPrimitiveType primType, RwIm2DVertex *vertices, RwInt32 numVertices, RwImVertexIndex *indices, RwInt32 numIndices) |
This object exposes RenderWare' 2D Immediate Mode API.
2D Immediate Mode graphics support is provided for such basic primitives as lines and triangles. It is primarily intended for such tasks as GUI overlays, superimposing text onto a scene and other similar work.
Most developers may prefer to work with the Rt2d Toolkit for applications making intensive use of 2D rendering. This Toolkit sits on top of the 3D Immediate Mode API.
|
RwIm2DGetFarScreenZ is used to determine the screen Z value needed to be put into a 2D immediate mode vertex to place the vertex at the back of the Z-buffer range.
|
|
RwIm2DGetNearScreenZ is used to determine the screen Z value needed to be put into a 2D immediate mode vertex to place the vertex at the front of the Z-buffer range.
|
|
RwIm2DRenderIndexedPrimitive is used to render a screen space 2D immediate mode primitive defined by the given vertices. Use this function to render individual line segments, connected poly-lines, discrete triangles, triangle strips and triangle fans. Note that all vertices specified for 2D immediate mode rendering must lie within the screen space otherwise the results are unpredictable. Note that 2D immediate mode routines must initialize their required renderstate before starting to render. They must share the renderstate resource and must not make any assumptions about what the existing renderstate is. The renderstate may be queried but in practice on many platforms it is faster to just establish the required renderstate blindly. This API function should only be used between calls to RwCameraBeginUpdate and RwCameraEndUpdate.
To set up and render a 2D immediate mode polyline square with flat shading, but without Z-buffering: RwIm2DVertex square[4]; RwImVertexIndex index[5] = {0, 1, 2, 3, 0}; // Set up the vertices... RwIm2DVertexSetScreenX(&square[0], (RwReal)((220)) ); RwIm2DVertexSetScreenY(&square[0], (RwReal)((140)) ); RwIm2DVertexSetScreenX(&square[1], (RwReal)((220)) ); RwIm2DVertexSetScreenY(&square[1], (RwReal)((240)) ); RwIm2DVertexSetScreenX(&square[2], (RwReal)((420)) ); RwIm2DVertexSetScreenY(&square[2], (RwReal)((240)) ); RwIm2DVertexSetScreenX(&square[3], (RwReal)((420)) ); RwIm2DVertexSetScreenY(&square[3], (RwReal)((140)) ); RwIm2DVertexSetIntRGBA(&square[0], 255, 0, 0, 255); RwIm2DVertexSetIntRGBA(&square[1], 0, 255, 0, 255); RwIm2DVertexSetIntRGBA(&square[2], 0, 0, 255, 255); RwIm2DVertexSetIntRGBA(&square[3], 255, 255, 0, 255); // Flat shading on... RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEFLAT); // Z-buffering off.. RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void *)FALSE); // Render polyline... RwIm2DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, square, 4, index, 5); |
|
RwIm2DRenderLine is used to render a screen space 2D immediate mode line defined by the given two vertices. All vertices specified for 2D immediate mode rendering must lie within the screen space otherwise the results are unpredictable. Note that 2D immediate mode routines must initialize their required renderstate before starting to render. They must share the renderstate resource and must not make any assumptions about what the existing renderstate is. The renderstate may be queried but in practice on many platforms it is faster to just establish the required renderstate blindly. This API function should only be used between calls to RwCameraBeginUpdate and RwCameraEndUpdate.
To set up and render a 2D immediate mode line with Gouraud shading and alpha-blending: RwIm2DVertex vertex[2]; // Set up the vertices... RwIm2DVertexSetScreenX(&vertex[0], (RwReal)((20)) ); RwIm2DVertexSetScreenY(&vertex[0], (RwReal)((20)) ); RwIm2DVertexSetScreenZ(&vertex[0], (RwReal)((3276)) ); RwIm2DVertexSetRecipCameraZ(&vertex[0], (RwReal)((1.0/6.0)) ); RwIm2DVertexSetScreenX(&vertex[1], (RwReal)((620)) ); RwIm2DVertexSetScreenY(&vertex[1], (RwReal)((460)) ); RwIm2DVertexSetScreenZ(&vertex[1], (RwReal)((3276)) ); RwIm2DVertexSetRecipCameraZ(&vertex[1], (RwReal)((1.0/6.0)) ); // Opaque red... RwIm2DVertexSetIntRGBA(&vertex[0], 255, 0, 0, 255); // Semi-transparent red... RwIm2DVertexSetIntRGBA(&vertex[1], 255, 0, 0, 128); // Texturing off... RwRenderStateSet(rwRENDERSTATETEXTURERASTER, NULL); // Gouraud shading on... RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEGOURAUD); // Alpha-transparency on... RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); //Render line... RwIm2DRenderLine(vertex, 2, 0, 1); |
|
RwIm2DRenderPrimitive is used to render a screen space 2D immediate mode primitive defined by the given vertices. Use this function to render individual line segments, connected poly-lines, discrete triangles, triangle strips and triangle fans. Note that all vertices specified for 2D immediate mode rendering must lie within the screen space otherwise the results are unpredictable. The result is similar to what would be achieved with RwIm2DRenderIndexedPrimitive, but the indices are implicitly defined as (0, 1, 2, 3, ..., numVertices-1). Note that 2D immediate mode routines must initialize their required renderstate before starting to render. They must share the renderstate resource and must not make any assumptions about what the existing renderstate is. Failure to do this may result in unexpected rendering artifacts. The renderstate may be queried but in practice on many platforms it is faster to just establish the required renderstate blindly. This API function should only be used between calls to RwCameraBeginUpdate and RwCameraEndUpdate.
|
|
RwIm2DRenderTriangle is used to render a screen space 2D immediate mode triangle defined by the given three vertices. All vertices specified for 2D immediate mode rendering must lie within the screen space otherwise the results are unpredictable. Note that 2D immediate mode routines must initialize their required renderstate before starting to render. They must share the renderstate resource and must not make any assumptions about what the existing renderstate is. Failure to do this may result in unexpected rending artifacts. The renderstate may be queried but in practice on many platforms it is faster to just establish the required renderstate blindly. This API function should only be used between calls to RwCameraBeginUpdate and RwCameraEndUpdate.
RwIm2DVertex vertex[3]; //Set up the vertices... RwIm2DVertexSetScreenX(&vertex[0], (RwReal)((20)) ); RwIm2DVertexSetScreenY(&vertex[0], (RwReal)((20)) ); RwIm2DVertexSetScreenZ(&vertex[0], (RwReal)((3276)) ); RwIm2DVertexSetRecipCameraZ(&vertex[0], (RwReal)((1.0/6.0)) ); RwIm2DVertexSetScreenX(&vertex[1], (RwReal)((20)) ); RwIm2DVertexSetScreenY(&vertex[1], (RwReal)((40)) ); RwIm2DVertexSetScreenZ(&vertex[1], (RwReal)((3276)) ); RwIm2DVertexSetRecipCameraZ(&vertex[1], (RwReal)((1.0/6.0)) ); RwIm2DVertexSetScreenX(&vertex[2], (RwReal)((40)) ); RwIm2DVertexSetScreenY(&vertex[2], (RwReal)((40)) ); RwIm2DVertexSetScreenZ(&vertex[2], (RwReal)((3276)) ); RwIm2DVertexSetRecipCameraZ(&vertex[2], (RwReal)((1.0/6.0)) ); // Opaque yellow... RwIm2DVertexSetIntRGBA(&vertex[0], 255, 255, 0, 255); // Semi-transparent magenta... RwIm2DVertexSetIntRGBA(&vertex[1], 255, 0, 255, 128); // Fully-transparent cyan... RwIm2DVertexSetIntRGBA(&vertex[2], 0, 255, 255, 0); // Texturing off... RwRenderStateSet(rwRENDERSTATETEXTURERASTER, NULL); // Gouraud shading on... RwRenderStateSet(rwRENDERSTATESHADEMODE, (void *)rwSHADEMODEGOURAUD); // Alpha-transparency on... RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); // Render triangle... RwIm2DRenderTriangle(vertex, 3, 0, 1, 2); |
Converted from CHM to HTML with chm2web Pro 2.85 (unicode) |