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 › strange diagonal line
Page Index Toggle Pages: 1
strange diagonal line (Read 814 times)
strange diagonal line
Feb 5th, 2010, 7:07am
 
Hi,
when i'm using P3D with smooth(), there is a strange diagonal line appears in the sketch window. Can anyone help me? This is a problem code:
Code:

void setup()
{
size(640,480,P3D);
smooth();
}

void draw() {
 background(0);
 beginShape(QUADS);
 fill(#FFFFFF);
 vertex(0,0);
 vertex(width,0);
 fill(#11172C);
 vertex(width,height);
 vertex(0,height);
 endShape();
}


if i remove smooth() then line disappears.
Re: strange diagonal line
Reply #1 - Feb 5th, 2010, 7:12am
 
your quad is made out of triangles. the diagonal line, is the little gap between these two triangles, that appears when using smooth. cause not only the outer edges get smoothed but also the edge of the two triangles.

you could do it like that and start with the smooth after you have drawn the background gradient shape :

void setup()
{
size(640,480,P3D);

}

void draw() {
 background(0);
 noSmooth();
 beginShape(QUADS);
 fill(#FFFFFF);
 vertex(0,0);
 vertex(width,0);
 fill(#11172C);
 vertex(width,height);
 vertex(0,height);
 endShape();
 smooth();
}

Re: strange diagonal line
Reply #2 - Feb 5th, 2010, 7:19am
 
thank you!
Page Index Toggle Pages: 1