How to use the gl/scene.RenderTarget function in gl

To help you get started, we’ve selected a few gl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwagner / voxelworlds / src / main.js View on Github external
new scene.Material(shaders.get('solid'), {color: vec4.create([0.5, 0.0, 0.0, 0.5])}, [
            new scene.SimpleMesh(new glUtils.VBO(mesh.cube(-0.5)))])
        ]);
    cube2 = new scene.Transform([
        new scene.Material(shaders.get('solid'), {color: vec4.create([0.0, 0.0, 1.0, 0.5])}, [
            new scene.SimpleMesh(new glUtils.VBO(mesh.cube(-0.5)))])
    ]);


    var shader = new scene.Material(shaders.get('voxel'), {}, [
            //new scene.SimpleMesh(new glutils.VBO(mesh.cube())),
            window.renderer
        ]);

    camera = new scene.Camera([
        new scene.RenderTarget(albedoFBO, [
            shader,
            cube
        ]),
        new scene.RenderTarget(blurFBO0, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: albedoFBO,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO1, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO0,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
github jwagner / voxelworlds / src / main.js View on Github external
new scene.Material(shaders.get('solid'), {color: vec4.create([0.0, 0.0, 1.0, 0.5])}, [
            new scene.SimpleMesh(new glUtils.VBO(mesh.cube(-0.5)))])
    ]);


    var shader = new scene.Material(shaders.get('voxel'), {}, [
            //new scene.SimpleMesh(new glutils.VBO(mesh.cube())),
            window.renderer
        ]);

    camera = new scene.Camera([
        new scene.RenderTarget(albedoFBO, [
            shader,
            cube
        ]),
        new scene.RenderTarget(blurFBO0, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: albedoFBO,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO1, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO0,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO2, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO1,
github jwagner / voxelworlds / src / main.js View on Github external
]),
        new scene.RenderTarget(blurFBO0, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: albedoFBO,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO1, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO0,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO2, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO1,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO1.height, blurFBO1.width])
            })
        ]),
        new scene.RenderTarget(blurFBO3, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO2,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO2.width, blurFBO2.height])
            })
        ]),
        new scene.Postprocess(shaders.get('postprocess.vertex', 'tonemap.frag'), {
            blur0: blurFBO1,
            blur1: blurFBO3,
github jwagner / voxelworlds / src / main.js View on Github external
window.renderer
        ]);

    camera = new scene.Camera([
        new scene.RenderTarget(albedoFBO, [
            shader,
            cube
        ]),
        new scene.RenderTarget(blurFBO0, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: albedoFBO,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO1, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO0,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO2, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO1,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO1.height, blurFBO1.width])
            })
        ]),
        new scene.RenderTarget(blurFBO3, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO2,
github jwagner / voxelworlds / src / main.js View on Github external
]),
        new scene.RenderTarget(blurFBO1, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO0,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO0.width, blurFBO0.height])
            })
        ]),
        new scene.RenderTarget(blurFBO2, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO1,
                direction: vec2.create([1, 0]),
                size: vec2.create([blurFBO1.height, blurFBO1.width])
            })
        ]),
        new scene.RenderTarget(blurFBO3, [
            new scene.Postprocess(shaders.get('blur.vertex', 'blur.frag'), {
                texture: blurFBO2,
                direction: vec2.create([0, 1]),
                size: vec2.create([blurFBO2.width, blurFBO2.height])
            })
        ]),
        new scene.Postprocess(shaders.get('postprocess.vertex', 'tonemap.frag'), {
            blur0: blurFBO1,
            blur1: blurFBO3,
            albedo: albedoFBO
        }),
        //cube2
    ]);


    var globals = new scene.Uniforms({