Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while (!Display.isCloseRequested() && !Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
- int dt = getDelta();
- Display.sync(60);
- InputHandler.update(dt, cam, cam.sb);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- glLoadIdentity();
- cam.useView();
- cam.update(dt);
- for(Block block : blocks){block.draw();};
- floor.draw();
- //Attempt to render 2d over the 3d
- // save your actual projection mode
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(Display.getWidth() / 2, Display.getHeight() / 2, 0.0f);
- glDisable(GL_DEPTH_TEST);
- // draw a cross in centre
- glColor3f(1,1,1);
- glBegin(GL_QUADS);
- glVertex2f(0f, 0f);
- glVertex2f(0.0f, 200f);
- glVertex2f(200f, 200.0f);
- glVertex2f(200f, 0.0f);
- glEnd();
- // back to 3D stuff
- glEnable(GL_DEPTH_TEST);
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
- Display.update();
- `}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement