Bug 1359 : OpenGL jitter
Last modified: 2010-06-05 02:16




Status:
ASSIGNED
Resolution:
-
Priority:
P2
Severity:
normal

 

Reporter:
sonic
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-10-22 11:47
Using the OpenGL renderer results in curves with occasional 'jumping'
lines. Switching to the default renderer eliminates the problem. I'm using
Processing 1.0.9 on a Mac Pro quad core tower, OS 10.5.8, ATI Radeon HD
2600 XT graphics card. (You might have to watch for a couple minutes to see
the behavior.)

import processing.opengl.*;

void setup() {
size(720, 720, OPENGL);
frameRate(40);
smooth();
}

float a = random(-1, 1);
float b = random(-1, 1);
float c = random(-1, 1);
float d = random(-1, 1);
float e = random(-1, 1);
float f = random(-1, 1);
float g = random(-1, 1);
float h = random(-1, 1);

void draw() {
background(75, 60, 85);

a = a + .002;
b = b + .0025;
c = c + .001;
d = d + .0015;
e = e + .0005;
f = f + .003;
g = g + .0035;
h = h + .0015;

noStroke();
fill(20, 220);
curve(width/2+sin(b)*(width/2+100), width/2+sin(c)*(width/2+100),
width/2+sin(d)*(width/2+100), width/2+sin(e)*(width/2+100),
width/2+sin(f)*(width/2+100), width/2+sin(g)*(width/2+100),
width/2+sin(h)*(width/2+100), width/2+sin(a)*(width/2+100));
}
Additional Comment #1 From fry 2010-02-17 19:25
what happens, exactly? i wasn't able to reproduce the problem.
Additional Comment #2 From sonic 2010-02-19 01:59
(In reply to comment #1)
>
>
>
> Additional Comment #1 From
> fry
> 2010-02-17 19:25
>
> <!--
> addReplyLink(1); //-->[reply]
>
>
>
>
>
>
> what happens, exactly? i wasn't able to reproduce the problem.
>
>

The lines, instead of flowing smoothly, jitter, briefly jumping back and
forth between and old and new position. I'll post a version with more lines
- maybe it will become more clear. And as I said, you may have to watch
for a while. My colleague has the same problem and for that reason has
stopped using OpenGL.

import processing.opengl.*;

void setup() {
size(720, 720, OPENGL);
frameRate(40);
smooth();
}

float a = random(-1, 1);
float b = random(-1, 1);
float c = random(-1, 1);
float d = random(-1, 1);
float e = random(-1, 1);
float f = random(-1, 1);
float g = random(-1, 1);
float h = random(-1, 1);

void draw() {
background(75, 60, 85);

a = a + .002;
b = b + .0025;
c = c + .001;
d = d + .0015;
e = e + .0005;
f = f + .003;
g = g + .0035;
h = h + .0015;

noStroke();
fill(20, 220);
curve(width/2+sin(b)*(width/2+100), width/2+sin(c)*(width/2+100),
width/2+sin(d)*(width/2+100), width/2+sin(e)*(width/2+100),
width/2+sin(f)*(width/2+100), width/2+sin(g)*(width/2+100),
width/2+sin(h)*(width/2+100), width/2+sin(a)*(width/2+100));
curve(width/2+sin(c)*(width/2+100), width/2+sin(d)*(width/2+100),
width/2+sin(e)*(width/2+100), width/2+sin(f)*(width/2+100),
width/2+sin(g)*(width/2+100), width/2+sin(h)*(width/2+100),
width/2+sin(a)*(width/2+100), width/2+sin(b)*(width/2+100));
curve(width/2+sin(d)*(width/2+100), width/2+sin(e)*(width/2+100),
width/2+sin(f)*(width/2+100), width/2+sin(g)*(width/2+100),
width/2+sin(h)*(width/2+100), width/2+sin(a)*(width/2+100),
width/2+sin(b)*(width/2+100), width/2+sin(c)*(width/2+100));
curve(width/2+sin(e)*(width/2+100), width/2+sin(f)*(width/2+100),
width/2+sin(g)*(width/2+100), width/2+sin(h)*(width/2+100),
width/2+sin(a)*(width/2+100), width/2+sin(b)*(width/2+100),
width/2+sin(c)*(width/2+100), width/2+sin(d)*(width/2+100));
}
Additional Comment #3 From fry 2010-02-19 10:18
how about making a video of it (use saveFrame() to make an image sequence,
then movie-ify them with quicktime 7) so you can point out where the
problem is?
Additional Comment #4 From sonic 2010-02-20 10:33
OK, I've done that. It should be obvious from watching these two identical
sequences, one done with OpenGL and the other with the default renderer.

http://www.mti.dmu.ac.uk/~rherrema/graphics/OpenGL.mov

http://www.mti.dmu.ac.uk/~rherrema/graphics/Default.mov
Additional Comment #5 From fry 2010-02-20 11:04
That looks like a clipping problem--that some of the triangles are actually
flying past the camera and going missing. Because of their long distances
toward you, that's why you get the flicker. In P3D, you don't see it,
because P3D doesn't do clipping properly. OpenGL does clipping, so your
geometry is getting chopped up (like it should, really).

A glance at your code looks like that's probably the case, and that you
actually need to translate backwards from z=0:
http://processing.org/reference/environment/#Coordinates
Additional Comment #6 From sonic 2010-02-20 12:59
(In reply to comment #5)
>
>
>
> Additional Comment #5 From
>
> fry
> 2010-02-20 11:04
>
> <!--
> addReplyLink(5); //-->[reply]
>
>
>
>
>
>
> That looks like a clipping problem--that some of the triangles are
actually
> flying past the camera and going missing. Because of their long distances
> toward you, that's why you get the flicker. In P3D, you don't see it,
> because P3D doesn't do clipping properly. OpenGL does clipping, so your
> geometry is getting chopped up (like it should, really).
>
> A glance at your code looks like that's probably the case, and that you
> actually need to translate backwards from z=0:
> http://processing.org/reference/environment/#Coordinates
>
>

Actually, I do see the flicker when I use P3D. It's only in JAVA2D that I
don't see it.

I don't understand what you mean by clipping (in audio it means you've
exceeded the dynamic range of the system), nor what you mean when you say
'to translate backwards from z=0. Can you explain or point me in the right
direction? Of course, my primary goal is simply to produce the smoothest
graphics possible.

Thanks.
Additional Comment #7 From fry 2010-02-20 13:16
Sorry--I misspoke. You're running into something else. I'll take a look
into it.
This bug is now being tracked here.