You first need to look at this topic
http://processing.org/discourse/yabb2/num_1248087778.htmlthen here is a solution for you.
If you need more info about texturing, just ask
Code:import processing.opengl.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*; //...
//...
GLU glu = new GLU();
void setup() {
size(800, 600, OPENGL);
}
void draw() {
PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
GL gl = pgl.beginGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); //"replace" background() call;
//these
gl.glEnable( GL.GL_BLEND ); //to make blending possible !
gl.glDisable(GL.GL_DEPTH_TEST);// to make them blended in every positions
//...revove this bunch of code by taking OCD lib per example
//LIB URL : http://www.gdsstudios.com/processing/libraries/ocd/
gl.glMatrixMode( GL.GL_PROJECTION );
gl.glLoadIdentity();
glu.gluPerspective( 45.0, (float)width/(float)height, 0.1, 10000.0 );
gl.glMatrixMode( GL.GL_MODELVIEW );
gl.glLoadIdentity();
glu.gluLookAt( 0.0, 1.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0 );
//
//A TRIANGLE
gl.glRotatef(millis()/10., 0, 1, 1);
gl.glBegin(GL.GL_TRIANGLE_FAN);
gl.glColor4f(1.0f, 0.0f, 0.0f, 0.7f); //glColor4f(r, g, b, alpha) instead of glColor3f(r, g, b)
gl.glVertex3f( 0.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f,-1.0f, 1.0f);
gl.glVertex3f( 1.0f,-1.0f, 1.0f);
gl.glEnd();
//ANOTHER TRIANGLE
gl.glRotatef(millis()/10., 1, 0, 1);
gl.glBegin(GL.GL_TRIANGLE_FAN);
gl.glColor4f(0.0f,1.0f,0.0f, 0.7f);
gl.glVertex3f( 0.0f, 1.0f, 0.0f);
gl.glVertex3f(-1.0f,-1.0f, 1.0f);
gl.glVertex3f( 1.0f,-1.0f, 1.0f);
gl.glEnd();
pgl.endGL();
}