31
31
Dimension;
import java.awt.EventQueue;
import java.awt.Toolkit;
import javax.swing.JFrame;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.glu.GLU;
import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.opengl.util.gl2.GLUT;
@Override
public void display(GLAutoDrawable drawable) {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
gl.glFlush();
}
@Override
public void dispose(GLAutoDrawable drawable) {
@Override
public void init(GLAutoDrawable drawable) {
gl=drawable.getGL().getGL2();
glu=GLU.createGLU(gl);
glut=new GLUT();
gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}
@Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
int height) {
gl.glViewport(0, 0, width, height);
if(height==0)
height=1;
float aspect=(float)width/height;
gl.glMatrixMode(GL2.GL_PROJECTION);
gl.glLoadIdentity();
glu.gluPerspective(45.0f,aspect,1.0f,10.0f);
glu.gluLookAt(0.0f, 0.0f, 5.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f);
gl.glMatrixMode(GL2.GL_MODELVIEW);
}
@Override
public void run() {
new p02("p02");
}
});
}