I have a compicated algorithm that gives me à lot of triangles (3D scene)… the problem is that some times it gives me 6 points for a rectangle… and we know that I need only 4 points (using glBegin(GL_TRIANGLE_STRIP)) so how can I do to reoganise my points (triangle) to have minimum points possible (for better performance and less momory)
Partition your trinagles into co-planar sets. Within each set, combine shapes, convert trinagles to general polygons, by recursively removing adjacent edges. Apply a minimal triangulation to each polygon.
For help on any step, see a Computation Geometry book. (Or post back questions here.)
Originally posted by ybenaabud:
…the problem is that some times it gives me 6 points for a rectangle…
How much often does this happen? I wouldn’t mind it unless you’re wasting more than 1kTri and you’re geometry limited.
Before starting on this, are you sure this optimization will pay off in the short run? In the long run?
By the way, how did you realize that and why? Sometimes it’s right to have vertices when they’re not supposed to be.