Commits

Philipp Tiefenbacher committed be36e89

experimental pixel raster shader in ca[0]

Comments (0)

Files changed (2)

hackathonAlpha.html

 			//gl_FragColor = texture2D(texFrame, vTexCoord);
 		}
 	</script>
+	
+		<script id="shader-fs-paletteAndScale" type="x-shader/x-fragment"> 
+		#ifdef GL_ES
+		precision highp float;
+		#endif
+		uniform sampler2D texFrame;
+		varying vec2 vTexCoord;
+		void main(void) {
+			vec2 vCT;
+			vCT.x = vTexCoord.x/3.;
+			vCT.y = vTexCoord.y/3.;
+			int xmod = int(vTexCoord.x * 499.0);
+			int xmm = xmod / 3;
+			xmod = xmod - (xmm * 3);
+
+			int ymod = int(vTexCoord.y * 399.0);
+			int ymm = ymod / 3;
+			ymod = ymod - (ymm * 3);
+
+			if (xmod == 0 || ymod == 0)
+			{
+				gl_FragColor = vec4(0.,0.,0.,1.);
+			}
+			else
+			{
+				vec4 color = texture2D(texFrame, vCT);
+				//if (color.a == 0.)
+				//	gl_FragColor = vec4(0., 0., 0., 0.);
+				//else
+					gl_FragColor = vec4(color.a*600.0, color.a*color.a*color.a*400000.0, 0., 1.);
+		
+				//gl_FragColor = texture2D(texFrame, vTexCoord);
+			}
+		}
+	</script>
 
 <script type="text/javascript">
 
 				
 
 				var caCanvasX = new EvoCell.CACanvas(canvasX);
-				caCanvasX.setupPaletteShader(getShaderFromElement(caCanvasX.gl, "shader-fs-palette"));
+				if (i != 0)
+					caCanvasX.setupPaletteShader(getShaderFromElement(caCanvasX.gl, "shader-fs-palette"));
+				else				
+					caCanvasX.setupPaletteShader(getShaderFromElement(caCanvasX.gl, "shader-fs-paletteAndScale"));
+
 				caSims[i] = new EvoCell.CASimulation(caCanvasX, evoCellData, colWidth, rowHeight);
 			}
 			
 	{
 		alert(gl.getShaderInfoLog(shader));
 		alert(sourceText);
-		alert(sourceText.substr(500));
-		alert(sourceText.substr(1000));
-		alert(sourceText.substr(1500));
-		alert(sourceText.substr(2000));
 	}
 	return shader;
 }
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.