Commits

Brian McKenna  committed 18e5660

Updated example to latest WebGL spec

  • Participants
  • Parent commits 1b27b69

Comments (0)

Files changed (1)

File examples/example-include.js

 	].join("\n");
 	
 	var fsource = [
+	    "#ifdef GL_ES",
+	    "precision highp float;",
+	    "#endif",
+	    "",
 	    "varying vec2 vTextureCoord;",
 	    "",
 	    "uniform sampler2D uSampler;",
 	halfHeight = logo.height / 2;
 
         gl.bindTexture(gl.TEXTURE_2D, texture);
-	gl.texImage2D(gl.TEXTURE_2D, 0, logo, true);
+	gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
+	gl.texImage2D(gl.TEXTURE_2D,  0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, logo);
         gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
         gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
         gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
     var vertexPositionAttribute = gl.getAttribLocation(program, "aVertexPosition");
     gl.enableVertexAttribArray(vertexPositionAttribute);
     function setVerts(x, y) {
-
 	var vertices = [
 	    x + halfWidth, y + halfHeight, 0.0,
 	    x + -halfWidth, y + halfHeight, 0.0,