OpenGL always draws lines on top

edited May 2016 in Using Processing

When I use the OpenGL renderer in size(), Processing always draws my lines on top of everything else, regardless of code order.

Here is a simple test sketch to show you what I mean:

import processing.opengl.*; // I don't know if import is even needed, but it has no effect on the appearance

void setup(){
  size(600, 600, OPENGL);
}

void draw(){
  translate(width/2, height/2);
  background(255);

  noFill();
  stroke(0,0,255);

  line(0,0,200,200);

  noStroke();

  fill(0,255,0);
  ellipse(0,0,200,200);
    fill(255,0,0);
  ellipse(0,0,100,100);
} 

The line should appear behind the two circles, but it is in front. It happens in Processing 3 and 2.2.1, too. Am I missing something? I haven't found any information regarding this issue elsewhere, so I wonder if anyone else experienced it.

Tagged:

Answers

  • Answer ✓

    This has come up before read this discussion

  • edited May 2016

    Thanks quark, since "hint(DISABLE_OPTIMIZED_STROKE);" is incredibly slow I decided to just use filled contours instead of stroke as suggested in the thread.

Sign In or Register to comment.