title: Draw two crossed triangles in OpenGL
body: <p>I'm doing my first steps with OpenGL in processing.org. I'd like to draw two crossed triangles, but don't really get how to rotate the triangles to cross them.</p>
  
  <pre><code>PGraphicsOpenGL pgl = (PGraphicsOpenGL) g;
  GL gl = pgl.beginGL();
  
  gl.glTranslatef(width/2, height/2, 0);
  gl.glRotatef(a, 0, 0, 0);
  
  gl.glBegin(GL.GL_TRIANGLES);
  gl.glColor4f(0.7, 0.1, 0.7, 0.8);
  gl.glVertex3f(0, 0, 0);
  gl.glVertex3f(0, 50, 0);
  gl.glVertex3f(25, 0, 25);
  gl.glEnd();
  
  gl.glRotatef(90, 1, 0, 0);
  gl.glBegin(GL.GL_TRIANGLES);
  gl.glColor4f(0.1, 0.9, 0.7, 0.8);
  gl.glVertex3f(0, 0, 0);
  gl.glVertex3f(0, 50, 0);
  gl.glVertex3f(25, 0, 25);
  gl.glEnd();
  
  pgl.endGL();
  </code></pre>
  
  <p>The triangles should be crossed like these old 3D models of trees. They should rotate and move as one object in later use, which I figured works with pop and push around both vertices, I just can't figure out the rotation to get these two triangles together.</p>