Index: conformance/more/functions/texImage2DHTML.html |
=================================================================== |
--- conformance/more/functions/texImage2DHTML.html (revision 0) |
+++ conformance/more/functions/texImage2DHTML.html (revision 0) |
@@ -0,0 +1,152 @@ |
+<!DOCTYPE html> |
+<html><head> |
+<meta charset="utf-8"> |
+<!-- |
+Tests for the OpenGL ES 2.0 HTML Canvas context |
+ |
+Copyright (C) 2011 Ilmari Heikkinen <ilmari.heikkinen@gmail.com> |
+ |
+Permission is hereby granted, free of charge, to any person |
+obtaining a copy of this software and associated documentation |
+files (the "Software"), to deal in the Software without |
+restriction, including without limitation the rights to use, |
+copy, modify, merge, publish, distribute, sublicense, and/or sell |
+copies of the Software, and to permit persons to whom the |
+Software is furnished to do so, subject to the following |
+conditions: |
+ |
+The above copyright notice and this permission notice shall be |
+included in all copies or substantial portions of the Software. |
+ |
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
+OTHER DEALINGS IN THE SOFTWARE. |
+ |
+--> |
+<link rel="stylesheet" type="text/css" href="../unit.css" /> |
+<script type="application/x-javascript" src="../unit.js"></script> |
+<script type="application/x-javascript" src="../util.js"></script> |
+<script type="application/x-javascript"> |
+ |
+Tests.startUnit = function () { |
+ var canvas = document.getElementById('gl'); |
+ var gl = wrapGLContext(canvas.getContext(GL_CONTEXT_ID)); |
+ gl.viewport(0,0,canvas.width,canvas.height); |
+ gl.clearColor(0,0,1,1); |
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
+ gl.disable(gl.DEPTH_TEST); |
+ return [gl]; |
+} |
+ |
+Tests.setup = function(gl) { |
+ var tex = gl.createTexture(); |
+ gl.bindTexture(gl.TEXTURE_2D, tex); |
+ var texCubeMap = gl.createTexture(); |
+ gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap); |
+ return [gl] |
+} |
+ |
+Tests.teardown = function(gl, tex, texCubeMap) { |
+ gl.bindTexture(gl.TEXTURE_2D, null); |
+ gl.deleteTexture(tex); |
+ gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); |
+ gl.deleteTexture(texCubeMap); |
+} |
+ |
+Tests.testTexImage2D = function(gl) { |
+ gl.enable(gl.BLEND); |
+ var img = document.getElementById('i'); |
+ var c = document.getElementById('c'); |
+ var ctx = c.getContext('2d'); |
+ ctx.drawImage(img,0,0); |
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img); |
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); |
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); |
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); |
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); |
+ var f = new Filter(gl, 'identity-flip-vert', 'identity-frag'); |
+ gl.blendFunc(gl.ONE, gl.ZERO); |
+ f.apply(); |
+ f.destroy(); |
+ gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); |
+ f = new Filter(gl, 'identity-hflip-vert', 'identity-frag'); |
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); |
+ f.apply(); |
+ f.destroy(); |
+ var valid_targets = [ |
+ gl.TEXTURE_2D, |
+ gl.TEXTURE_CUBE_MAP_POSITIVE_X, |
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_X, |
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Y, |
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, |
+ gl.TEXTURE_CUBE_MAP_POSITIVE_Z, |
+ gl.TEXTURE_CUBE_MAP_NEGATIVE_Z |
+ ]; |
+ valid_targets.forEach(function(t) { |
+ assertOk(function(){gl.texImage2D(t, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);}); |
+ assertOk(function(){gl.texImage2D(t, 1, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);}); |
+ }); |
+} |
+ |
+Tests.testTexImage2DNonSOP = function(gl) { |
+ var img = document.getElementById('i2'); |
+ while (!img.complete) {} |
+ var c = document.getElementById('c'); |
+ var ctx = c.getContext('2d'); |
+ ctx.drawImage(img,0,0); |
+ assertThrowNoGLError(gl, "texImage2D with cross-origin image should throw exception.", |
+ function(){gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, img);}); |
+ assertThrowNoGLError(gl, "texImage2D with dirty origin canvas should throw exception.", |
+ function(){gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c);}); |
+} |
+ |
+Tests.endUnit = function(gl) { |
+} |
+ |
+</script> |
+<script id="identity-flip-vert" type="x-shader/x-vertex"> |
+attribute vec3 Vertex; |
+attribute vec2 Tex; |
+ |
+varying vec4 texCoord0; |
+void main() |
+{ |
+ texCoord0 = vec4(Tex.s, 1.0-Tex.t, 0.0, 0.0); |
+ gl_Position = vec4(Vertex, 1.0); |
+} |
+</script> |
+<script id="identity-hflip-vert" type="x-shader/x-vertex"> |
+attribute vec3 Vertex; |
+attribute vec2 Tex; |
+ |
+varying vec4 texCoord0; |
+void main() |
+{ |
+ texCoord0 = vec4(1.0-Tex.s, Tex.t, 0.0, 0.0); |
+ gl_Position = vec4(Vertex, 1.0); |
+} |
+</script> |
+<script id="identity-frag" type="x-shader/x-fragment"> |
+precision mediump float; |
+ |
+uniform sampler2D Texture; |
+ |
+varying vec4 texCoord0; |
+void main() |
+{ |
+ vec4 c = texture2D(Texture, texCoord0.st); |
+ gl_FragColor = c; |
+} |
+</script> |
+</head><body> |
+<canvas id="gl" width="256" height="256"></canvas> |
+<canvas id="c" width="256" height="256"></canvas> |
+<img id="i" width="256" height="256" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAATVElEQVR4nO3d+VPUd57Hcf2b9k9Y+z44+qK7OZoGFVA5VfBGzah9cxpNzGEOoRua5lBEue/DK4fZ7MapmSm3Mlshu8xOdCpDJt3v/aEBAUHAOMG4z0fV53fqU/V6fd7fT/e32bEDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwOvBkar7l+3+GwBsk8xUrT0rTb8vx2Q45janlu7YsWPnsgXgTeYwak85U3Xv5ZiM3+XbUh/l2dICBc6080WZ1ur92baSHRQB8GayGdUWu1HzoSNFO+ZM1f2cbTLM51lT5woc5rkDObbZ/Vm2SEm23VvsyjhV5nJQBsCbxGZQVtmN6p4Mo/YPdqNGHKlayUrXJ9zWlESh0xIvzsmYL3HZ54pzMm6VuRyRMpfTW+pyUAbAm8BmVNVnGNTTdqP6vzOMGrGnaMSZqpNsk17ybKlS6DTL/ixbotRlj5flOubL3I65MpfjVrnbEalYKINSl335vQGA3wKbUW2xGdWRDKP66wyjWhYLwJGiFWeaTrJNBnFbU2SP3ST7s6xSmmuXcrczUe52xstzHfPlbsdcudt5qyzX3lKWlxkszXGeK8mxnyzJySjeQRkArzebQVllM6p7bUb149UF4EjVSmaaTrLS9eKypMgee7ocyLZJmdshFXmZUpHnXFEGB/OzJsrdjqEyt/NmWa49XJbt9Ja6Mk4Vu7hEBF5LNr2q3mZQz9gM6u9XFE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rD3Zm+TZ6i3yTPW1+yZ7GvyXO9r9vi3908H8M+wohB6m7xlt695Tw6EfecGw15ff5Pnnb5mT6D32oUD2/x3AvgV7dyxY8fOgSavu7/Jk9V3zave7j8IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAICV/g9tPJEQu1XvmQAAAABJRU5ErkJggg=="> |
+<img id="i2" src="http://mashable.com/wp-content/uploads/2008/08/thunderbird-logo-64x64.png"> |
+ |
+</body></html> |
Property changes on: conformance/more/functions/texImage2DHTML.html |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |