d3d_vertex_texture_colour(x, y, z, xtex, ytex, col, alpha)
Argument | Description |
---|---|
x | The x coordinate of the vertex. |
y | The y coordinate of the vertex. |
z | The z coordinate of the vertex. |
xtex | Starting x coordinate within the texture. |
ytex | Starting y coordinate within the texture. |
col | The colour to blend with the texture at this vertex (-1 or c_white for no blending). |
alpha | The alpha to draw this vertex with (0-1). |
Returns: N/A
This function defines the position of a textured vertex for a primitive. The final look of the primitive will depend on the primitive type chosen to draw (See
d3d_primitive_begin for more information), the order with which you add the vertexes to it, the position of the start point you set for the texture and the colour and alpha values that you have set. To
maintain the texture appearance while changing only the alpha, a value of -1 (or c_white) may be used for the colour argument. To end and draw the primitive you must call
d3d_primitive_end.
Note: In a texture the position (0,0) is the top-left corner, but often when using projections the bottom-left corner is (0,0). In such a case you might need to flip the texture vertically.
var tex;
tex = background_get_texture(back);
d3d_primitive_begin_texture(pr_trianglelist, tex);
d3d_vertex_texture_colour(0, 480, 0, 0, 0, c_blue, 1);
d3d_vertex_texture_colour(640, 480, 0, 1, 0, c_red, 1);
d3d_vertex_texture_colour(640, 480, 1000, 1, 1, c_green, 1);
d3d_vertex_texture_colour(0, 480, 1000, 0, 1, c_fuchsia, 1);
d3d_primitive_end();
The above code will draw a 4 vertex triangle list textured with the texture held in the "tex" variable. Each of the 4 vertexes will be blended with a different colour.