Roi Atalla avatar Roi Atalla committed ef194ed

Example 10.3 mostly ported. Some glitches left to fix.

Comments (0)

Files changed (12)

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

 	
 	private Timer lightTimer = new Timer(Timer.Type.LOOP, 5);
 	
+	private float lightHeight = 1.5f, lightRadius = 1;
+	
 	private boolean useFragmentLighting = true, drawColoredCyl, drawLight, scaleCyl;
 	
 	public Example10_2() {
 			lightRadius = 0.2f;
 	}
 	
-	private float lightHeight = 1.5f, lightRadius = 1;
-	
 	@Override
 	public void keyPressed(int key, char c, long nanos) {
 		switch(key) {
 	public void render() {
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		
-		 MatrixStack modelMatrix = new MatrixStack();
-		 modelMatrix.setTop(viewPole.calcMatrix());
-		 
-		 Vector4 worldLightPos = calcLightPosition();
-		 Vector4 lightPosCameraSpace = modelMatrix.getTop().mult(worldLightPos);
-		 
-		 ProgramData whiteProgram, vertColorProgram;
-		 
-		 if(useFragmentLighting) {
-			 whiteProgram = fragWhiteDiffuseColor;
-			 vertColorProgram = fragVertexDiffuseColor;
-		 }
-		 else {
-			 whiteProgram = whiteDiffuseColor;
-			 vertColorProgram = vertexDiffuseColor;
-		 }
-		 
-		 whiteProgram.program.begin();
-		 glUniform4f(whiteProgram.lightIntensityUniform, 0.8f, 0.8f, 0.8f, 1);
-		 glUniform4f(whiteProgram.ambientIntensityUniform, 0.2f, 0.2f, 0.2f, 1);
-		 vertColorProgram.program.begin();
-		 glUniform4f(vertColorProgram.lightIntensityUniform, 0.8f, 0.8f, 0.8f, 1);
-		 glUniform4f(vertColorProgram.ambientIntensityUniform, 0.2f, 0.2f, 0.2f, 1);
-		 vertColorProgram.program.end();
-		 
-		 {
-			 modelMatrix.pushMatrix();
-			 
-			 {
-				 modelMatrix.pushMatrix();
-				 
-				 whiteProgram.program.begin();
-				 glUniformMatrix4(whiteProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
-				 
-				 Vector4 lightPosModelSpace = new Matrix4(modelMatrix.getTop()).inverse().mult(lightPosCameraSpace);
-				 glUniform3(whiteProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
-				 
-				 planeMesh.render();
-				 whiteProgram.program.end();
-				 
-				 modelMatrix.popMatrix();
-			 }
-			 
-			 {
-				 modelMatrix.pushMatrix();
-				 
-				 modelMatrix.getTop().mult(objectPole.calcMatrix());
-				 
-				 if(scaleCyl)
-					 modelMatrix.getTop().scale(1, 1, 0.2f);
-				 
-				 Vector4 lightPosModelSpace = new Matrix4(modelMatrix.getTop()).inverse().mult(lightPosCameraSpace);
-				 
-				 if(drawColoredCyl) {
-					 vertColorProgram.program.begin();
-					 glUniformMatrix4(vertColorProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
-					 glUniform3(vertColorProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
-					 cylinderMesh.render("lit-color");
-					 vertColorProgram.program.end();
-				 }
-				 else {
-					 whiteProgram.program.begin();
-					 glUniformMatrix4(whiteProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
-					 glUniform3(whiteProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
-					 cylinderMesh.render("lit");
-					 whiteProgram.program.end();
-				 }
-				 
-				 modelMatrix.popMatrix();
-			 }
-			 
-			 if(drawLight) {
-				 modelMatrix.pushMatrix();
-				 
-				 modelMatrix.getTop().translate(new Vector3(worldLightPos));
-				 modelMatrix.getTop().scale(0.1f, 0.1f, 0.1f);
-				 
-				 unlit.program.begin();
-				 glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
-				 glUniform4f(unlit.objectColorUniform, 0.8078f, 0.8706f, 0.9922f, 1);
-				 cubeMesh.render("flat");
-				 
-				 modelMatrix.popMatrix();
-			 }
-			 
-			 modelMatrix.popMatrix();
-		 }
+		MatrixStack modelMatrix = new MatrixStack();
+		modelMatrix.setTop(viewPole.calcMatrix());
+		
+		Vector4 worldLightPos = calcLightPosition();
+		Vector4 lightPosCameraSpace = modelMatrix.getTop().mult(worldLightPos);
+		
+		ProgramData whiteProgram, vertColorProgram;
+		
+		if(useFragmentLighting) {
+			whiteProgram = fragWhiteDiffuseColor;
+			vertColorProgram = fragVertexDiffuseColor;
+		}
+		else {
+			whiteProgram = whiteDiffuseColor;
+			vertColorProgram = vertexDiffuseColor;
+		}
+		
+		whiteProgram.program.begin();
+		glUniform4f(whiteProgram.lightIntensityUniform, 0.8f, 0.8f, 0.8f, 1);
+		glUniform4f(whiteProgram.ambientIntensityUniform, 0.2f, 0.2f, 0.2f, 1);
+		vertColorProgram.program.begin();
+		glUniform4f(vertColorProgram.lightIntensityUniform, 0.8f, 0.8f, 0.8f, 1);
+		glUniform4f(vertColorProgram.ambientIntensityUniform, 0.2f, 0.2f, 0.2f, 1);
+		vertColorProgram.program.end();
+		
+		{
+			modelMatrix.pushMatrix();
+			
+			{
+				modelMatrix.pushMatrix();
+				
+				whiteProgram.program.begin();
+				glUniformMatrix4(whiteProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+				
+				Vector4 lightPosModelSpace = new Matrix4(modelMatrix.getTop()).inverse().mult(lightPosCameraSpace);
+				glUniform3(whiteProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
+				
+				planeMesh.render();
+				whiteProgram.program.end();
+				
+				modelMatrix.popMatrix();
+			}
+			
+			{
+				modelMatrix.pushMatrix();
+				
+				modelMatrix.getTop().mult(objectPole.calcMatrix());
+				
+				if(scaleCyl)
+					modelMatrix.getTop().scale(1, 1, 0.2f);
+				
+				Vector4 lightPosModelSpace = new Matrix4(modelMatrix.getTop()).inverse().mult(lightPosCameraSpace);
+				if(drawColoredCyl) {
+					vertColorProgram.program.begin();
+					glUniformMatrix4(vertColorProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+					glUniform3(vertColorProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
+					cylinderMesh.render("lit-color");
+					vertColorProgram.program.end();
+				}
+				else {
+					whiteProgram.program.begin();
+					glUniformMatrix4(whiteProgram.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+					glUniform3(whiteProgram.modelSpaceLightPosUniform, lightPosModelSpace.toBuffer());
+					cylinderMesh.render("lit");
+					whiteProgram.program.end();
+				}
+				
+				modelMatrix.popMatrix();
+			}
+			
+			if(drawLight) {
+				modelMatrix.pushMatrix();
+				
+				modelMatrix.getTop().translate(new Vector3(worldLightPos));
+				modelMatrix.getTop().scale(0.1f, 0.1f, 0.1f);
+				
+				unlit.program.begin();
+				glUniformMatrix4(unlit.modelToCameraMatrixUniform, false, modelMatrix.getTop().toBuffer());
+				glUniform4f(unlit.objectColorUniform, 0.8078f, 0.8706f, 0.9922f, 1);
+				cubeMesh.render("flat");
+				
+				modelMatrix.popMatrix();
+			}
+			
+			modelMatrix.popMatrix();
+		}
 	}
 	
 	private static class ProgramData {

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example2/example10.2.FragLighting.frag

 	
 	float cosAngIncidence = clamp(dot(normalize(vertexNormal), lightDir), 0, 1);
 	
-	outputColor = (diffuseColor *lightIntensity * cosAngIncidence) + (diffuseColor * ambientIntensity);
+	outputColor = (diffuseColor * lightIntensity * cosAngIncidence) + (diffuseColor * ambientIntensity);
 }

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

-package com.ra4king.opengl.arcsynthesis.gl33.chapter10.example3;
-
-public class Example10_3 {
-	
-}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.FragLightAtten.frag

+#version 330
+
+in vec4 diffuseColor;
+in vec3 vertexNormal;
+
+out vec4 outputColor;
+
+uniform vec3 modelSpaceLightPos;
+
+uniform vec4 lightIntensity;
+uniform vec4 ambientIntensity;
+
+uniform vec3 cameraSpaceLightPos;
+
+uniform float lightAttenuation;
+uniform bool useRSquare;
+
+uniform UnProjection {
+	mat4 clipToCameraMatrix;
+	ivec2 windowSize;
+};
+
+vec3 CalcCameraSpacePosition()
+{
+	vec4 ndcPos;
+	ndcPos.xy = ((gl_FragCoord.xy / windowSize.xy) * 2) - 1;
+	ndcPos.z = (2 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near);
+	ndcPos.w = 1;
+	
+	vec4 clipPos = ndcPos / gl_FragCoord.w;
+	
+	return vec3(clipToCameraMatrix * clipPos);
+}
+
+vec4 ApplyLightIntensity(in vec3 cameraSpacePosition, out vec3 lightDirection)
+{
+	vec3 lightDifference = cameraSpaceLightPos - cameraSpacePosition;
+	float lightDistanceSqr = dot(lightDifference, lightDifference);
+	lightDirection = lightDifference * inversesqrt(lightDistanceSqr);
+	
+	float distFactor = useRSquare ? lightDistanceSqr : sqrt(lightDistanceSqr);
+	
+	return lightIntensity / (1 + lightAttenuation * distFactor);
+}
+
+void main()
+{
+	vec3 cameraSpacePosition = CalcCameraSpacePosition();
+	
+	vec3 lightDir = vec3(0);
+	vec4 attenIntensity = ApplyLightIntensity(cameraSpacePosition, lightDir);
+	
+	float cosAngIncidence = clamp(dot(normalize(vertexNormal), lightDir), 0, 1);
+	
+	outputColor = (diffuseColor * attenIntensity * cosAngIncidence) + (diffuseColor * ambientIntensity);
+}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.FragLightAtten_PCN.vert

+#version 330
+
+layout(location = 0) in vec3 position;
+layout(location = 1) in vec4 inDiffuseColor;
+layout(location = 2) in vec3 normal;
+
+out vec4 diffuseColor;
+out vec3 vertexNormal;
+
+uniform mat4 modelToCameraMatrix;
+uniform mat3 normalModelToCameraMatrix;
+
+uniform Projection
+{
+	mat4 cameraToClipMatrix;
+};
+
+void main()
+{
+	gl_Position = cameraToClipMatrix * modelToCameraMatrix * vec4(position, 1);
+	
+	vertexNormal = normalModelToCameraMatrix * normal;
+	diffuseColor = inDiffuseColor;
+}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.FragLightAtten_PN.vert

+#version 330
+
+layout(location = 0) in vec3 position;
+layout(location = 2) in vec3 normal;
+
+out vec4 diffuseColor;
+out vec3 vertexNormal;
+
+uniform mat4 modelToCameraMatrix;
+uniform mat3 normalModelToCameraMatrix;
+
+uniform Projection
+{
+	mat4 cameraToClipMatrix;
+};
+
+void main()
+{
+	gl_Position = cameraToClipMatrix * modelToCameraMatrix * vec4(position, 1);
+	
+	vertexNormal = normalModelToCameraMatrix * normal;
+	diffuseColor = vec4(1);
+}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.LargePlane.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<?oxygen RNGSchema="../../Documents/meshFormat.rnc" type="compact"?>
+
+<mesh xmlns="http://www.arcsynthesis.com/gltut/mesh" >
+	<attribute index="0" type="float" size="3" > 
+		30 0 -30
+		30 0 30
+		-30 0 30
+		-30 0 -30
+		30 0 -30
+		30 0 30
+		-30 0 30
+		-30 0 -30
+	</attribute>
+	<attribute index="2" type="float" size="3" > 
+		0 1 0
+		0 1 0
+		0 1 0
+		0 1 0
+		0 -1 0
+		0 -1 0
+		0 -1 0
+		0 -1 0
+	</attribute>
+	<indices cmd="triangles" type="ushort" > 
+		0 1 2
+		2 3 0
+		4 6 5
+		6 4 7
+	</indices>
+</mesh>

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.Transform.vert

+#version 330
+
+layout(location = 0) in vec3 position;
+
+uniform mat4 modelToCameraMatrix;
+
+uniform Projection
+{
+	mat4 cameraToClipMatrix;
+};
+
+void main()
+{
+	gl_Position = cameraToClipMatrix * modelToCameraMatrix * vec4(position, 1);
+}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.UniformColor.frag

+#version 330
+
+uniform vec4 objectColor;
+
+out vec4 outputColor;
+
+void main()
+{
+	outputColor = objectColor;
+}

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.UnitCube.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<?oxygen RNGSchema="../../Documents/meshFormat.rnc" type="compact"?>
+
+<mesh xmlns="http://www.arcsynthesis.com/gltut/mesh" >
+	<attribute index="0" type="float" size="3" > 
+		0.5 0.5 0.5
+		0.5 -0.5 0.5
+		-0.5 -0.5 0.5
+		-0.5 0.5 0.5
+		0.5 0.5 0.5
+		-0.5 0.5 0.5
+		-0.5 0.5 -0.5
+		0.5 0.5 -0.5
+		0.5 0.5 0.5
+		0.5 0.5 -0.5
+		0.5 -0.5 -0.5
+		0.5 -0.5 0.5
+		0.5 0.5 -0.5
+		-0.5 0.5 -0.5
+		-0.5 -0.5 -0.5
+		0.5 -0.5 -0.5
+		0.5 -0.5 0.5
+		0.5 -0.5 -0.5
+		-0.5 -0.5 -0.5
+		-0.5 -0.5 0.5
+		-0.5 0.5 0.5
+		-0.5 -0.5 0.5
+		-0.5 -0.5 -0.5
+		-0.5 0.5 -0.5
+	</attribute>
+	<attribute index="1" type="float" size="4" > 
+		0 1 0 1
+		0 1 0 1
+		0 1 0 1
+		0 1 0 1
+		0 0 1 1
+		0 0 1 1
+		0 0 1 1
+		0 0 1 1
+		1 0 0 1
+		1 0 0 1
+		1 0 0 1
+		1 0 0 1
+		1 1 0 1
+		1 1 0 1
+		1 1 0 1
+		1 1 0 1
+		0 1 1 1
+		0 1 1 1
+		0 1 1 1
+		0 1 1 1
+		1 0 1 1
+		1 0 1 1
+		1 0 1 1
+		1 0 1 1
+	</attribute>
+	<vao name="color" >
+		<source attrib="0" />
+		<source attrib="1" />
+	</vao>
+	<vao name="flat" >
+		<source attrib="0" />
+	</vao>
+	<indices cmd="triangles" type="ushort" > 
+		0 1 2
+		2 3 0
+		4 5 6
+		6 7 4
+		8 9 10
+		10 11 8
+		12 13 14
+		14 15 12
+		16 17 18
+		18 19 16
+		20 21 22
+		22 23 20
+	</indices>
+</mesh>

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.UnitCylinder.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<?oxygen RNGSchema="../../Documents/meshFormat.rnc" type="compact"?>
+
+<mesh xmlns="http://www.arcsynthesis.com/gltut/mesh" >
+	<attribute index="0" type="float" size="3" > 
+		0 0.5 0
+		0.5 0.5 0
+		0.5 -0.5 0
+		0.48907381875731 0.5 0.1039557588888
+		0.48907381875731 -0.5 0.1039557588888
+		0.45677280077542 0.5 0.20336815992623
+		0.45677280077542 -0.5 0.20336815992623
+		0.40450865316151 0.5 0.29389241146627
+		0.40450865316151 -0.5 0.29389241146627
+		0.33456556611288 0.5 0.37157217599218
+		0.33456556611288 -0.5 0.37157217599218
+		0.2500003830126 0.5 0.43301248075957
+		0.2500003830126 -0.5 0.43301248075957
+		0.15450900193016 0.5 0.47552809414644
+		0.15450900193016 -0.5 0.47552809414644
+		0.052264847412855 0.5 0.49726088296277
+		0.052264847412855 -0.5 0.49726088296277
+		-0.052263527886268 0.5 0.49726102165048
+		-0.052263527886268 -0.5 0.49726102165048
+		-0.15450774007312 0.5 0.47552850414828
+		-0.15450774007312 -0.5 0.47552850414828
+		-0.24999923397422 0.5 0.43301314415651
+		-0.24999923397422 -0.5 0.43301314415651
+		-0.33456458011157 0.5 0.37157306379065
+		-0.33456458011157 -0.5 0.37157306379065
+		-0.40450787329018 0.5 0.29389348486527
+		-0.40450787329018 -0.5 0.29389348486527
+		-0.45677226111814 0.5 0.20336937201315
+		-0.45677226111814 -0.5 0.20336937201315
+		-0.48907354289964 0.5 0.10395705668972
+		-0.48907354289964 -0.5 0.10395705668972
+		-0.49999999999824 0.5 1.3267948966764e-006
+		-0.49999999999824 -0.5 1.3267948966764e-006
+		-0.48907409461153 0.5 -0.10395446108714
+		-0.48907409461153 -0.5 -0.10395446108714
+		-0.45677334042948 0.5 -0.20336694783787
+		-0.45677334042948 -0.5 -0.20336694783787
+		-0.40450943302999 0.5 -0.2938913380652
+		-0.40450943302999 -0.5 -0.2938913380652
+		-0.33456655211184 0.5 -0.3715712881911
+		-0.33456655211184 -0.5 -0.3715712881911
+		-0.25000153204922 0.5 -0.43301181735958
+		-0.25000153204922 -0.5 -0.43301181735958
+		-0.15451026378611 0.5 -0.47552768414126
+		-0.15451026378611 -0.5 -0.47552768414126
+		-0.052266166939075 0.5 -0.49726074427155
+		-0.052266166939075 -0.5 -0.49726074427155
+		0.052262208359312 0.5 -0.4972611603347
+		0.052262208359312 -0.5 -0.4972611603347
+		0.15450647821499 0.5 -0.47552891414676
+		0.15450647821499 -0.5 -0.47552891414676
+		0.24999808493408 0.5 -0.4330138075504
+		0.24999808493408 -0.5 -0.4330138075504
+		0.3345635941079 0.5 -0.37157395158649
+		0.3345635941079 -0.5 -0.37157395158649
+		0.40450709341601 0.5 -0.2938945582622
+		0.40450709341601 -0.5 -0.2938945582622
+		0.45677172145764 0.5 -0.20337058409865
+		0.45677172145764 -0.5 -0.20337058409865
+		0.48907326703854 0.5 -0.10395835448992
+		0.48907326703854 -0.5 -0.10395835448992
+		0 -0.5 0
+		0.5 0.5 0
+		0.5 -0.5 0
+		0.48907381875731 0.5 0.1039557588888
+		0.48907381875731 -0.5 0.1039557588888
+		0.45677280077542 0.5 0.20336815992623
+		0.45677280077542 -0.5 0.20336815992623
+		0.40450865316151 0.5 0.29389241146627
+		0.40450865316151 -0.5 0.29389241146627
+		0.33456556611288 0.5 0.37157217599218
+		0.33456556611288 -0.5 0.37157217599218
+		0.2500003830126 0.5 0.43301248075957
+		0.2500003830126 -0.5 0.43301248075957
+		0.15450900193016 0.5 0.47552809414644
+		0.15450900193016 -0.5 0.47552809414644
+		0.052264847412855 0.5 0.49726088296277
+		0.052264847412855 -0.5 0.49726088296277
+		-0.052263527886268 0.5 0.49726102165048
+		-0.052263527886268 -0.5 0.49726102165048
+		-0.15450774007312 0.5 0.47552850414828
+		-0.15450774007312 -0.5 0.47552850414828
+		-0.24999923397422 0.5 0.43301314415651
+		-0.24999923397422 -0.5 0.43301314415651
+		-0.33456458011157 0.5 0.37157306379065
+		-0.33456458011157 -0.5 0.37157306379065
+		-0.40450787329018 0.5 0.29389348486527
+		-0.40450787329018 -0.5 0.29389348486527
+		-0.45677226111814 0.5 0.20336937201315
+		-0.45677226111814 -0.5 0.20336937201315
+		-0.48907354289964 0.5 0.10395705668972
+		-0.48907354289964 -0.5 0.10395705668972
+		-0.49999999999824 0.5 1.3267948966764e-006
+		-0.49999999999824 -0.5 1.3267948966764e-006
+		-0.48907409461153 0.5 -0.10395446108714
+		-0.48907409461153 -0.5 -0.10395446108714
+		-0.45677334042948 0.5 -0.20336694783787
+		-0.45677334042948 -0.5 -0.20336694783787
+		-0.40450943302999 0.5 -0.2938913380652
+		-0.40450943302999 -0.5 -0.2938913380652
+		-0.33456655211184 0.5 -0.3715712881911
+		-0.33456655211184 -0.5 -0.3715712881911
+		-0.25000153204922 0.5 -0.43301181735958
+		-0.25000153204922 -0.5 -0.43301181735958
+		-0.15451026378611 0.5 -0.47552768414126
+		-0.15451026378611 -0.5 -0.47552768414126
+		-0.052266166939075 0.5 -0.49726074427155
+		-0.052266166939075 -0.5 -0.49726074427155
+		0.052262208359312 0.5 -0.4972611603347
+		0.052262208359312 -0.5 -0.4972611603347
+		0.15450647821499 0.5 -0.47552891414676
+		0.15450647821499 -0.5 -0.47552891414676
+		0.24999808493408 0.5 -0.4330138075504
+		0.24999808493408 -0.5 -0.4330138075504
+		0.3345635941079 0.5 -0.37157395158649
+		0.3345635941079 -0.5 -0.37157395158649
+		0.40450709341601 0.5 -0.2938945582622
+		0.40450709341601 -0.5 -0.2938945582622
+		0.45677172145764 0.5 -0.20337058409865
+		0.45677172145764 -0.5 -0.20337058409865
+		0.48907326703854 0.5 -0.10395835448992
+		0.48907326703854 -0.5 -0.10395835448992
+	</attribute>
+	<attribute index="1" type="float" size="4" > 
+		1 1 1 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		1 1 1 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.9 0.5 0.5 1
+		0.9 0.5 0.5 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.5 0.1 0.1 1
+		0.5 0.1 0.1 1
+		0.58 0.18 0.18 1
+		0.58 0.18 0.18 1
+		0.66 0.26 0.26 1
+		0.66 0.26 0.26 1
+		0.74 0.34 0.34 1
+		0.74 0.34 0.34 1
+		0.82 0.42 0.42 1
+		0.82 0.42 0.42 1
+	</attribute>
+	<attribute index="2" type="float" size="3" > 
+		0 1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 1 0
+		0 -1 0
+		0 -1 0
+		1 0 0
+		1 0 0
+		0.97814763751461 0 0.20791151777759
+		0.97814763751461 0 0.20791151777759
+		0.91354560155084 0 0.40673631985245
+		0.91354560155084 0 0.40673631985245
+		0.80901730632302 0 0.58778482293254
+		0.80901730632302 0 0.58778482293254
+		0.66913113222576 0 0.74314435198437
+		0.66913113222576 0 0.74314435198437
+		0.5000007660252 0 0.86602496151913
+		0.5000007660252 0 0.86602496151913
+		0.30901800386032 0 0.95105618829288
+		0.30901800386032 0 0.95105618829288
+		0.10452969482571 0 0.99452176592553
+		0.10452969482571 0 0.99452176592553
+		-0.10452705577254 0 0.99452204330096
+		-0.10452705577254 0 0.99452204330096
+		-0.30901548014624 0 0.95105700829655
+		-0.30901548014624 0 0.95105700829655
+		-0.49999846794844 0 0.86602628831301
+		-0.49999846794844 0 0.86602628831301
+		-0.66912916022314 0 0.7431461275813
+		-0.66912916022314 0 0.7431461275813
+		-0.80901574658037 0 0.58778696973054
+		-0.80901574658037 0 0.58778696973054
+		-0.91354452223627 0 0.40673874402631
+		-0.91354452223627 0 0.40673874402631
+		-0.97814708579929 0 0.20791411337945
+		-0.97814708579929 0 0.20791411337945
+		-0.99999999999648 0 2.6535897933527e-006
+		-0.99999999999648 0 2.6535897933527e-006
+		-0.97814818922305 0 -0.20790892217427
+		-0.97814818922305 0 -0.20790892217427
+		-0.91354668085897 0 -0.40673389567574
+		-0.91354668085897 0 -0.40673389567574
+		-0.80901886605998 0 -0.58778267613041
+		-0.80901886605998 0 -0.58778267613041
+		-0.66913310422368 0 -0.74314257638221
+		-0.66913310422368 0 -0.74314257638221
+		-0.50000306409843 0 -0.86602363471916
+		-0.50000306409843 0 -0.86602363471916
+		-0.30902052757222 0 -0.95105536828251
+		-0.30902052757222 0 -0.95105536828251
+		-0.10453233387815 0 -0.9945214885431
+		-0.10453233387815 0 -0.9945214885431
+		0.10452441671862 0 -0.99452232066939
+		0.10452441671862 0 -0.99452232066939
+		0.30901295642998 0 -0.95105782829353
+		0.30901295642998 0 -0.95105782829353
+		0.49999616986816 0 -0.8660276151008
+		0.49999616986816 0 -0.8660276151008
+		0.66912718821581 0 -0.74314790317299
+		0.66912718821581 0 -0.74314790317299
+		0.80901418683202 0 -0.5877891165244
+		0.80901418683202 0 -0.5877891165244
+		0.91354344291528 0 -0.40674116819729
+		0.91354344291528 0 -0.40674116819729
+		0.97814653407707 0 -0.20791670897984
+		0.97814653407707 0 -0.20791670897984
+	</attribute>
+	<vao name="lit-color" >
+		<source attrib="0" />
+		<source attrib="1" />
+		<source attrib="2" />
+	</vao>
+	<vao name="lit" >
+		<source attrib="0" />
+		<source attrib="2" />
+	</vao>
+	<vao name="color" >
+		<source attrib="0" />
+		<source attrib="1" />
+	</vao>
+	<indices cmd="tri-fan" type="ushort" >0 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 59 1</indices>
+	<indices cmd="tri-fan" type="ushort" >61 60 58 56 54 52 50 48 46 44 42 40 38 36 34 32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2 60</indices>
+	<indices cmd="tri-strip" type="ushort" >62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 62 63</indices>
+</mesh>

src/main/java/com/ra4king/opengl/arcsynthesis/gl33/chapter10/example3/example10.3.frag

+#version 330
+
+smooth in vec4 interpColor;
+
+out vec4 outputColor;
+
+void main()
+{
+	outputColor = interpColor;
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.