Begins the process of defining a textured primitive in 3D.


d3d_primitive_begin_texture(kind, tex)

Argument Description
kind The kind of primitive you are going to draw.
tex The texture to use with the primitive.

Returns: N/A


This function must be called before you define the vertexes for a textured primitive. You must give the kind of primitive to use (see d3d_primitive_begin for more information) and the texture to use, which is a sprite or background resource. One thing you must realize is that 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.

Note:If the texture has to repeat over the primitive, the source texture must be a power of 2 in size (eg: 8x8, 128x128, 256x256 etc...), otherwise you can use any size.


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);

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
© Copyright YoYo Games Ltd. 2018 All Rights Reserved