Roi Atalla avatar Roi Atalla committed 9134254

Initial setup of Example 11.1. Also changed formatter settings and updated the entire project accordingly.

Comments (0)

Files changed (70)

src/main/java/com/ra4king/opengl/GLProgram.java

 		try {
 			Display.setFullscreen(true);
 			Display.setVSyncEnabled(vsync);
-		}
-		catch(Exception exc) {
+		} catch(Exception exc) {
 			exc.printStackTrace();
 		}
 	}
 		Display.setTitle(name);
 		
 		try {
-			Display.setDisplayMode(new DisplayMode(width,height));
-		}
-		catch(Exception exc) {
+			Display.setDisplayMode(new DisplayMode(width, height));
+		} catch(Exception exc) {
 			exc.printStackTrace();
 		}
 		
 	public final void run() {
 		try {
 			Display.create();
-		}
-		catch(Exception exc) {
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			System.exit(1);
 		}
 	
 	public final void run(boolean core) {
 		try {
-			Display.create(new PixelFormat(),core ? new ContextAttribs(3,3) : new ContextAttribs());
-		}
-		catch(Exception exc) {
+			Display.create(new PixelFormat(), core ? new ContextAttribs(3, 3) : new ContextAttribs());
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			System.exit(1);
 		}
 	
 	public final void run(int major, int minor) {
 		try {
-			Display.create(new PixelFormat(),new ContextAttribs(major,minor));
-		}
-		catch(Exception exc) {
+			Display.create(new PixelFormat(), new ContextAttribs(major, minor));
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			System.exit(1);
 		}
 				
 				while(Keyboard.next()) {
 					if(Keyboard.getEventKeyState())
-						keyPressed(Keyboard.getEventKey(),Keyboard.getEventCharacter(),Keyboard.getEventNanoseconds());
+						keyPressed(Keyboard.getEventKey(), Keyboard.getEventCharacter(), Keyboard.getEventNanoseconds());
 					else
-						keyReleased(Keyboard.getEventKey(),Keyboard.getEventCharacter(),Keyboard.getEventNanoseconds());
+						keyReleased(Keyboard.getEventKey(), Keyboard.getEventCharacter(), Keyboard.getEventNanoseconds());
 				}
 				
 				update(deltaTime);
 				
 				Display.sync(fps);
 			}
-		}
-		catch(Throwable exc) {
+		} catch(Throwable exc) {
 			exc.printStackTrace();
-		}
-		finally {
+		} finally {
 			destroy();
 		}
 	}
 	public abstract void init();
 	
 	public void resized() {
-		glViewport(0,0,getWidth(),getHeight());
+		glViewport(0, 0, getWidth(), getHeight());
 	}
 	
 	public boolean shouldStop() {
 	}
 	
 	protected String readFromFile(String file) {
-		try(BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(file),"UTF-8"))) {
+		try(BufferedReader reader = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(file), "UTF-8"))) {
 			StringBuilder s = new StringBuilder();
 			String l;
 			
 				s.append(l).append('\n');
 			
 			return s.toString();
-		}
-		catch(Exception exc) {
-			throw new RuntimeException("Failure reading file: " + file,exc);
+		} catch(Exception exc) {
+			throw new RuntimeException("Failure reading file: " + file, exc);
 		}
 	}
 }

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter1/Example1_1.java

 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(24).put(new float[] { 0.75f,  0.75f, 0.0f, 1.0f,
-																									   0.75f, -0.75f, 0.0f, 1.0f,
-																									  -0.75f, -0.75f, 0.0f, 1.0f}).flip(),GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(24).put(new float[] { 0.75f, 0.75f, 0.0f, 1.0f,
+																										0.75f, -0.75f, 0.0f, 1.0f,
+																										-0.75f, -0.75f, 0.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example1/Example10_1.java

 		glClearDepth(1);
 		
 		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
-		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f/250f);
+		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
 		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
 		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f/250f, MouseButton.RIGHT_BUTTON, viewPole);
+		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		whiteDiffuseColor = loadLitShader("example10.1.VertexLighting_PN.vert", "example10.1.frag");
 		vertexDiffuseColor = loadLitShader("example10.1.VertexLighting_PCN.vert", "example10.1.frag");
 			cylinderMesh = new Mesh(getClass().getResource("example10.1.UnitCylinder.xml"));
 			planeMesh = new Mesh(getClass().getResource("example10.1.LargePlane.xml"));
 			cubeMesh = new Mesh(getClass().getResource("example10.1.UnitCube.xml"));
-		}
-		catch(Exception exc) {
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			destroy();
 		}
 		
 		projectionUniformBuffer = glGenBuffers();
 		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
-		glBufferData(GL_UNIFORM_BUFFER, 16*4, GL_DYNAMIC_DRAW);
-		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16*4);
+		glBufferData(GL_UNIFORM_BUFFER, 16 * 4, GL_DYNAMIC_DRAW);
+		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16 * 4);
 		glBindBuffer(GL_UNIFORM_BUFFER, 0);
 	}
 	
 				
 				unlit.program.begin();
 				glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
-				glUniform4f(unlit.objectColorUniform, 0.8078f, 0.8706f,  0.9922f, 1);
+				glUniform4f(unlit.objectColorUniform, 0.8078f, 0.8706f, 0.9922f, 1);
 				cubeMesh.render("flat");
 				unlit.program.end();
 				

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example2/Example10_2.java

 		glClearDepth(1);
 		
 		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
-		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f/250f);
+		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
 		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
 		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f/250f, MouseButton.RIGHT_BUTTON, viewPole);
+		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		whiteDiffuseColor = loadLitShader("example10.2.VertexLighting_PN.vert", "example10.2.frag");
 		vertexDiffuseColor = loadLitShader("example10.2.VertexLighting_PCN.vert", "example10.2.frag");
 			cylinderMesh = new Mesh(getClass().getResource("example10.2.UnitCylinder.xml"));
 			planeMesh = new Mesh(getClass().getResource("example10.2.LargePlane.xml"));
 			cubeMesh = new Mesh(getClass().getResource("example10.2.UnitCube.xml"));
-		}
-		catch(Exception exc) {
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			destroy();
 		}
 		
 		projectionUniformBuffer = glGenBuffers();
 		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
-		glBufferData(GL_UNIFORM_BUFFER, 16*4, GL_DYNAMIC_DRAW);
-		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16*4);
+		glBufferData(GL_UNIFORM_BUFFER, 16 * 4, GL_DYNAMIC_DRAW);
+		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16 * 4);
 		glBindBuffer(GL_UNIFORM_BUFFER, 0);
 	}
 	

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/Example10_3.java

 		glClearDepth(1);
 		
 		ViewData initialViewData = new ViewData(new Vector3(0, 0.5f, 0), new Quaternion(0.3826834f, 0, 0, 0.92387953f), 5, 0);
-		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f/250f);
+		ViewScale viewScale = new ViewScale(3, 20, 1.5f, 0.5f, 0, 0, 90f / 250f);
 		ObjectData initialObjectData = new ObjectData(new Vector3(0, 0.5f, 0), new Quaternion());
 		
 		viewPole = new ViewPole(initialViewData, viewScale, MouseButton.LEFT_BUTTON, false);
-		objectPole = new ObjectPole(initialObjectData, 90f/250f, MouseButton.RIGHT_BUTTON, viewPole);
+		objectPole = new ObjectPole(initialObjectData, 90f / 250f, MouseButton.RIGHT_BUTTON, viewPole);
 		
 		fragWhiteDiffuseColor = loadLitShader("example10.3.FragLightAtten_PN.vert", "example10.3.FragLightAtten.frag");
 		fragVertexDiffuseColor = loadLitShader("example10.3.FragLightAtten_PCN.vert", "example10.3.FragLightAtten.frag");
 			cylinderMesh = new Mesh(getClass().getResource("example10.3.UnitCylinder.xml"));
 			planeMesh = new Mesh(getClass().getResource("example10.3.LargePlane.xml"));
 			cubeMesh = new Mesh(getClass().getResource("example10.3.UnitCube.xml"));
-		}
-		catch(Exception exc) {
+		} catch(Exception exc) {
 			exc.printStackTrace();
 			destroy();
 		}
 		
 		projectionUniformBuffer = glGenBuffers();
 		glBindBuffer(GL_UNIFORM_BUFFER, projectionUniformBuffer);
-		glBufferData(GL_UNIFORM_BUFFER, 16*4, GL_DYNAMIC_DRAW);
-		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16*4);
+		glBufferData(GL_UNIFORM_BUFFER, 16 * 4, GL_DYNAMIC_DRAW);
+		glBindBufferRange(GL_UNIFORM_BUFFER, projectionBlockIndex, projectionUniformBuffer, 0, 16 * 4);
 		glBindBuffer(GL_UNIFORM_BUFFER, 0);
 		
 		unprojectionUniformBuffer = glGenBuffers();
 		glBindBuffer(GL_UNIFORM_BUFFER, unprojectionUniformBuffer);
-		glBufferData(GL_UNIFORM_BUFFER, 18*4, GL_DYNAMIC_DRAW);
-		glBindBufferRange(GL_UNIFORM_BUFFER, unprojectionBlockIndex, unprojectionUniformBuffer, 0, 18*4);
+		glBufferData(GL_UNIFORM_BUFFER, 18 * 4, GL_DYNAMIC_DRAW);
+		glBindBufferRange(GL_UNIFORM_BUFFER, unprojectionBlockIndex, unprojectionUniformBuffer, 0, 18 * 4);
 		glBindBuffer(GL_UNIFORM_BUFFER, 0);
 	}
 	
 		return data;
 	}
 	
-	private ByteBuffer unprojectionData = BufferUtils.createByteBuffer(18*4);
+	private ByteBuffer unprojectionData = BufferUtils.createByteBuffer(18 * 4);
 	
 	@Override
 	public void resized() {
 		
 		unprojectionData.clear();
 		unprojectionData.asFloatBuffer().put(persMatrix.inverse().toBuffer());
-		unprojectionData.position(16*4);
+		unprojectionData.position(16 * 4);
 		unprojectionData.asIntBuffer().put(getWidth()).put(getHeight());
-		unprojectionData.position(18*4).flip();
+		unprojectionData.position(18 * 4).flip();
 		
 		glBindBuffer(GL_UNIFORM_BUFFER, unprojectionUniformBuffer);
 		glBufferSubData(GL_UNIFORM_BUFFER, 0, unprojectionData);
 				modelMatrix.getTop().mult(objectPole.calcMatrix());
 				
 				if(scaleCyl)
-					modelMatrix.getTop().scale(1,1,0.2f);
+					modelMatrix.getTop().scale(1, 1, 0.2f);
 				
 				Matrix3 normMatrix = new Matrix3(modelMatrix.getTop()).inverse().transpose();
 				

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter2/example1/Example2_1.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example2.1.vert"),readFromFile("example2.1.frag"));
+		program = new ShaderProgram(readFromFile("example2.1.vert"), readFromFile("example2.1.frag"));
 		
 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.75f,  0.75f, 0.0f, 1.0f,
-																									   0.75f, -0.75f, 0.0f, 1.0f,
-																									  -0.75f, -0.75f, 0.0f, 1.0f}).flip(),GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.75f, 0.75f, 0.0f, 1.0f,
+																										0.75f, -0.75f, 0.0f, 1.0f,
+																										-0.75f, -0.75f, 0.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter2/example2/Example2_2.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example2.2.vert"),readFromFile("example2.2.frag"));
+		program = new ShaderProgram(readFromFile("example2.2.vert"), readFromFile("example2.2.frag"));
 		
 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(24).put(new float[] { 0.0f,    0.5f, 0.0f, 1.0f,
-																									   0.5f, -0.366f, 0.0f, 1.0f,
-																									  -0.5f, -0.366f, 0.0f, 1.0f,
-																									   1.0f,    0.0f, 0.0f, 1.0f,
-																									   0.0f,    1.0f, 0.0f, 1.0f,
-																									   0.0f,    0.0f, 1.0f, 1.0f}).flip(),GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(24).put(new float[] { 0.0f, 0.5f, 0.0f, 1.0f,
+																										0.5f, -0.366f, 0.0f, 1.0f,
+																										-0.5f, -0.366f, 0.0f, 1.0f,
+																										1.0f, 0.0f, 0.0f, 1.0f,
+																										0.0f, 1.0f, 0.0f, 1.0f,
+																										0.0f, 0.0f, 1.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter3/example1/Example3_1.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example3.1.vert"),readFromFile("example3.1.frag"));
+		program = new ShaderProgram(readFromFile("example3.1.vert"), readFromFile("example3.1.frag"));
 		
 		vbo = glGenBuffers();
 		
-		vertexData = (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f,  0.25f, 0.0f, 1.0f,
-																					  0.25f, -0.25f, 0.0f, 1.0f,
-																					 -0.25f, -0.25f, 0.0f, 1.0f}).flip();
+		vertexData = (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f, 0.25f, 0.0f, 1.0f,
+																						0.25f, -0.25f, 0.0f, 1.0f,
+																						-0.25f, -0.25f, 0.0f, 1.0f }).flip();
 		newData = BufferUtils.createFloatBuffer(12);
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
 		
 		float loopDuration = 5;
 		float scale = (float)Math.PI * 2 / loopDuration;
-		float currentTimeThroughLoop = (elapsedTime/(float)1e9) % loopDuration;
+		float currentTimeThroughLoop = (elapsedTime / (float)1e9) % loopDuration;
 		
 		float xOffset = (float)Math.cos(currentTimeThroughLoop * scale) * 0.5f;
 		float yOffset = (float)Math.sin(currentTimeThroughLoop * scale) * 0.5f;
 		
 		for(int a = 0; a < 12; a += 4) {
 			newData.put(vertexData.get(a) + xOffset);
-			newData.put(vertexData.get(a+1) + yOffset);
+			newData.put(vertexData.get(a + 1) + yOffset);
 			newData.put(0);
 			newData.put(1);
 		}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter3/example2/Example3_2.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example3.2.vert"),readFromFile("example3.2.frag"));
+		program = new ShaderProgram(readFromFile("example3.2.vert"), readFromFile("example3.2.frag"));
 		offsetLocation = glGetUniformLocation(program.getProgram(), "offset");
 		
 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f,  0.25f, 0.0f, 1.0f,
-																									   0.25f, -0.25f, 0.0f, 1.0f,
-																									  -0.25f, -0.25f, 0.0f, 1.0f}).flip(), GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f, 0.25f, 0.0f, 1.0f,
+																										0.25f, -0.25f, 0.0f, 1.0f,
+																										-0.25f, -0.25f, 0.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		
 	public void render() {
 		float loopDuration = 5;
 		float scale = (float)Math.PI * 2 / loopDuration;
-		float currentTimeThroughLoop = (elapsedTime/(float)1e9) % loopDuration;
+		float currentTimeThroughLoop = (elapsedTime / (float)1e9) % loopDuration;
 		
 		float xOffset = (float)Math.cos(currentTimeThroughLoop * scale) * 0.5f;
 		float yOffset = (float)Math.sin(currentTimeThroughLoop * scale) * 0.5f;

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter3/example3/Example3_3.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example3.3.vert"),readFromFile("example3.3.frag"));
+		program = new ShaderProgram(readFromFile("example3.3.vert"), readFromFile("example3.3.frag"));
 		timeLocation = glGetUniformLocation(program.getProgram(), "time");
 		
 		int loopDurationLocation = glGetUniformLocation(program.getProgram(), "loopDuration");
 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f,  0.25f, 0.0f, 1.0f,
-																									   0.25f, -0.25f, 0.0f, 1.0f,
-																									  -0.25f, -0.25f, 0.0f, 1.0f}).flip(), GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f, 0.25f, 0.0f, 1.0f,
+																										0.25f, -0.25f, 0.0f, 1.0f,
+																										-0.25f, -0.25f, 0.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		
 		
 		program.begin();
 		
-		glUniform1f(timeLocation, elapsedTime/(float)1e9);
+		glUniform1f(timeLocation, elapsedTime / (float)1e9);
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
 		glEnableVertexAttribArray(0);

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter3/example4/Example3_4.java

 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example3.4.vert"),readFromFile("example3.4.frag"));
+		program = new ShaderProgram(readFromFile("example3.4.vert"), readFromFile("example3.4.frag"));
 		timeLocation = glGetUniformLocation(program.getProgram(), "time");
 		
 		int loopDurationLocation = glGetUniformLocation(program.getProgram(), "loopDuration");
 		vbo = glGenBuffers();
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
-		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f,  0.25f, 0.0f, 1.0f,
-																									   0.25f, -0.25f, 0.0f, 1.0f,
-																									  -0.25f, -0.25f, 0.0f, 1.0f}).flip(), GL_STATIC_DRAW);
+		glBufferData(GL_ARRAY_BUFFER, (FloatBuffer)BufferUtils.createFloatBuffer(12).put(new float[] { 0.25f, 0.25f, 0.0f, 1.0f,
+																										0.25f, -0.25f, 0.0f, 1.0f,
+																										-0.25f, -0.25f, 0.0f, 1.0f }).flip(), GL_STATIC_DRAW);
 		
 		glBindVertexArray(glGenVertexArrays());
 		
 		
 		program.begin();
 		
-		glUniform1f(timeLocation, elapsedTime/(float)1e9);
+		glUniform1f(timeLocation, elapsedTime / (float)1e9);
 		
 		glBindBuffer(GL_ARRAY_BUFFER, vbo);
 		glEnableVertexAttribArray(0);

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter4/example1/Example4_1.java

 	}
 	
 	private final float[] data = {
-			 0.25f,  0.25f, 0.75f, 1.0f,
-			 0.25f, -0.25f, 0.75f, 1.0f,
-			-0.25f,  0.25f, 0.75f, 1.0f,
-			
-			 0.25f, -0.25f, 0.75f, 1.0f,
-			-0.25f, -0.25f, 0.75f, 1.0f,
-			-0.25f,  0.25f, 0.75f, 1.0f,
-			
-			 0.25f,  0.25f, -0.75f, 1.0f,
-			-0.25f,  0.25f, -0.75f, 1.0f,
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			-0.25f,  0.25f, -0.75f, 1.0f,
-			-0.25f, -0.25f, -0.75f, 1.0f,
-			
-			-0.25f,  0.25f,  0.75f, 1.0f,
-			-0.25f, -0.25f,  0.75f, 1.0f,
-			-0.25f, -0.25f, -0.75f, 1.0f,
-			
-			-0.25f,  0.25f,  0.75f, 1.0f,
-			-0.25f, -0.25f, -0.75f, 1.0f,
-			-0.25f,  0.25f, -0.75f, 1.0f,
-			
-			 0.25f,  0.25f,  0.75f, 1.0f,
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			 0.25f, -0.25f,  0.75f, 1.0f,
-			 
-			 0.25f,  0.25f,  0.75f, 1.0f,
-			 0.25f,  0.25f, -0.75f, 1.0f,
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			 
-			 0.25f,  0.25f, -0.75f, 1.0f,
-			 0.25f,  0.25f,  0.75f, 1.0f,
-			-0.25f,  0.25f,  0.75f, 1.0f,
-			
-			 0.25f,  0.25f, -0.75f, 1.0f,
-			-0.25f,  0.25f,  0.75f, 1.0f,
-			-0.25f,  0.25f, -0.75f, 1.0f,
-			
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			-0.25f, -0.25f,  0.75f, 1.0f,
-			 0.25f, -0.25f,  0.75f, 1.0f,
-			 
-			 0.25f, -0.25f, -0.75f, 1.0f,
-			-0.25f, -0.25f, -0.75f, 1.0f,
-			-0.25f, -0.25f,  0.75f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f
+									0.25f, 0.25f, 0.75f, 1.0f,
+									0.25f, -0.25f, 0.75f, 1.0f,
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									
+									0.25f, -0.25f, 0.75f, 1.0f,
+									-0.25f, -0.25f, 0.75f, 1.0f,
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									
+									0.25f, 0.25f, -0.75f, 1.0f,
+									-0.25f, 0.25f, -0.75f, 1.0f,
+									0.25f, -0.25f, -0.75f, 1.0f,
+									
+									0.25f, -0.25f, -0.75f, 1.0f,
+									-0.25f, 0.25f, -0.75f, 1.0f,
+									-0.25f, -0.25f, -0.75f, 1.0f,
+									
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									-0.25f, -0.25f, 0.75f, 1.0f,
+									-0.25f, -0.25f, -0.75f, 1.0f,
+									
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									-0.25f, -0.25f, -0.75f, 1.0f,
+									-0.25f, 0.25f, -0.75f, 1.0f,
+									
+									0.25f, 0.25f, 0.75f, 1.0f,
+									0.25f, -0.25f, -0.75f, 1.0f,
+									0.25f, -0.25f, 0.75f, 1.0f,
+									
+									0.25f, 0.25f, 0.75f, 1.0f,
+									0.25f, 0.25f, -0.75f, 1.0f,
+									0.25f, -0.25f, -0.75f, 1.0f,
+									
+									0.25f, 0.25f, -0.75f, 1.0f,
+									0.25f, 0.25f, 0.75f, 1.0f,
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									
+									0.25f, 0.25f, -0.75f, 1.0f,
+									-0.25f, 0.25f, 0.75f, 1.0f,
+									-0.25f, 0.25f, -0.75f, 1.0f,
+									
+									0.25f, -0.25f, -0.75f, 1.0f,
+									-0.25f, -0.25f, 0.75f, 1.0f,
+									0.25f, -0.25f, 0.75f, 1.0f,
+									
+									0.25f, -0.25f, -0.75f, 1.0f,
+									-0.25f, -0.25f, -0.75f, 1.0f,
+									-0.25f, -0.25f, 0.75f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f
 	};
 	
 	private ShaderProgram program;
 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example4.1.vert"),readFromFile("example4.1.frag"));
+		program = new ShaderProgram(readFromFile("example4.1.vert"), readFromFile("example4.1.frag"));
 		
 		offsetUniform = glGetUniformLocation(program.getProgram(), "offset");
 		

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter4/example2/Example4_2.java

 	}
 	
 	private final float[] data = {
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f
 	};
 	
 	private ShaderProgram program;
 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example4.2.vert"),readFromFile("example4.2.frag"));
+		program = new ShaderProgram(readFromFile("example4.2.vert"), readFromFile("example4.2.frag"));
 		
 		offsetUniform = glGetUniformLocation(program.getProgram(), "offset");
 		

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter4/example3/Example4_3.java

 	}
 	
 	private final float[] data = {
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f
 	};
 	
 	private ShaderProgram program;
 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example4.3.vert"),readFromFile("example4.3.frag"));
+		program = new ShaderProgram(readFromFile("example4.3.vert"), readFromFile("example4.3.frag"));
 		
 		offsetUniform = glGetUniformLocation(program.getProgram(), "offset");
 		
 		
 		float frustumScale = 1, zNear = 0.5f, zFar = 3;
 		FloatBuffer perspectiveMatrix = BufferUtils.createFloatBuffer(16);
-		perspectiveMatrix.put(0,frustumScale);
-		perspectiveMatrix.put(5,frustumScale);
-		perspectiveMatrix.put(10,(zFar + zNear) / (zNear - zFar));
-		perspectiveMatrix.put(14,(2 * zFar * zNear) / (zNear - zFar));
-		perspectiveMatrix.put(11,-1);
+		perspectiveMatrix.put(0, frustumScale);
+		perspectiveMatrix.put(5, frustumScale);
+		perspectiveMatrix.put(10, (zFar + zNear) / (zNear - zFar));
+		perspectiveMatrix.put(14, (2 * zFar * zNear) / (zNear - zFar));
+		perspectiveMatrix.put(11, -1);
 		
 		program.begin();
 		glUniformMatrix4(perspectiveMatrixUniform, false, perspectiveMatrix);

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter4/example4/Example4_4.java

 	}
 	
 	private final float[] data = {
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			 0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			
-			 0.25f,  0.25f, -2.75f, 1.0f,
-			-0.25f,  0.25f, -1.25f, 1.0f,
-			-0.25f,  0.25f, -2.75f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			 0.25f, -0.25f, -1.25f, 1.0f,
-			
-			 0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -2.75f, 1.0f,
-			-0.25f, -0.25f, -1.25f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			0.0f, 0.0f, 1.0f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			0.8f, 0.8f, 0.8f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			0.0f, 1.0f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			0.5f, 0.5f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			1.0f, 0.0f, 0.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f,
-			0.0f, 1.0f, 1.0f, 1.0f
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -1.25f, 1.0f,
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, -0.25f, -2.75f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									
+									0.25f, 0.25f, -2.75f, 1.0f,
+									-0.25f, 0.25f, -1.25f, 1.0f,
+									-0.25f, 0.25f, -2.75f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -2.75f, 1.0f,
+									-0.25f, -0.25f, -1.25f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									0.0f, 0.0f, 1.0f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									0.8f, 0.8f, 0.8f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									0.0f, 1.0f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									0.5f, 0.5f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									1.0f, 0.0f, 0.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f,
+									0.0f, 1.0f, 1.0f, 1.0f
 	};
 	
 	private ShaderProgram program;
 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example4.4.vert"),readFromFile("example4.4.frag"));
+		program = new ShaderProgram(readFromFile("example4.4.vert"), readFromFile("example4.4.frag"));
 		
 		offsetUniform = glGetUniformLocation(program.getProgram(), "offset");
 		
 		
 		float zNear = 0.5f, zFar = 3;
 		perspectiveMatrix = BufferUtils.createFloatBuffer(16);
-		perspectiveMatrix.put(0,frustumScale);
-		perspectiveMatrix.put(5,frustumScale);
-		perspectiveMatrix.put(10,(zFar + zNear) / (zNear - zFar));
-		perspectiveMatrix.put(14,(2 * zFar * zNear) / (zNear - zFar));
-		perspectiveMatrix.put(11,-1);
+		perspectiveMatrix.put(0, frustumScale);
+		perspectiveMatrix.put(5, frustumScale);
+		perspectiveMatrix.put(10, (zFar + zNear) / (zNear - zFar));
+		perspectiveMatrix.put(14, (2 * zFar * zNear) / (zNear - zFar));
+		perspectiveMatrix.put(11, -1);
 		
 		program.begin();
 		glUniformMatrix4(perspectiveMatrixUniform, false, perspectiveMatrix);
 	public void resized() {
 		super.resized();
 		
-		perspectiveMatrix.put(0,frustumScale / ((float)getWidth() / getHeight()));
+		perspectiveMatrix.put(0, frustumScale / ((float)getWidth() / getHeight()));
 		
 		program.begin();
 		glUniformMatrix4(perspectiveMatrixUniform, false, perspectiveMatrix);

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter5/example1/Example5_1.java

 	private final float[] BROWN_COLOR = { 0.5f, 0.5f, 0, 1 };
 	
 	private float data[] = {
-			//Object 1 positions
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			//Object 2 positions
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			                
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			                
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			
-			//Object 1 colors
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			
-			//Object 2 colors
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
-			
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							// Object 1 positions
+							LEFT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							LEFT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							RIGHT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							RIGHT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							
+							LEFT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							LEFT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							RIGHT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							RIGHT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							
+							LEFT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							LEFT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							LEFT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							
+							RIGHT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							RIGHT_EXTENT, MIDDLE_EXTENT, FRONT_EXTENT,
+							RIGHT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							
+							LEFT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							LEFT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							RIGHT_EXTENT, TOP_EXTENT, REAR_EXTENT,
+							RIGHT_EXTENT, BOTTOM_EXTENT, REAR_EXTENT,
+							
+							// Object 2 positions
+							TOP_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							MIDDLE_EXTENT, RIGHT_EXTENT, FRONT_EXTENT,
+							MIDDLE_EXTENT, LEFT_EXTENT, FRONT_EXTENT,
+							TOP_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							
+							BOTTOM_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							MIDDLE_EXTENT, RIGHT_EXTENT, FRONT_EXTENT,
+							MIDDLE_EXTENT, LEFT_EXTENT, FRONT_EXTENT,
+							BOTTOM_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							
+							TOP_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							MIDDLE_EXTENT, RIGHT_EXTENT, FRONT_EXTENT,
+							BOTTOM_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							
+							TOP_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							MIDDLE_EXTENT, LEFT_EXTENT, FRONT_EXTENT,
+							BOTTOM_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							
+							BOTTOM_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							TOP_EXTENT, RIGHT_EXTENT, REAR_EXTENT,
+							TOP_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							BOTTOM_EXTENT, LEFT_EXTENT, REAR_EXTENT,
+							
+							// Object 1 colors
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							
+							// Object 2 colors
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
+							
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],
+							
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
+							
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
+							
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
+							GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
 	};
 	
 	private final short[] indices = {
-			0, 2, 1,
-			3, 2, 0,
-			
-			4, 5, 6,
-			6, 7, 4,
-			
-			8, 9, 10,
-			11, 13, 12,
-			
-			14, 16, 15,
-			17, 16, 14
+										0, 2, 1,
+										3, 2, 0,
+										
+										4, 5, 6,
+										6, 7, 4,
+										
+										8, 9, 10,
+										11, 13, 12,
+										
+										14, 16, 15,
+										17, 16, 14
 	};
 	
 	private ShaderProgram program;
 	public void init() {
 		glClearColor(0, 0, 0, 0);
 		
-		program = new ShaderProgram(readFromFile("example5.1.vert"),readFromFile("example5.1.frag"));
+		program = new ShaderProgram(readFromFile("example5.1.vert"), readFromFile("example5.1.frag"));
 		
 		offsetUniform = glGetUniformLocation(program.getProgram(), "offset");
 		
 		
 		float zNear = 0.5f, zFar = 3;
 		perspectiveMatrix = BufferUtils.createFloatBuffer(16);
-		perspectiveMatrix.put(0,frustumScale);
-		perspectiveMatrix.put(5,frustumScale);
-		perspectiveMatrix.put(10,(zFar + zNear) / (zNear - zFar));
-		perspectiveMatrix.put(14,(2 * zFar * zNear) / (zNear - zFar));
-		perspectiveMatrix.put(11,-1);
+		perspectiveMatrix.put(0, frustumScale);
+		perspectiveMatrix.put(5, frustumScale);
+		perspectiveMatrix.put(10, (zFar + zNear) / (zNear - zFar));
+		perspectiveMatrix.put(14, (2 * zFar * zNear) / (zNear - zFar));
+		perspectiveMatrix.put(11, -1);
 		
 		program.begin();
 		glUniformMatrix4(perspectiveMatrixUniform, false, perspectiveMatrix);
 	public void resized() {
 		super.resized();
 		
-		perspectiveMatrix.put(0,frustumScale / ((float)getWidth() / getHeight()));
+		perspectiveMatrix.put(0, frustumScale / ((float)getWidth() / getHeight()));
 		
 		program.begin();
 		glUniformMatrix4(perspectiveMatrixUniform, false, perspectiveMatrix);

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter5/example2/Example5_2.java

 	private final float[] BROWN_COLOR = { 0.5f, 0.5f, 0, 1 };
 	
 	private float data[] = {
-			//Object 1 positions
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			LEFT_EXTENT,    MIDDLE_EXTENT,  FRONT_EXTENT,
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   MIDDLE_EXTENT,  FRONT_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			LEFT_EXTENT,    BOTTOM_EXTENT,  REAR_EXTENT,
-			LEFT_EXTENT,    TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   TOP_EXTENT,     REAR_EXTENT,
-			RIGHT_EXTENT,   BOTTOM_EXTENT,  REAR_EXTENT,
-			
-			//Object 2 positions
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			MIDDLE_EXTENT,  RIGHT_EXTENT,   FRONT_EXTENT,
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			                
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			MIDDLE_EXTENT,  LEFT_EXTENT,    FRONT_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			                
-			BOTTOM_EXTENT,  RIGHT_EXTENT,   REAR_EXTENT,
-			TOP_EXTENT,     RIGHT_EXTENT,   REAR_EXTENT,
-			TOP_EXTENT,     LEFT_EXTENT,    REAR_EXTENT,
-			BOTTOM_EXTENT,  LEFT_EXTENT,    REAR_EXTENT,
-			
-			//Object 1 colors
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			GREEN_COLOR[0], GREEN_COLOR[1], GREEN_COLOR[2], GREEN_COLOR[3],
-			
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			BLUE_COLOR[0], BLUE_COLOR[1], BLUE_COLOR[2], BLUE_COLOR[3],
-			
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			RED_COLOR[0], RED_COLOR[1], RED_COLOR[2], RED_COLOR[3],
-			
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			GREY_COLOR[0], GREY_COLOR[1], GREY_COLOR[2], GREY_COLOR[3],
-			
-			BROWN_COLOR[0], BROWN_COLOR[1], BROWN_COLOR[2], BROWN_COLOR[3],