Results 1 to 5 of 5

Thread: Create a Triangle Strip from unordered 2d points.

  1. #1
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    3

    Create a Triangle Strip from unordered 2d points.

    Hello,

    I am attempting to draw a set of points as triangle strip.

    To do this, all of the vertices should be in a vertex buffer, and the colours in a colour buffer.

    If i use a delaunay triangulation, however, this will not necessarily return a list of triangles that are in an order appropriate for correct rendering.

    So, given a std::vector<Point>.

    How is it possible to sort these points?

    Regards,

    Daniel

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,103
    A triangle mesh cannot necessarily be represented as a single triangle strip.

    And if the points used for the Delaunay triangulation correspond to anything resembling a uniform sampling of a region, it's unlikely that the resulting mesh can be represented as a single triangle strip.

    So you basically have two options: glDrawElements(GL_TRIANGLES) or convert the mesh to multiple triangle strips. I'd suggest the former unless there's a compelling reason to use strips (and the only one I can think of is that you're stuck with some existing software which requires strips).

  3. #3
    Newbie Newbie
    Join Date
    Dec 2015
    Posts
    3
    Awesome.

    So with GL_Triangles, the points do not need to be in order?

  4. #4
    Senior Member Regular Contributor
    Join Date
    May 2016
    Posts
    477
    Quote Originally Posted by MrCybin View Post
    Awesome.

    So with GL_Triangles, the points do not need to be in order?
    with glDrawArrays(GL_TRIANGLES, ...); 3 consecutive points have to build a triangle
    0, 1, 2
    3, 4, 5,
    ... etc

  5. #5
    Newbie OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,789
    With glDrawElements the order comes from the indices, but the vertices can be in any order. Obviously it's going to be more efficient if the vertices are in (at least reasonable) triangle order, but it's not a constraint.

Similar Threads

  1. Triangle Strip - Per Triangle color
    By Aliii in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-27-2013, 10:14 AM
  2. VBO Triangle Strip
    By Jeffg in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 01-08-2011, 10:01 AM
  3. Help with Triangle strip
    By Jeffg in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-30-2010, 09:52 AM
  4. triangle strip with a LINE triangle display error
    By Samme in forum OpenGL: Windows
    Replies: 22
    Last Post: 11-20-2008, 07:50 PM
  5. Triangle Strip!
    By golgoth13 in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 03-08-2006, 06:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean