Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 16th, 2014  |  syntax: None  |  size: 3.28 KB  |  views: 30  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. package com.voxel.engine.core;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. /**
  6.  * Created with IntelliJ IDEA.
  7.  * User: Toby's PC
  8.  * Date: 07/01/14
  9.  * Time: 19:16
  10.  * To change this template use File | Settings | File Templates.
  11.  */
  12. public class Cube {
  13.  
  14.     public void renderCube(){
  15.         GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
  16.         GL11.glLoadIdentity();
  17.  
  18.         GL11.glTranslatef(0f,0.0f,-7f);
  19.         GL11.glRotatef(45f,0.0f,1.0f,0.0f);
  20.         GL11.glColor3f(0.5f,0.5f,1.0f);
  21.  
  22.         GL11.glBegin(GL11.GL_QUADS);
  23.         GL11.glColor3f(1.0f,1.0f,0.0f);
  24.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  25.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  26.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  27.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  28.         GL11.glColor3f(1.0f,0.5f,0.0f);
  29.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  30.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  31.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  32.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  33.         GL11.glColor3f(1.0f,0.0f,0.0f);
  34.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  35.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  36.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  37.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  38.         GL11.glColor3f(1.0f,1.0f,0.0f);
  39.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  40.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  41.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  42.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  43.         GL11.glColor3f(0.0f,0.0f,1.0f);
  44.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  45.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  46.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  47.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  48.         GL11.glColor3f(1.0f,0.0f,1.0f);
  49.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  50.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  51.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  52.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  53.         GL11.glEnd();
  54.     }
  55.  
  56.     public void renderLineCube(){
  57.         GL11.glBegin(GL11.GL_LINE_LOOP);
  58.         GL11.glColor3f(1.0f,1.0f,0.0f);
  59.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  60.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  61.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  62.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  63.         GL11.glColor3f(1.0f,0.5f,0.0f);
  64.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  65.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  66.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  67.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  68.         GL11.glColor3f(1.0f,0.0f,0.0f);
  69.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  70.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  71.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  72.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  73.         GL11.glColor3f(1.0f,1.0f,0.0f);
  74.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  75.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  76.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  77.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  78.         GL11.glColor3f(0.0f,0.0f,1.0f);
  79.         GL11.glVertex3f(-1.0f, 1.0f, 1.0f);
  80.         GL11.glVertex3f(-1.0f, 1.0f,-1.0f);
  81.         GL11.glVertex3f(-1.0f,-1.0f,-1.0f);
  82.         GL11.glVertex3f(-1.0f,-1.0f, 1.0f);
  83.         GL11.glColor3f(1.0f,0.0f,1.0f);
  84.         GL11.glVertex3f( 1.0f, 1.0f,-1.0f);
  85.         GL11.glVertex3f( 1.0f, 1.0f, 1.0f);
  86.         GL11.glVertex3f( 1.0f,-1.0f, 1.0f);
  87.         GL11.glVertex3f( 1.0f,-1.0f,-1.0f);
  88.         GL11.glEnd();
  89.     }
  90. }