d3d_vertex_texture

Defines a vertex for a textured primitive in 3D.

Syntax:

d3d_vertex_texture(x, y, z, xtex, ytex)


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.


Returns: N/A


Description

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 and the position of the start point you set for the texture. 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.


Example:

var tex;
tex = background_get_texture(back);
d3d_primitive_begin_texture(pr_trianglelist, tex);
d3d_vertex_texture(0, 480, 0, 0, 0);
d3d_vertex_texture(640, 480, 0, 1, 0);
d3d_vertex_texture(640, 480, 1000, 1, 1);
d3d_vertex_texture(0, 480, 1000, 0, 1);
d3d_primitive_end();

The above code will draw a 4 vertex triangle list textured with the texture held in the "tex" variable.


Back: 3D Drawing
Next: d3d_vertex_texture_colour
© Copyright YoYo Games Ltd. 2018 All Rights Reserved