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.
Page Index Toggle Pages: 1
Polygons (Read 702 times)
Polygons
Nov 23rd, 2005, 2:19am
 
Hi, whenever I create some of my polygons, they never get filled in, the fill method has been called and the points appear, but it never fills it?

import processing.opengl.*;
float x = 0;

 void setup()
 {
   size(800,600, OPENGL);
 }
 
 void draw()
 {
 translate(width/2, height/2);
 background(255);
 lights();
 rotateZ(0);
 rotateY(x);
 rotateX(0);
 //noStroke();
 scale(3);
 
 fill (120, 120, 120);
 beginShape(POLYGON);
 vertex(5, 5, 0);
 vertex(-5, 5, 0);
 vertex(-5, -5, 0);
 vertex(5, -5, 0);
 endShape();
 translate (0, 50, 18);
 //main front wing
 box(60, 5, 20);
 
 //side of wing
 fill (120, 120, 120);
 
 beginShape(POLYGON);
 vertex(30, -10, 15);
 vertex(30, 5, 15);
 vertex(30, 0, 0);
 vertex(30, 5, -15);
 vertex(30, -10, -15);
 vertex(30, -5, -5);
 vertex(30, -10, 15);
 endShape();
 
 beginShape(POLYGON);
 vertex(-30, -10, 15);
 vertex(-30, 5, 15);
 vertex(-30, 0, 0);
 vertex(-30, 5, -15);
 vertex(-30, -10, -15);
 vertex(-30, -5, -5);
 vertex(-30, -10, 15);
 endShape();
 
 //wing holders
 translate (-5, -5, 0);
 box(5, 10, 5);
 translate (10, 0, 0);
 box(5, 10, 5);
 translate (-5, -10, 0);
 
 translate (0, 0, 18);
 
 beginShape (POLYGON);
 vertex(-15, 5, -10);
 vertex(-15, 5, 15);
 vertex(-30, 5, 25);
 vertex(-35, 5, 25);
 vertex(-35, 5, 80);
 vertex(-30, 5, 80);
 vertex(-30, 5, 100);
 vertex(30, 5, 100);
 vertex(30, 5, 80);
 vertex(35, 5, 80);
 vertex(35, 5, 25);
 vertex(30, 5, 25);
 vertex(15, 5, 15);
 vertex(15, 5, -10);
 //vertex(0, 5, -30);
 endShape();
 
 fill(255, 255, 255);
 
beginShape(POLYGON);
vertex(0, 5, -30);
vertex(15, 5, -10);
vertex(10, 0, -10);
endShape();

beginShape(POLYGON);
vertex(0, 5, -30);
vertex(-15, 5, -10);
vertex(-10, 0, -10);
endShape();

beginShape(POLYGON);
vertex(10, 0, -10);
vertex(-10, 0, -10);
vertex(0, 5, -30);
endShape();

beginShape(POLYGON);
vertex(10, 0, 25);
vertex(15, 5, 25);
vertex(15, 5, -10);
vertex(10, 0, -10);
endShape();
 
beginShape(POLYGON);
vertex(-10, 0, 25);
vertex(-15, 5, 25);
vertex(-15, 5, -10);
vertex(-10, 0, -10);
endShape();

beginShape(POLYGON);
vertex(-15, 5, 25);
vertex(-15, 5, -10);
vertex(15, 5, -10);
vertex(15, 5, 25);
endShape();

beginShape(POLYGON);
vertex(-10, 0, 25);
vertex(-10, 0, -10);
vertex(10, 0, -10);
vertex(10, 0, 25);
endShape();

fill (255);
translate (0, 10, 52.5);
box (70, 20, 55);
translate (0, 0, 32.5);
box (60, 20, 30);

 
 x = x + 0.01;
 }
Re: Polygons
Reply #1 - Nov 28th, 2005, 12:54pm
 
Try building the same objects using TRIANGLES or QUADS, instead of POLYGONS..
Re: Polygons
Reply #2 - Nov 28th, 2005, 2:17pm
 
you may be getting bitten by this bug:
http://dev.processing.org/bugs/show_bug.cgi?id=111

though you also should avoid the shapes coming back around to meet themselves, because that will prevent things from being filled.
Page Index Toggle Pages: 1