package home;

import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;

import com.sun.opengl.util.texture.Texture;

import devUtil.TextureLoader;

import world.GameObject;

public class Skybox extends GameObject {
	
	Texture sky;
	
	public Skybox() {
		sky = TextureLoader.getTexture("/visual/textures/Sky.jpg");
	}
	
	public void render(GL gl) {
		
		sky.enable();
		sky.bind();
		
		GLUquadric skybox = glu.gluNewQuadric();
		
		glu.gluQuadricTexture(skybox, true);
		glu.gluQuadricDrawStyle(skybox, GLU.GLU_FILL);
		glu.gluQuadricNormals(skybox, GLU.GLU_FLAT);
		glu.gluQuadricOrientation(skybox, GLU.GLU_OUTSIDE);
		
		final float radius = 12500f;
		final int slices = 16;
		final int stacks = 16;
		
		glu.gluSphere(skybox, radius, slices, stacks);
		glu.gluDeleteQuadric(skybox);
		
		sky.disable();
	}
}