import com.sun.opengl.util.*;
import javax.media.opengl.*; 
import processing.opengl.*;
GL gl;
GLUT glut;
void setup()
{
  size(400, 300, OPENGL);
  ambientLight(128, 128, 128, 0, 0, 300);
  gl = ((PGraphicsOpenGL)g).beginGL();
  glut = new GLUT();
  gl.glClearColor(0.0, 0.0, 0.0, 0.0);
}
void draw()
{
  gl=((PGraphicsOpenGL)g).beginGL();
  gl.glEnable(GL.GL_LIGHTING);
  gl.glEnable(GL.GL_LIGHT0);
  gl.glEnable(GL.GL_CULL_FACE);
  gl.glEnable(GL.GL_COLOR_MATERIAL);
  gl.glEnable(GL.GL_NORMALIZE);
  gl.glClear(GL.GL_COLOR_BUFFER_BIT |GL.GL_DEPTH_BUFFER_BIT );
  gl.glTranslatef(width/2, height/2+50, -50);
  gl.glPushMatrix();
  gl.glRotatef(45f, 1.0f, 0.0f, 0.0f);
  gl.glRotatef(frameCount*3, 0.0f, 1.0f, 0.0f);
  gl.glTranslatef(100, 0, 0);
  // 面の色を設定
  gl.glColor3f(
    (float)0x77/(float)0xff, 
    (float)0x99/(float)0xff, 
    (float)0xff/(float)0xff
  );
  // 20面体を描画
  gl.glScalef(70f, 70f, 70f);
  glut.glutSolidIcosahedron();
  gl.glPopMatrix();
  ((PGraphicsOpenGL)g).endGL();
}
出力画像
実行環境
processing1.0.9
〇関連項目
・Processingをインストールした仮想マシンを構築するには、以下のページを参照してください。
https://serverarekore.blogspot.com/search/label/Processing
・Processingに関する他の記事は、こちらを参照してください。
 



