Pratiksha Jhalani

Members
  • Content count

    2
  • Joined

  • Last visited

Community Reputation

101 Neutral

About Pratiksha Jhalani

  • Rank
    Newbie
  1. [quote name='mhagain' timestamp='1313108738' post='4848022'] Say you've got 2 strips, strip 1 has vertexes 0, 1, 2, 3 and strip 2 has vertexes 4, 5, 6, 7. To render them with GL_TRIANGLES you use indexes 0, 1, 2, 1, 3, 2, 4, 5, 6, 5, 7, 6 for your glDrawElements call. No need to make any changes to the vertexes. That'll do it. The number of indexes you need for each strip is always (numverts - 2) * 3 and just remember to follow the winding order rules, reversing the order for alternate tris that make up the strip. Code for writing out indexes might look something like this: [code] for (int i = 2; i < stripverts; i++) { indexes[totalindexes++] = totalverts + i - 2; indexes[totalindexes++] = (i & 1) ? (totalverts + i) : (totalverts + i - 1); indexes[totalindexes++] = (i & 1) ? (totalverts + i - 1) : (totalverts + i); } totalverts += stripverts;[/code] Then just ensure that all of your vertexes for all strips are in a single big array (or single VBO, as appropriate) and your draw call is: [code]glDrawElements (GL_TRIANGLES, totalindexes, GL_UNSIGNED_WHATEVER, indexes); // _WHATEVER is _SHORT or _INT, replace indexes with 0 for a VBO[/code] OK, it's more indexes, but indexes are much smaller than full vertexes, the duplicate vertexes will be in your cache and so won't need to be retransformed, and you'll find that the overall submission is lighter than with degenerate triangles. [/quote] do u have any sample code i m begiiner in open gl
  2. any one have sample code for triangle strip