Does the Java renderer support per-vertex color assignments?

Hello community,

I'm trying to use a feature that seems to be supported in the old P2D/P3D renderers, but does not seem to be working for Java. The feature is per/vertex color assignments. The sketch below demonstrates a triangle in which each vertex has a different color assigned to it. The result is a triangle with a smooth gradient that gradually changes across the entire shape. This only works when the P2D or P3D modes are enabled. The default JAVA renderer does not seem to allow per vertex color assignments. Is this a bug, or is there a different way to achieve the same. I understand the P2D/P3D renderers will eventually go away.

void setup() {
  size(500,500,P2D);
  //size(500,500);
  noStroke();
  smooth();
}

void draw() {
  background(0);
  beginShape();
  fill(255,0,0);
  vertex(100,100);
  fill(0,255,0);
  vertex(400,100);
  fill(0,0,255);
  vertex(mouseX,mouseY);
  endShape();
}

P2D c1 Java c2

Tagged:

Answers

  • Answer ✓

    It's a known missing feature in the default renderer and it's not currently a priority. In regard to P2D and P3D in the 2.0 releases, these are the future renderers for Processing. It's likely the default renderer will disappear in time and will be replaced by what is currently P2D. P2D and P3D are OpenGL renderers.

  • I hope it will be in a far future, because currently P2D is hardly usable on low end graphics cards, like those shipped in most low-cost HP computers...

  • edited November 2013

    I hope so too.

    By all means use the P2D renderer as the default option so that users have to select JAVA2D. This will enable programmers extend their sketches to use the Java2D API in the same way people used to push the bounds of the P3D and OPENGL renderers in Processing 1.5.1

  • All I know is that I see lotsa bug reports here in this forum when some1 tries anything other than JAVA2D! [..]
    In my current OS (Lubuntu 13.04), I see lotsa warning messages in the console when using P2D or P3D!!!
    I don't understand why even more engine culling is necessary. Wasn't the old P2D & P3D enough??? :(

  • Please report bugs in the P2D/P3D renderers in the issues section of the github page, and will take care of them as soon as I can. Of course contributions are very welcome!

    Concerning the warning messages in the console when using P2D or P3D on Linux, I'm aware of those. They seem to be be related to some issue in JOGL, or perhaps a mistake in the initialization code I use in the renderers, but haven't had the time to look into it. It doesn't seem to have an effect in the actual drawing, though.

    About the inability of running the new OpenGL renderers on machines with older integrated video chipsets, I'm really sorry about that. We have tried to keep the OpenGL requirements as low as possible, while still giving some access to the functionalities that have been evolving in graphics hardware over the past 5 years or so (shaders, vertex buffer objects, etc). The truth of the matter is a line has to be drawn somewhere in terms of hardware support, specially given the limited resources we currently have for development.

Sign In or Register to comment.