(Processing) Additive blending

| No Comments | No TrackBacks
This is a test of additive blending and the code is basically a copy from flight404.com.
The first small step in the world of openGL.




import processing.opengl.*;
import javax.media.opengl.*;

PGraphicsOpenGL pgl;
GL gl;
PImage pimage;

void setup() {
   size(400, 400, OPENGL);
   background(0);
   pimage = loadImage("img.png");
}

void draw() {
  pgl = (PGraphicsOpenGL) g;
  gl = pgl.beginGL();
  gl.glDisable(GL.GL_DEPTH_TEST);
  gl.glEnable(GL.GL_BLEND);
  gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE);
  pgl.endGL();
  image(pimage,random(400),random(400));
}

No TrackBacks

TrackBack URL: http://www.kynd.info/cp-bin/mt/mt-tb.cgi/53

Leave a comment