AWT (Abstract Window Toolkit) is an application programming interface used to develop window-based applications. The components provided by AWT are heavy weight and platform dependent. The java.awt package contains various AWT classes for API's.
JOGL Frame Example
package info.learnhowtocode.jogl;
importjava.awt.Frame;
importjavax.media.opengl.*;
importjavax.media.opengl.awt.GLCanvas;
public class AWTFrame implements GLEventListener {
@Override
public void init(GLAutoDrawableobj) {
}
@Override
public void display(GLAutoDrawableobj) {
}
@Override
public void reshape(GLAutoDrawable obj1, int obj2, int obj3, int obj4, int obj5) {
}
@Override
public void dispose(GLAutoDrawableobj) {
}
public static void main(String[] args) {
finalGLProfilegp = GLProfile.get(GLProfile.GL4);
GLCapabilities cap = new GLCapabilities(gp);
finalGLCanvasgc = new GLCanvas(cap);
AWTFrameaf = new AWTFrame();
gc.addGLEventListener(af);
gc.setSize(350, 350);
//Now creating a frame using Frame class of AWT
final Frame frame = new Frame ("AWT Frame");
frame.add(gc);
frame.setSize( 500, 400 );
frame.setVisible(true);
}
}
0 comments:
Post a Comment