Skip to content

Instantly share code, notes, and snippets.

@realazthat
Created July 23, 2016 00:12
Show Gist options
  • Save realazthat/3c5b846c7c783805c9c35b7b8717decc to your computer and use it in GitHub Desktop.
Save realazthat/3c5b846c7c783805c9c35b7b8717decc to your computer and use it in GitHub Desktop.
regl framebuffer bug #2 demo
/**
Error, check webgl-inspector, texture created is of type unsigned byte, not float.
*/
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 doesnt_listen_to_color_format = regl.framebuffer({
color: regl.texture({
width: M[0],
height: M[1],
stencil: false,
colorFormat: 'rgba',
colorType: 'float',
depth: false,
wrap: 'clamp'
}),
width: M[0],
height: M[1],
depth: false,
stencil: false,
colorFormat: 'rgba',
colorType: 'float'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment