import java.applet.Applet;
import java.awt.Graphics;

// must import jgl.GL....
import jgl.GL;
import jgl.GLAUX;

public class simple_o extends Applet {
// must use GL to use jGL.....
// and use GLAUX to use the aux functions.....
// remember to give GL to initialize GLAUX
GL myGL = new GL ();
GLAUX myAUX = new GLAUX (myGL);

	public void update (Graphics g) {
	    // since using DOUBLEBUFFER mode, clear screen is not needed
	    // skip the clear screen command....
	    paint (g);
	public void paint (Graphics g) {
	    // since JavaGL only offers DOUBLEBUFFER mode, call
	    // glXSwapBuffers at every "paint" time
	    myGL.glXSwapBuffers (g, this);
	// "init" in Java is like "main" in C program
	public void init () {
	    // auxInitDisplayMode has not supported
	    myAUX.auxInitPosition (0, 0, 500, 500);
	    myAUX.auxInitWindow (this);
	    myGL.glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
	    myGL.glClear (GL.GL_COLOR_BUFFER_BIT);
	    myGL.glMatrixMode (GL.GL_PROJECTION);
	    myGL.glLoadIdentity ();
	    myGL.glOrtho (-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
	    myGL.glBegin (GL.GL_POLYGON);
	    myGL.glColor3f (0.5f, 1.0f, 0.5f);
	        myGL.glVertex2f (-0.5f, -0.5f);
	        myGL.glVertex2f (-0.1f,  0.5f);
	        myGL.glVertex2f (0.5f,  -0.5f);
	    myGL.glEnd ();
	    myGL.glBegin (GL.GL_POLYGON);
	    myGL.glColor3f (0.0f, 1.0f, 0.0f);
	    myGL.glVertex2f (0.6f, -0.1f);
	    myGL.glVertex2f (-0.1f,  0.5f);
	    myGL.glVertex2f (0.5f,  -0.5f);
	    myGL.glEnd ();
	    myGL.glFlush ();

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS