gm-docs-parser 1.0.0

A collection of typings for GameMaker Studio 2 manual pages
Documentation
<?xml version="1.0" encoding="utf-8" ?>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head>

  <script type="text/javascript" language="JavaScript">
    //<![CDATA[
    function reDo() {
      if (innerWidth != origWidth || innerHeight != origHeight)
        location.reload();
    }
    if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
      origWidth = innerWidth;
      origHeight = innerHeight;
      onresize = reDo;
    }
    onerror = null;
  //]]>
  </script>
  <style type="text/css">/*<![CDATA[*/

    < !-- div.WebHelpPopupMenu {
      position: absolute;
      left: 0px;
      top: 0px;
      z-index: 4;
      visibility: hidden;
    }

    p.WebHelpNavBar {
      text-align: right;
    }

    -->
  
/*]]>*/</style>

  <script type="text/javascript">//<![CDATA[

    gRootRelPath = "../../../..";
    gCommonRootRelPath = "../../../..";
    gTopicId = "9.2.5.7.0_6";
  
//]]></script>

  <script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/common.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script>
  <script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script>
<script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script>
  <link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"/>
  <link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"/>
  <meta name="topic-status" content="Draft"/>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  <title>draw_vertex_texture</title>
  <meta name="generator" content="Adobe RoboHelp 2019"/>
  <link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"/>
  <meta name="rh-authors" content="Mark Alexander"/>
  <meta name="topic-comment" content="Reference for draw_vertex_texture"/>
  <meta name="rh-index-keywords" content="draw_vertex_texture"/>
  <meta name="search-keywords" content="draw_vertex_texture"/>
</head>

<body>
  <div class="topic-header rh-hide" id="rh-topic-header" onclick="rh._.goToFullLayout()">
    <div class="logo">
    </div>
    <div class="nav">
      <div class="title" title="draw_vertex_texture">
        <span>draw_vertex_texture</span>
      </div>
      <div class="gotohome" title="Click here to see this page in full context">
        <span>Click here to see this page in full context</span>
      </div>
    </div>
  </div>
  <div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div>



  <!--<div class="body-scroll" style="top: 150px;">-->
  <h1>draw_vertex_texture</h1>
  <p>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 <a href="draw_primitive_begin.htm"><tt>draw_primitive_begin()</tt></a> 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 <a href="draw_primitive_end.htm"><tt>draw_primitive_end()</tt></a>.</p>
  <p>You can also choose to draw only <i>part</i> of the texture over the surface of the primitive by setting the appropriate xtex/ytex position to sample to (these coordinates are also known as the <b>UV</b> points). This point is defined by a value between
    0 and 1 with the top left corner of the image to use being the (0,0) point and the bottom right corner being the (1,1) point. In this way you can texture a primitive with only a part of the source image asset.</p>
  <p>When drawing a textured primitive, the texture will be blended with the colour set by <a html="../colour And Blending/draw_set_colour.html"><tt>draw_set_colour</tt>. This means that to draw the texture with no blending this should be set to <tt>c_white</tt>, as shown in the example below.</a></p>
  <p class="note"><a html="../colour And Blending/draw_set_colour.html"><b>NOTE:</b> For a texture to repeat it must be a power of two in size, ie: 32x32, 128x128, etc...</a></p>
  <p> </p>
  <h4><a html="../colour And Blending/draw_set_colour.html">Syntax:</a></h4>
  <p class="code"><a html="../colour And Blending/draw_set_colour.html">draw_vertex_texture(x, y, xtex, ytex)</a></p>
  <table>
    <tbody>
      <tr>
        <th><a html="../colour And Blending/draw_set_colour.html">Argument</a></th>
        <th><a html="../colour And Blending/draw_set_colour.html">Description</a></th>
      </tr>
      <tr>
        <td><a html="../colour And Blending/draw_set_colour.html">x</a></td>
        <td><a html="../colour And Blending/draw_set_colour.html">The x coordinate of the vertex.</a></td>
      </tr>
      <tr>
        <td><a html="../colour And Blending/draw_set_colour.html">y</a></td>
        <td><a html="../colour And Blending/draw_set_colour.html">The y coordinate of the vertex.</a></td>
      </tr>
      <tr>
        <td><a html="../colour And Blending/draw_set_colour.html">xtex</a></td>
        <td><a html="../colour And Blending/draw_set_colour.html">The width of the texture sample to use.</a></td>
      </tr>
      <tr>
        <td><a html="../colour And Blending/draw_set_colour.html">ytex</a></td>
        <td><a html="../colour And Blending/draw_set_colour.html">The height of the texture sample to use.</a></td>
      </tr>
    </tbody>
  </table>
  <p> </p>
  <h4><a html="../colour And Blending/draw_set_colour.html">Returns:</a></h4>
  <p class="code"><a html="../colour And Blending/draw_set_colour.html">N/A</a></p>
  <p> </p>
  <h4><a html="../colour And Blending/draw_set_colour.html">Example:</a></h4>
  <p class="code"><a html="../colour And Blending/draw_set_colour.html">draw_set_colour(c_white);<br/>
var tex = sprite_get_texture(spr_Background, 0);<br/>
draw_primitive_begin_texture(pr_trianglestrip, tex);<br/>
draw_vertex_texture(0, 0, 0, 0);<br/>
draw_vertex_texture(640, 0, 1, 0);<br/>
draw_vertex_texture(0, 480, 0, 1);<br/>
draw_vertex_texture(640, 480, 1, 1);<br/>
draw_primitive_end();</a></p>
  <p><a html="../colour And Blending/draw_set_colour.html">The above code will draw a 4 vertex triangle strip (making a rectangle) textured with the texture held in the &quot;tex&quot; variable, and the whole texture will be used to cover the completed primitive.</a></p>
  <p> </p>
  <p> </p>
  <p> </p>
  <div class="footer">
    <div class="buttons">
      <div class="clear">
        <div style="float:left">Back: <a href="Primitives_And_Vertex_Formats.htm">Primitives And Vertex Formats</a></div>
        <div style="float:right">Next: <a href="draw_vertex_texture_colour.htm">draw_vertex_texture_colour</a></div>
      </div>
    </div>
    <h5>© Copyright YoYo Games Ltd. 2020 All Rights Reserved</h5>
  </div>
  <!-- KEYWORDS
draw_vertex_texture
-->
  <!-- TAGS
draw_vertex_texture
-->

</body></html>