Skip to content

Instantly share code, notes, and snippets.

@realazthat
Created July 23, 2016 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save realazthat/e08923ef30635d4c181fe5f394fb0de4 to your computer and use it in GitHub Desktop.
Save realazthat/e08923ef30635d4c181fe5f394fb0de4 to your computer and use it in GitHub Desktop.
regl framebuffer bug demo
/**
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