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 › fill error with bezierVertex
Page Index Toggle Pages: 1
fill error with bezierVertex (Read 426 times)
fill error with bezierVertex
Apr 9th, 2006, 11:13pm
 
hey,
i'm getting a strange fill error - on the left is when rendered in opengl, and on the right, with the default renderer (java2d). the sections that are meant to be white are not getting filled in opengl. i've tried messing about with the direction (clock/anti) of the ordering, plus placement of the bezier within the vertices

...

here's the code (i tried using 'format discourse' but the message ended up too long):
Quote:

import processing.opengl.*;

void setup() {
 size(200, 200, OPENGL);
 background(0);
}

void draw() {
// depth 1, top left
fill(0,255,0);
rect((width/2)-75, (height/2)-75, 75, 75);
noFill();
//
// depth 2, top right
fill(255,255,0);
rect((width/2), (height/2)-75, 75, 75);
noFill();
//
// depth 3, bottom left
fill(0,0,255);
rect((width/2)-75, (height/2), 75, 75);
noFill();
//
// depth 4, bottom right
fill(255,0,255);
rect((width/2), (height/2), 75, 75);
noFill();


//highlights
//
//depth1
fill(255);
beginShape(POLYGON);
vertex((width/2), (height/2)-75);
vertex((width/2)-75, (height/2)-75);
vertex((width/2)-75, (height/2)-75+((float)75/2));
bezierVertex((width/2)-75, (height/2)-75+((float)75/2),


(width/2)-75+((float)75/2), (height/2)-75+((float)75/5),
               (width/2), (height/2)-75+((float)75/4));
vertex((width/2), (height/2)-75+((float)75/4));


endShape();
noFill();
//
//depth2
fill(255);
beginShape(POLYGON);
vertex((width/2)+75, (height/2)-75);
vertex((width/2)+75, (height/2)-((float)75/2));
bezierVertex((width/2)+75, (height/2)-((float)75/2),


(width/2)+((float)75/2), (height/2)-75+((float)75/5),


(width/2), (height/2)-75+((float)75/4));
vertex((width/2), (height/2)-75+((float)75/4));
vertex((width/2), (height/2)-75);
endShape();
noFill();
//
//depth3
fill(255);
beginShape(POLYGON);
vertex((width/2)-75, (height/2)+75-((float)75/2));
bezierVertex((width/2)-75, (height/2)+75-((float)75/2),


(width/2)-((float)75/2), (height/2)+75-((float)75/5),
               (width/2), (height/2)+75-((float)75/4));
vertex((width/2), (height/2)+75-((float)75/4));
vertex((width/2), (height/2)+75);
vertex((width/2)-75, (height/2)+75);
endShape();
noFill();
//
//depth4
fill(255);
beginShape(POLYGON);
vertex((width/2), (height/2)+75);
vertex((width/2)+75, (height/2)+75);
vertex((width/2)+75, (height/2)+75-((float)75/2));
bezierVertex((width/2)+75, (height/2)+75-((float)75/2),


(width/2)+((float)75/2), (height/2)+75-((float)75/5),


(width/2), (height/2)+75-((float)75/4));
vertex((width/2), (height/2)+75-((float)75/4));
endShape();
noFill();
}


any ideas
Page Index Toggle Pages: 1