Konfigurasi VM dengan cara klik kanan pada Tutorial lwjgl dan pilih Properties
30
Display.setFullscreenfalse; Display.setTitleGAMBAR
Primitives-Geometric :
POLYGON; Display.create;
initGL; resizeGL;
} void initGL {
glClearColor0.0f, 1.0f, 1.0f, 1.0f; glDisableGL_DEPTH_TEST;
glDisableGL_LIGHTING; }
public void resizeGL { 2D Scene
glViewport0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT; glMatrixModeGL_PROJECTION;
glLoadIdentity; gluOrtho2D0.0f, DISPLAY_WIDTH, 0.0f, DISPLAY_HEIGHT;
glPushMatrix; glMatrixModeGL_MODELVIEW;
glLoadIdentity; glPushMatrix;
} public void run {
while Display.isCloseRequested Keyboard.isKeyDownKeyboard.KEY_ESCAPE {
if Display.isVisible { update;
render; } else {
if Display.isDirty { render;
} try {
Thread.sleep100; } catch InterruptedException ex {
}
31
} Display.update;
Display.sync60; }
} private void update {
} public void destroy {
Mouse.destroy; Keyboard.destroy;
Display.destroy; }
public static void mainString[] args { OpenGL1 b1 = new OpenGL1;
try { b1.create;
b1.run; } catch LWJGLException ex {
Logger.getLoggerBelajar1.class.getName.logLevel.SEVERE, null, ex;
} }
}
Latihan
1. OpenGL Open Graphics Library bersifat Open-Source, multi- platform dan multi-language adalah sebuah program aplikasi interface
untuk mendifinisikan suatu objek yaitu .... 2. Fungsi dasar dari OpenGL adalah ....