Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li><p><code>GL_QUAD_STRIP</code> is deprecated and not supported in the current version of OpenGL, so that's out. Plus, it's not too fast anyway - see <a href="https://stackoverflow.com/questions/6644099/what-is-so-bad-about-gl-quads">this post</a> for a good explanation of why it's no longer supported (save for compatibility purposes).</p></li> <li><p><code>GL_TRIANGLES</code> is generally a good way to go. It'll be faster than using outdated functionality. And it's faster in principle, too - quads are broken down into triangles anyway, so you save a bunch of needless work by doing it once CPU side and then saving the GPU work it would have to do. Triangles are a standard and perfectly fine way of specifying shapes.</p></li> <li><p><code>GL_TRIANGLE_STRIP</code> is faster than <code>GL_TRIANGLES</code> because it takes one point, not three, to specify each triangle after the first triangle is specified. The previous two vertices of the triangle before are used. You get connected triangles, but you also use less memory. Because you have to read less, you can process faster. <em>And</em> because your last two vertices were just specified in the last triangle, they're going to be easier to fetch in memory than two other vertices that may come from who knows where. There are also tricks for using <em>degenerate</em> triangle strips for allowing for seamless jumps between triangles.</p></li> </ul> <p>If you want the best performance of the three, <code>GL_TRIANGLE_STRIP</code> is the way to go. Unfortunately, unless your data comes already specified for use in a triangle strip, you'll have to order your vertices yourself and remember where to put your degenerate triangles. A good starting point is with height maps (ie terrain). However, optimizing other parts of your code first (eg determining whether to even draw an object) may be a better use of your time. And I may be wrong, I don't think texture use should have an impact on your choice of vertex specification.</p> <p>Edit: Here is an example of how rendering a square is done with <code>GL_TRIANGLE_STRIP</code></p> <p>Vertices: (0,0) (0,1) (1,0) (1,1)</p> <p>Triangle 1: <strong>(0,0) (0,1) (1,0)</strong> (1,1)</p> <p>Triangle 2: (0,0) <strong>(0,1) (1,0) (1,1)</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload