We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Polygon tessellation problems
Page Index Toggle Pages: 1
Polygon tessellation problems (Read 656 times)
Polygon tessellation problems
Jan 13th, 2008, 2:54pm
 
Hi.

I'm having problems with triangulation (or tessellation, or whatever it's called) while working in OpenGL or P3D. I get incompletely filled shapes. No problems when switching back to 2D. I'm working with contour coordinates coming off-the-fly from OpenCV, so I can't solve the problem at the source.

I've already read through these bug reports:

#97 (http://dev.processing.org/bugs/show_bug.cgi?id=97)

#111 (http://dev.processing.org/bugs/show_bug.cgi?id=111)

#547 (http://dev.processing.org/bugs/show_bug.cgi?id=547)

While all of these cover this problem, none of their solutions work. Setting z=0 doesn't seem to work, nor does slightly offsetting the z-coordinates, etc. There was also the following thread discussing the same topic:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114158993

Here's the smallest shape I could record to shows the problem. Note how the background peeks through if you're in OpenGL, but doesn't if you're not.

Code:
import processing.opengl.*;

float[] points = {
277.5, 247.91666, 277.5, 249.99998, 272.5, 254.16666, 265.0, 254.16666, 272.5, 254.16666, 275.0, 252.08333, 280.0, 252.08333, 285.0, 256.25, 280.0, 260.41666, 275.0, 260.41666, 272.5, 262.5, 267.5, 262.5, 265.0, 264.5833, 262.5, 264.5833, 262.5, 266.66666, 260.0, 268.75, 257.5, 268.75, 262.5, 268.75, 265.0, 270.8333, 260.0, 275.0, 257.5, 275.0, 252.5, 270.8333, 250.0, 270.8333, 252.5, 272.91666, 250.0, 275.0, 250.0, 287.5, 252.5, 289.5833, 250.0, 291.66666, 252.5, 293.75, 252.5, 295.8333, 255.0, 297.91666, 255.0, 302.0833, 257.5, 302.0833, 260.0, 304.16666, 260.0, 310.41666, 262.5, 312.5, 262.5, 318.75, 262.5, 316.66666, 267.5, 312.5, 267.5, 308.3333, 275.0, 302.0833, 277.5, 304.16666, 280.0, 304.16666, 282.5, 302.0833, 282.5, 291.66666, 280.0, 289.5833, 280.0, 277.0833, 282.5, 275.0, 282.5, 270.8333, 285.0, 268.75, 285.0, 266.66666, 287.5, 264.5833, 282.5, 260.41666, 282.5, 258.3333, 285.0, 256.25, 287.5, 256.25, 290.0, 254.16666, 292.5, 254.16666, 295.0, 252.08333, 292.5, 249.99998, 290.0, 249.99998, 287.5, 252.08333, 285.0, 252.08333, 282.5, 249.99998, 280.0, 252.08333, 277.5, 249.99998};

//size(600,600);
size(600,400,OPENGL);

beginShape(POLYGON);
for(int i=0; i<points.length; i+=2) {
vertex(points[i], points[i+1]);
}
endShape();
Re: Polygon tessellation problems
Reply #1 - Jan 13th, 2008, 5:52pm
 
The built-in tessellator/triangulator may have problems with self-intersecting polygons, you might try this approach: (the trade-off is speed, of course)

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1197755830

Page Index Toggle Pages: 1