Back to main page

Draw

This interface is like the post effect interface but for draw shaders to make it easy to draw geometrical shapes, write text and other things that only need to update a small part of a draw surface.

The drawing quad is defined using the center, Y axis and X axis. the center is defined in X and Y relative to the output draw surface from -1 to +1 or outside of the range to place the center outside of the image. Each axis is defined as X,Y offsets from the center. The local coordinate system inside the quad goes from -1 to +1 and no pixels can be drawn outside of the quad.

To cover the whole output, place the center at (0,0), the X axis at (1,0) and the Y axis at (0,1). To mirror it, just negate an axis since there is no backface culling when rendering the quad. You might have to convert from a game specific coordinates system to handle different aspect ratios.

void Draw_RenderQuad(int OutputSurface, int DrawShader, float Center_X, float Center_Y, float XAxis_X, float XAxis_Y, float YAxis_X, float YAxis_Y, int FilterType);

Filter type 0 is no filtering so that all 4 channels cover the old ones.

Filter type 1 is alpha filtering so that the returned alpha affect how much the RGB channels are changed.

OutputSurface must refer to a valid draw surface that is not the final draw surface and DrawShader must refer to a valid shader loaded as a draw shader. The output surface may not be an input surface even if it has double buffering because we don't draw to the entire surface. FilterType must be a valid index for a filter.

Render DrawShader to OutputSurface with the given input from the other methods. All input is set to default values.

void Draw_GiveInputSurface(int Index, int DrawSurfaceOrTexture);

0 ≤ Index ≤ 15, drawSurfaceOrTexture must refer to a valid draw surface or texture.

Inserts the DrawSurfaceOrTexture at Index in the input to Draw_RenderQuad.

void Draw_GiveInputVector(int Index, float X, float Y, float Z, float W);

The default value is (0,0,0,0).

The most common mistake with this call is to forget that the first argument is the index and not another float.

0 ≤ Index ≤ 15.

Places (X,Y,Z,W) at Index in the input to Draw_RenderQuad.

void Draw_GiveInputColor(float R, float G, float B, float A);

The default value is (1,1,1,1).

Set the color to (R,G,B,A) in the input to Draw_RenderQuad.

void Draw_GiveInputSourceRectangleUV1(float MinU, float MaxU, float MinV, float MaxV);

The default value is (0,1,0,1).

Set the source rectangle of UV1 to (MinU,MaxU,MinV,MaxV) in the input to Draw_RenderQuad.

void Draw_GiveInputSourceRectangleUV2(float MinU, float MaxU, float MinV, float MaxV);

The default value is (0,1,0,1).

Set the source rectangle of UV2 to (MinU,MaxU,MinV,MaxV) in the input to Draw_RenderQuad.