Bug 390 : curveVertex / bezierVertex don't draw properly in 0116+
Last modified: 2006-11-11 09:39




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
st33d
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2006-09-11 15:40
curveVertex and bezierVertex are not rendering properly in P3D and OPENGL.
bezierVertex fills in oddly and curveVertex doesn't work at all.

curveVertex demonstration:

import processing.opengl.*;
Vector coords;
void setup(){
size(200, 200, OPENGL); // change to JAVA2D for working version
coords = new Vector();
coords.add(new Point(10, 10));
smooth();
}
void draw(){
background(150);
stroke(0,255,0);
fill(255);
beginShape(POLYGON);
for(int i = 0; i < coords.size(); i++){
Point temp = (Point)coords.get(i);
curveVertex(temp.x, temp.y);
ellipse(temp.x, temp.y, 10, 10);
}
endShape();
}
void mousePressed(){
coords.add(new Point(mouseX, mouseY));
}
class Point{
float x, y;
Point(float tx, float ty){
x = tx;
y = ty;
}
}

bezierVertex demonstration:

import processing.opengl.*;
void setup(){
size(200, 200, OPENGL); // change to JAVA2D for working version
}
void draw(){
background(150);
bezierEllipse(100, 100, 100);
}
void bezierEllipse(float x, float y, float radius){
beginShape(POLYGON);
vertex(x + radius, y);
bezierVertex(x + radius, y + (radius * 0.5), x + (radius * 0.5), y +
radius, x, y + radius);
bezierVertex(x - (radius * 0.5), y + radius, x - radius, y + (radius *
0.5), x - radius, y);
bezierVertex(x - radius, y - (radius * 0.5), x - (radius * 0.5), y -
radius, x, y - radius);
bezierVertex(x + (radius * 0.5), y - radius, x + radius, y - (radius *
0.5), x + radius, y);
endShape();
}

The PC I'm using is OPENGL friendly (unlike some). Not tested on Mac - no
access. curveVertex() behaviour is unchanged even using curveVertex(x, y,
z), not tested (x, y, z) with bezierVertex. No workaround as of yet - keen
to hear of one (this bug has killed my project's live aspect - thank god
I'm only doing prints just yet).

Not tested in earlier versions yet either - internet access complicated
right now.
Additional Comment #1 From fry 2006-09-13 13:26
this is a known tessellation problem, but thanks for the examples. the
problem is that the points get doubled-up with curves, causing the
tessellator to get confused as the shape is turned into triangles. will get
it fixed for a future release.
Additional Comment #2 From fry 2006-10-10 18:29
*** Bug 410 has been marked as a duplicate of this bug. ***
Additional Comment #3 From fry 2006-11-02 04:58
*** Bug 427 has been marked as a duplicate of this bug. ***
Additional Comment #4 From fry 2006-11-05 05:39
turns out this is actually two problems. the one that keeps getting
reported is a regression in 0116+ which i've just found and fixed for 0120.

there are still general problems with filling that are covered by bug #97
and bug #111, but i think i'll be able to get those fixed for 0120 as well.
Additional Comment #5 From st33d 2006-11-11 08:51
The curveVertex demo I supplied still doesn't work in 121.

bezierVertex works fine thanks (top job).

reason: ellipse() breaks the beginDraw() routine in OPENGL / P3D but not in
JAVA2D. Comment out the ellipse() command from my example to see it
suddenly work. After a quick test I've found that point() and rect() also
break beginDraw().

patch: Overcompensation. Keep all drawing routines and functions at arms
length from each other.

I guess it depends on which direction you want to take it. This could
either be a bug now or the way you want Processing to work. It means
longer, slower code, but more reliable?
Additional Comment #6 From fry 2006-11-11 09:39
that's not a bug, you cannot use shapes inside a beginShape() block, and
that's not something we'll be changing before 1.0.

i don't know why that's no longer listed in the reference, but i'll add it
back now. i've had an item on core/todo.txt to improve the error messages
for that, but haven't implemented yet (or shut it off explicitly for JAVA2D).