Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : How to port old PGraphicsOpenGL code to Processing 2 alpha - Additive Blending

$
0
0
hey guys i'm porting over some code from processing 1 -> 2 and running into a funny additive blending issue...



  1. //in my main draw i'm calling

  2.   PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
  3.   GL2 gl = pgl.beginPGL().gl.getGL2();

  4.   gl.glDisable(GL2.GL_DEPTH_TEST);
  5.   gl.glEnable(GL2.GL_BLEND);
  6.   gl.glBlendFunc(GL2.GL_SRC_ALPHA, GL2.GL_ONE);

  7.  //...

  8.   //and then drawing a particle system that involves a bunch of
  9. void render() {

  10.     pushMatrix();
  11.     translate(loc.x, loc.y, loc.z);

  12.     noStroke();

  13.     beginShape(TRIANGLE_FAN);
  14.     fill(255, 255, 255, 50);
  15.     vertex(0, 0);
  16.     fill(171, 124, 78, 0);
  17.     for (float j=0; j<=TWO_PI; j+=TWO_PI/12) {
  18.       vertex( 0+lineWidth*cos(j), 0+lineWidth*sin(j) );
  19.     }
  20.     endShape();

  21.     popMatrix();
  22. }

  23. //...

  24. //and then ending the main draw with
  25. pgl.endPGL();

has anyone run into this before and/or do you have any idea what might be causing the issue? maybe i need to switch to an image and use the new blend() function? 


Viewing all articles
Browse latest Browse all 1768

Trending Articles