Created
July 23, 2016 00:10
-
-
Save realazthat/e08923ef30635d4c181fe5f394fb0de4 to your computer and use it in GitHub Desktop.
regl framebuffer bug demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Error (approximate, line numbers may have changed): | |
check.js:20Uncaught Error: (regl) invalid value: invalid color format for texture. must be one of: rgba | |
raise @ check.js:20 | |
checkOneOf @ check.js:71 | |
reglFramebuffer @ framebuffer.js:419 | |
createFBO @ framebuffer.js:613 | |
1.gl-mat4 @ bugs.js [sm]:47 | |
s @ _prelude.js:1e @ _prelude.js: | |
1(anonymous function) @ _prelude.js:1 | |
*/ | |
const mat4 = require('gl-mat4'); | |
const resl = require('resl'); | |
const regl = require('regl')(); | |
const M = [256,256]; | |
const graph_texture_width = regl.limits.maxTextureSize; | |
const graph_texture_height = regl.limits.maxTextureSize; | |
const quadVertexShader = ` | |
precision mediump float; | |
attribute vec3 position; | |
attribute vec2 uv; | |
varying vec2 vUv; | |
void main() { | |
vUv = uv; | |
gl_Position = vec4(position, 1); | |
} | |
`; | |
const quadFragShader = ` | |
precision mediump float; | |
varying vec2 vUv; | |
uniform sampler2D tex; | |
void main () { | |
gl_FragColor = texture2D(tex,vUv); | |
} | |
`; | |
const quadVerts = [ | |
[-1.0, +1.0, +0.0], [+1.0, +1.0, +0.0], [+1.0, -1.0, +0.0], [-1.0, -1.0, +0.0] | |
] | |
const quadUVs = [ | |
[0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 0.0] | |
] | |
const quadIndices = [ | |
[2, 1, 0], [2, 0, 3] | |
] | |
let bad_color_format = regl.framebuffer({ | |
width: M[0], | |
height: M[1], | |
depth: false, | |
stencil: false, | |
colorFormat: 'rgb', | |
colorType: 'float' | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment