Created
December 6, 2011 11:31
-
-
Save WideWord/1437875 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.lwjgl.opengl.*; | |
import org.lwjgl.*; | |
import org.lwjgl.util.glu.*; | |
public class Main { | |
public static void main(String[] args) { | |
int w = 800, h = 600; | |
try { | |
Display.setDisplayMode(new DisplayMode(w,h)); | |
Display.create(); | |
} catch (LWJGLException e) { | |
e.printStackTrace(); | |
System.exit(0); | |
} | |
GL11.glViewport(0, 0, w, h); | |
GL11.glMatrixMode(GL11.GL_PROJECTION); | |
GL11.glLoadIdentity(); | |
GLU.gluPerspective(45.0f, w/h, 0.1f, 100.0f); | |
//GL11.glFrustum(-1, 1, -1, 1, 0.1f, 100.0f); | |
GL11.glMatrixMode(GL11.GL_MODELVIEW); | |
GL11.glClearColor(0.0f, 255.0f, 255.0f, 255.0f); | |
while (!Display.isCloseRequested()) { | |
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); | |
GL11.glLoadIdentity(); | |
GL11.glColor3f(0, 0, 0); | |
GL11.glTranslatef(0, 0, -5.0f); | |
GL11.glBegin(GL11.GL_QUADS); | |
GL11.glVertex3f (1.0f, 1.0f, 0.0f); | |
GL11.glVertex3f (1.0f, -1.0f, 0.0f); | |
GL11.glVertex3f (-1.0f, -1.0f, 0.0f); | |
GL11.glVertex3f (-1.0f, 1.0f, 0.0f); | |
GL11.glEnd(); | |
Display.update(); | |
} | |
Display.destroy(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment